From b09450cf5d864338b5fbc246fd722f841b32e254 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Tue, 19 Jan 2010 23:30:22 -0800 Subject: Let the Rest_Controller functions throw a Rest_Exception since the Kohana framework will handle it properly. --- modules/rest/tests/Rest_Controller_Test.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'modules/rest/tests/Rest_Controller_Test.php') diff --git a/modules/rest/tests/Rest_Controller_Test.php b/modules/rest/tests/Rest_Controller_Test.php index ae5e6d48..e0663252 100644 --- a/modules/rest/tests/Rest_Controller_Test.php +++ b/modules/rest/tests/Rest_Controller_Test.php @@ -46,11 +46,17 @@ class Rest_Controller_Test extends Gallery_Unit_Test_Case { public function login_failed_test() { $user = test::random_user("password"); - $_POST["user"] = $user->name; - $_POST["password"] = "WRONG PASSWORD"; - // @todo check the http response code - $this->assert_equal(null, test::call_and_capture(array(new Rest_Controller(), "index"))); + try { + $_POST["user"] = $user->name; + $_POST["password"] = "WRONG PASSWORD"; + test::call_and_capture(array(new Rest_Controller(), "index")); + } catch (Rest_Exception $e) { + $this->assert_equal(403, $e->getCode()); + return; + } + + $this->assert_true(false, "Shouldn't get here"); } public function rest_get_resource_no_request_key_test_() { -- cgit v1.2.3