From 308a47b123cc571d04a31fb250d064d5ad2c5756 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sun, 15 Nov 2015 19:35:33 +0900 Subject: [PATCH] Add test for rest controller with GET array --- .../tests/controllers/api/Rest_test_test.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/application/tests/controllers/api/Rest_test_test.php b/application/tests/controllers/api/Rest_test_test.php index f485804..d7f92e6 100644 --- a/application/tests/controllers/api/Rest_test_test.php +++ b/application/tests/controllers/api/Rest_test_test.php @@ -26,6 +26,24 @@ public function test_index_get() $this->assertResponseCode(200); } + public function test_index_get_with_get_array() + { + try { + $output = $this->request( + 'GET', 'api/rest_test', + ['name' => 'John O\'reilly', 'city' => 'Tokyo'] + ); + } catch (CIPHPUnitTestExitException $e) { + $output = ob_get_clean(); + } + + $expected = <<< 'EOL' +{"get":{"name":"John O'reilly","city":"Tokyo"},"query":{"name":"John O'reilly","city":"Tokyo"}} +EOL; + $this->assertEquals($expected, $output); + $this->assertResponseCode(200); + } + public function test_index_post() { set_is_cli(FALSE);