summaryrefslogtreecommitdiffstats
path: root/tests/codeigniter
diff options
context:
space:
mode:
Diffstat (limited to 'tests/codeigniter')
-rw-r--r--tests/codeigniter/core/Input_test.php15
-rw-r--r--tests/codeigniter/helpers/text_helper_test.php18
2 files changed, 32 insertions, 1 deletions
diff --git a/tests/codeigniter/core/Input_test.php b/tests/codeigniter/core/Input_test.php
index cfc80c950..c9322c027 100644
--- a/tests/codeigniter/core/Input_test.php
+++ b/tests/codeigniter/core/Input_test.php
@@ -143,4 +143,19 @@ class Input_test extends CI_TestCase {
$this->assertEquals("Hello, i try to <script>alert('Hack');</script> your site", $harm);
$this->assertEquals("Hello, i try to [removed]alert&#40;'Hack'&#41;;[removed] your site", $harmless);
}
+
+ // --------------------------------------------------------------------
+
+ public function test_valid_ip()
+ {
+ $ip_v4 = '192.18.0.1';
+ $this->assertTrue($this->input->valid_ip($ip_v4));
+
+ $ip_v6 = array('2001:0db8:0000:85a3:0000:0000:ac1f:8001', '2001:db8:0:85a3:0:0:ac1f:8001', '2001:db8:0:85a3::ac1f:8001');
+ foreach($ip_v6 as $ip)
+ {
+ $this->assertTrue($this->input->valid_ip($ip));
+ }
+ }
+
} \ No newline at end of file
diff --git a/tests/codeigniter/helpers/text_helper_test.php b/tests/codeigniter/helpers/text_helper_test.php
index 584066b0c..73e2b9429 100644
--- a/tests/codeigniter/helpers/text_helper_test.php
+++ b/tests/codeigniter/helpers/text_helper_test.php
@@ -122,7 +122,7 @@ class Text_helper_test extends CI_TestCase {
// ------------------------------------------------------------------------
- public function test_ellipsizing()
+ public function test_ellipsize()
{
$strs = array(
'0' => array(
@@ -156,4 +156,20 @@ class Text_helper_test extends CI_TestCase {
// ------------------------------------------------------------------------
+ public function test_word_wrap()
+ {
+ $string = "Here is a simple string of text that will help us demonstrate this function.";
+ $word_wrapped = word_wrap($string, 25);
+ $this->assertEquals(substr_count($word_wrapped, "\n"), 4);
+ }
+
+ // ------------------------------------------------------------------------
+
+ public function test_default_word_wrap_charlim()
+ {
+ $string = "Here is a longer string of text that will help us demonstrate the default charlim of this function.";
+ $word_wrapped = word_wrap($string);
+ $this->assertEquals(strpos($word_wrapped, "\n"), 73);
+ }
+
} \ No newline at end of file