From 9d9da8e1e0191f5f3510f262fd7c0a404ef1811a Mon Sep 17 00:00:00 2001 From: Mauricio Pineda Date: Tue, 22 Aug 2017 16:10:58 -0300 Subject: [PATCH] Updated PHPUnitTest for Database Exception --- tests/phpunit/DatabaseErrorsTest.php | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/tests/phpunit/DatabaseErrorsTest.php b/tests/phpunit/DatabaseErrorsTest.php index 6157b88..16ab091 100644 --- a/tests/phpunit/DatabaseErrorsTest.php +++ b/tests/phpunit/DatabaseErrorsTest.php @@ -90,17 +90,12 @@ protected function login() return $jsonResponse; } + /** + * @expectedException GuzzleHttp\Exception\ServerException + */ public function testInvalidDatabase() { - try { $loginResponse = $this->login(); - } catch (\GuzzleHttp\Exception\BadResponseException $e) { - $jsonResponse = $this->getJsonResponse($e->getResponse()); - $this->assertEquals($jsonResponse->status, 500); - $this->assertEquals($jsonResponse->body->success, false); - $this->assertEquals($jsonResponse->body->error_code, 0); - $this->assertContains('_invalid_database_', $jsonResponse->body->error_message); - } } protected function getPhpsessid($setCookie)