diff options
Diffstat (limited to 'tests/codeigniter/helpers/text_helper_test.php')
-rw-r--r-- | tests/codeigniter/helpers/text_helper_test.php | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/tests/codeigniter/helpers/text_helper_test.php b/tests/codeigniter/helpers/text_helper_test.php index 7a7dc0a12..36465f203 100644 --- a/tests/codeigniter/helpers/text_helper_test.php +++ b/tests/codeigniter/helpers/text_helper_test.php @@ -2,21 +2,19 @@ class Text_helper_test extends CI_TestCase { - private $_long_string; - public function set_up() { $this->helper('text'); - - $this->_long_string = 'Once upon a time, a framework had no tests. It sad. So some nice people began to write tests. The more time that went on, the happier it became. Everyone was happy.'; } // ------------------------------------------------------------------------ public function test_word_limiter() { - $this->assertEquals('Once upon a time,…', word_limiter($this->_long_string, 4)); - $this->assertEquals('Once upon a time,…', word_limiter($this->_long_string, 4, '…')); + $long_string = 'Once upon a time, a framework had no tests. It sad. So some nice people began to write tests. The more time that went on, the happier it became. Everyone was happy.'; + + $this->assertEquals('Once upon a time,…', word_limiter($long_string, 4)); + $this->assertEquals('Once upon a time,…', word_limiter($long_string, 4, '…')); $this->assertEquals('', word_limiter('', 4)); } @@ -24,8 +22,10 @@ class Text_helper_test extends CI_TestCase { public function test_character_limiter() { - $this->assertEquals('Once upon a time, a…', character_limiter($this->_long_string, 20)); - $this->assertEquals('Once upon a time, a…', character_limiter($this->_long_string, 20, '…')); + $long_string = 'Once upon a time, a framework had no tests. It sad. So some nice people began to write tests. The more time that went on, the happier it became. Everyone was happy.'; + + $this->assertEquals('Once upon a time, a…', character_limiter($long_string, 20)); + $this->assertEquals('Once upon a time, a…', character_limiter($long_string, 20, '…')); $this->assertEquals('Short', character_limiter('Short', 20)); $this->assertEquals('Short', character_limiter('Short', 5)); } @@ -103,8 +103,13 @@ class Text_helper_test extends CI_TestCase { // ------------------------------------------------------------------------ + /** + * @runInSeparateProcess + */ public function test_highlight_phrase() { + define('UTF8_ENABLED', FALSE); + $strs = array( 'this is a phrase' => '<mark>this is</mark> a phrase', 'this is another' => '<mark>this is</mark> another', @@ -171,4 +176,4 @@ class Text_helper_test extends CI_TestCase { $this->assertEquals(strpos(word_wrap($string), "\n"), 73); } -}
\ No newline at end of file +} |