Skip to content

Commit 73e99d0

Browse files
author
liuxuhui
committed
fix StringTest
1 parent 9d17321 commit 73e99d0

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

tests/Coduo/PHPHumanizer/Tests/StringTest.php

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,16 @@ function test_truncate_string_to_word_closest_to_a_certain_number_of_characters(
3434
$this->assertEquals($expected, String::truncate($text, $charactersCount, $append));
3535
}
3636

37-
function it_truncate_string_to_word_closest_to_a_certain_number_of_characters_with_html_tags($text, $charactersCount, $allowedTags, $expected, $append = '')
37+
/**
38+
* @dataProvider truncateHtmlStringProvider
39+
*
40+
* @param $text
41+
* @param $charactersCount
42+
* @param $allowedTags
43+
* @param $expected
44+
* @param $append
45+
*/
46+
function test_truncate_string_to_word_closest_to_a_certain_number_of_characters_with_html_tags($text, $charactersCount, $allowedTags, $expected, $append = '')
3847
{
3948
$this->assertEquals($expected, String::truncateHtml($text, $charactersCount, $allowedTags, $append));
4049
}
@@ -57,6 +66,7 @@ public function humanizeStringProvider()
5766
}
5867

5968
/**
69+
*
6070
* @return array
6171
*/
6272
public function truncateStringProvider()
@@ -84,6 +94,10 @@ public function truncateStringProvider()
8494
);
8595
}
8696

97+
/**
98+
*
99+
* @return array
100+
*/
87101
public function truncateHtmlStringProvider()
88102
{
89103
$text = '<p><b>HyperText Markup Language</b>, commonly referred to as <b>HTML</b>, is the standard <a href="/wiki/Markup_language" title="Markup language">markup language</a> used to create <a href="/wiki/Web_page" title="Web page">web pages</a>.<sup id="cite_ref-1" class="reference"><a href="#cite_note-1"><span>[</span>1<span>]</span></a></sup> <a href="/wiki/Web_browser" title="Web browser">Web browsers</a> can read HTML files and render them into visible or audible web pages. HTML describes the structure of a <a href="/wiki/Website" title="Website">website</a> <a href="/wiki/Semantic" title="Semantic" class="mw-redirect">semantically</a> along with cues for presentation, making it a markup language, rather than a <a href="/wiki/Programming_language" title="Programming language">programming language</a>.</p>';
@@ -104,4 +118,4 @@ public function truncateHtmlStringProvider()
104118
array($text, 75, '<b><i><u><em><strong><a><span>', '<b>HyperText Markup Language</b>, commonly referred to as <b>HTML</b>, is the standard <a href="/wiki/Markup_language" title="Markup language">markup...</a>', '...')
105119
);
106120
}
107-
}
121+
}

0 commit comments

Comments
 (0)