diff options
author | Andrey Andreev <narf@bofh.bg> | 2012-06-06 22:56:36 +0200 |
---|---|---|
committer | Andrey Andreev <narf@bofh.bg> | 2012-06-06 22:56:36 +0200 |
commit | 62875bc789b60d95aa73fddda87d69fc88c66558 (patch) | |
tree | cb7032b975d6d7ce5f00d3db285b8f2338901556 /tests/codeigniter/core/Input_test.php | |
parent | 296ab9a06e3c648de56861ad67581236a6dae71a (diff) | |
parent | 3dfa14b3831c6f22acdca3d3ae8f0cb48e66b782 (diff) |
Merge pull request #1435 from jjaffeux/valid-ipv6
IPv6 support for CI_Input::valid_ip()
Diffstat (limited to 'tests/codeigniter/core/Input_test.php')
-rw-r--r-- | tests/codeigniter/core/Input_test.php | 15 |
1 files changed, 15 insertions, 0 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('Hack');[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 |