From d1d3e69e90ecdfa9ebe1a766198438815b30eee6 Mon Sep 17 00:00:00 2001 From: George Petculescu Date: Mon, 31 May 2021 13:32:13 +0300 Subject: other test fixes --- tests/codeigniter/core/Input_test.php | 14 +++++++++++--- tests/codeigniter/database/query_builder/select_test.php | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/tests/codeigniter/core/Input_test.php b/tests/codeigniter/core/Input_test.php index 07a99e136..93d1b7118 100644 --- a/tests/codeigniter/core/Input_test.php +++ b/tests/codeigniter/core/Input_test.php @@ -18,6 +18,14 @@ class Input_test extends CI_TestCase { // -------------------------------------------------------------------- + public function tear_down() + { + $_POST = []; + $_GET = []; + } + + // -------------------------------------------------------------------- + public function test_get_not_exists() { $this->assertSame(array(), $this->input->get()); @@ -93,7 +101,7 @@ class Input_test extends CI_TestCase { public function test_post_get_array_notation() { $_SERVER['REQUEST_METHOD'] = 'POST'; - $_POST['foo']['bar'] = 'baz'; + $_POST['foo'] = array('bar' => 'baz'); $barArray = array('bar' => 'baz'); $this->assertEquals('baz', $this->input->get_post('foo[bar]')); @@ -120,7 +128,7 @@ class Input_test extends CI_TestCase { public function test_get_post_array_notation() { $_SERVER['REQUEST_METHOD'] = 'GET'; - $_GET['foo']['bar'] = 'baz'; + $_GET['foo'] = array('bar' => 'baz'); $barArray = array('bar' => 'baz'); $this->assertEquals('baz', $this->input->get_post('foo[bar]')); @@ -169,7 +177,7 @@ class Input_test extends CI_TestCase { $this->assertEquals("Hello, i try to [removed]alert('Hack');[removed] your site", $harmless); $_SERVER['REQUEST_METHOD'] = 'POST'; - $_POST['foo']['bar'] = 'baz'; + $_POST['foo'] = array('bar' => 'baz'); $barArray = array('bar' => 'baz'); $this->assertEquals('baz', $this->input->post('foo[bar]')); diff --git a/tests/codeigniter/database/query_builder/select_test.php b/tests/codeigniter/database/query_builder/select_test.php index 93b5c3d46..facda791f 100644 --- a/tests/codeigniter/database/query_builder/select_test.php +++ b/tests/codeigniter/database/query_builder/select_test.php @@ -74,7 +74,7 @@ class Select_test extends CI_TestCase { ->row(); // Average should be 2.5 - $this->assertEquals('2.5', $job_avg->id); + $this->assertEquals(2.5, (float) $job_avg->id); } // ------------------------------------------------------------------------ -- cgit v1.2.3-24-g4f1b