Skip to content

Commit

Permalink
Add test for rest controller with GET array
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjis committed Nov 15, 2015
1 parent 1a33312 commit 308a47b
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions application/tests/controllers/api/Rest_test_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 308a47b

Please sign in to comment.