From 4221b980b66bbaebc23a0f9cc5dee7d649948e15 Mon Sep 17 00:00:00 2001 From: Joffrey Jaffeux Date: Wed, 6 Jun 2012 15:38:35 +0200 Subject: add test for word_wrap default charlim --- tests/codeigniter/helpers/text_helper_test.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'tests/codeigniter/helpers') diff --git a/tests/codeigniter/helpers/text_helper_test.php b/tests/codeigniter/helpers/text_helper_test.php index 974247c4f..d59b2743d 100644 --- a/tests/codeigniter/helpers/text_helper_test.php +++ b/tests/codeigniter/helpers/text_helper_test.php @@ -160,8 +160,17 @@ class Text_helper_test extends CI_TestCase { { $string = "Here is a simple string of text that will help us demonstrate this function."; $word_wraped = word_wrap($string, 25); - preg_match_all("/\r\n|\n/", $word_wraped, $matches); - $this->assertEquals(count($matches[0]), 4); + $this->assertEquals(substr_count($word_wraped, "\n"), 4); + } + + // ------------------------------------------------------------------------ + + public function test_default_word_wrap_charlim() + { + $string = "Here is a simple string of text that will help us demonstrate this function."; + $word_wraped = word_wrap($string); + $matches = preg_split("/\n/", $word_wraped, 1); + $this->assertEquals(strlen($matches[0]) - 1, 76); } } \ No newline at end of file -- cgit v1.2.3-24-g4f1b