diff options
author | Andrey Andreev <narf@devilix.net> | 2015-03-18 11:35:47 +0100 |
---|---|---|
committer | Andrey Andreev <narf@devilix.net> | 2015-03-18 11:35:47 +0100 |
commit | fe5099a695c25e503a0aff6124644b9011a27e0d (patch) | |
tree | d9fe18a4adaf8dd8e260462f58d37038c279b7b1 /tests/codeigniter | |
parent | 35514731f05c749526939de4812f5288ff3cc007 (diff) |
Polish some recent changes in test cases
Diffstat (limited to 'tests/codeigniter')
-rw-r--r-- | tests/codeigniter/core/Input_test.php | 10 | ||||
-rw-r--r-- | tests/codeigniter/core/Security_test.php | 20 |
2 files changed, 14 insertions, 16 deletions
diff --git a/tests/codeigniter/core/Input_test.php b/tests/codeigniter/core/Input_test.php index d3f5a9048..159a877dc 100644 --- a/tests/codeigniter/core/Input_test.php +++ b/tests/codeigniter/core/Input_test.php @@ -134,15 +134,14 @@ class Input_test extends CI_TestCase { $this->assertEquals('bar', $foo); $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); - + $_SERVER['REQUEST_METHOD'] = 'POST'; $_POST['foo']['bar'] = 'baz'; - $barArray = array( 'bar' => 'baz' ); - + $barArray = array('bar' => 'baz'); + $this->assertEquals('baz', $this->input->post('foo[bar]')); $this->assertEquals($barArray, $this->input->post('foo[]')); $this->assertNull($this->input->post('foo[baz]')); - } // -------------------------------------------------------------------- @@ -222,5 +221,4 @@ class Input_test extends CI_TestCase { // Back to reality $_SERVER['REMOTE_ADDR'] = '127.0.0.1'; // back to reality } - -}
\ No newline at end of file +} diff --git a/tests/codeigniter/core/Security_test.php b/tests/codeigniter/core/Security_test.php index 7f467fb1b..b5524da0f 100644 --- a/tests/codeigniter/core/Security_test.php +++ b/tests/codeigniter/core/Security_test.php @@ -138,12 +138,12 @@ class Security_test extends CI_TestCase { public function test_remove_evil_attributes() { - $this->assertEquals('<foo [removed]>', $this->security->remove_evil_attributes('<foo onAttribute="bar">', false)); - $this->assertEquals('<foo [removed]>', $this->security->remove_evil_attributes('<foo onAttributeNoQuotes=bar>', false)); - $this->assertEquals('<foo [removed]>', $this->security->remove_evil_attributes('<foo onAttributeWithSpaces = bar>', false)); - $this->assertEquals('<foo prefixOnAttribute="bar">', $this->security->remove_evil_attributes('<foo prefixOnAttribute="bar">', false)); - $this->assertEquals('<foo>onOutsideOfTag=test</foo>', $this->security->remove_evil_attributes('<foo>onOutsideOfTag=test</foo>', false)); - $this->assertEquals('onNoTagAtAll = true', $this->security->remove_evil_attributes('onNoTagAtAll = true', false)); + $this->assertEquals('<foo [removed]>', $this->security->remove_evil_attributes('<foo onAttribute="bar">', FALSE)); + $this->assertEquals('<foo [removed]>', $this->security->remove_evil_attributes('<foo onAttributeNoQuotes=bar>', FALSE)); + $this->assertEquals('<foo [removed]>', $this->security->remove_evil_attributes('<foo onAttributeWithSpaces = bar>', FALSE)); + $this->assertEquals('<foo prefixOnAttribute="bar">', $this->security->remove_evil_attributes('<foo prefixOnAttribute="bar">', FALSE)); + $this->assertEquals('<foo>onOutsideOfTag=test</foo>', $this->security->remove_evil_attributes('<foo>onOutsideOfTag=test</foo>', FALSE)); + $this->assertEquals('onNoTagAtAll = true', $this->security->remove_evil_attributes('onNoTagAtAll = true', FALSE)); } // -------------------------------------------------------------------- @@ -199,7 +199,7 @@ class Security_test extends CI_TestCase { public function test_strip_image_tags() { - $imgtags = Array( + $imgtags = array( '<img src="smiley.gif" alt="Smiley face" height="42" width="42">', '<img alt="Smiley face" height="42" width="42" src="smiley.gif">', '<img src="http://www.w3schools.com/images/w3schools_green.jpg">', @@ -210,7 +210,7 @@ class Security_test extends CI_TestCase { '<img srcq="/img/sunset.gif" height="100%" width="100%">' ); - $urls = Array( + $urls = array( 'smiley.gif', 'smiley.gif', 'http://www.w3schools.com/images/w3schools_green.jpg', @@ -221,7 +221,7 @@ class Security_test extends CI_TestCase { '<img srcq="/img/sunset.gif" height="100%" width="100%">' ); - for($i = 0; $i < count($imgtags); $i++) + for ($i = 0; $i < count($imgtags); $i++) { $this->assertEquals($urls[$i], $this->security->strip_image_tags($imgtags[$i])); } @@ -245,4 +245,4 @@ class Security_test extends CI_TestCase { $this->assertNotEmpty($this->security->get_csrf_hash()); } -}
\ No newline at end of file +} |