summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJoffrey Jaffeux <j.jaffeux@gmail.com>2012-06-06 15:38:35 +0200
committerJoffrey Jaffeux <j.jaffeux@gmail.com>2012-06-06 15:38:35 +0200
commit4221b980b66bbaebc23a0f9cc5dee7d649948e15 (patch)
treeec50f3d5a461224e5cb7edefa30e90a004172577 /tests
parent0ef92f6fa4a40d4a689eee3ebd7eb7d632fe29c0 (diff)
add test for word_wrap default charlim
Diffstat (limited to 'tests')
-rw-r--r--tests/codeigniter/helpers/text_helper_test.php13
1 files changed, 11 insertions, 2 deletions
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