From fe5099a695c25e503a0aff6124644b9011a27e0d Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 18 Mar 2015 12:35:47 +0200 Subject: Polish some recent changes in test cases --- tests/codeigniter/core/Input_test.php | 10 ++++------ tests/codeigniter/core/Security_test.php | 20 ++++++++++---------- 2 files changed, 14 insertions(+), 16 deletions(-) (limited to 'tests/codeigniter/core') 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 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('', $this->security->remove_evil_attributes('', false)); - $this->assertEquals('', $this->security->remove_evil_attributes('', false)); - $this->assertEquals('', $this->security->remove_evil_attributes('', false)); - $this->assertEquals('', $this->security->remove_evil_attributes('', false)); - $this->assertEquals('onOutsideOfTag=test', $this->security->remove_evil_attributes('onOutsideOfTag=test', false)); - $this->assertEquals('onNoTagAtAll = true', $this->security->remove_evil_attributes('onNoTagAtAll = true', false)); + $this->assertEquals('', $this->security->remove_evil_attributes('', FALSE)); + $this->assertEquals('', $this->security->remove_evil_attributes('', FALSE)); + $this->assertEquals('', $this->security->remove_evil_attributes('', FALSE)); + $this->assertEquals('', $this->security->remove_evil_attributes('', FALSE)); + $this->assertEquals('onOutsideOfTag=test', $this->security->remove_evil_attributes('onOutsideOfTag=test', 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( 'Smiley face', 'Smiley face', '', @@ -210,7 +210,7 @@ class Security_test extends CI_TestCase { '' ); - $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 { '' ); - 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 +} -- cgit v1.2.3-24-g4f1b