From d262e577a6fb494d1e4f58aff2cab7478e3170d7 Mon Sep 17 00:00:00 2001 From: ErickSkrauch Date: Mon, 13 Feb 2017 13:44:14 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=BE=20=D0=BF=D0=BE=D0=B2=D0=B5=D0=B4=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20hasJoined=20=D0=BE=D0=BF=D0=B5=D1=80=D0=B0=D1=86?= =?UTF-8?q?=D0=B8=D0=B8=20=D0=B4=D0=BB=D1=8F=20legacy=20=D0=BF=D1=80=D0=BE?= =?UTF-8?q?=D1=82=D0=BE=D0=BA=D0=BE=D0=BB=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/modules/session/controllers/SessionController.php | 9 +++------ .../api/functional/sessionserver/HasJoinedLegacyCest.php | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/api/modules/session/controllers/SessionController.php b/api/modules/session/controllers/SessionController.php index f120ba8..384d2f6 100644 --- a/api/modules/session/controllers/SessionController.php +++ b/api/modules/session/controllers/SessionController.php @@ -89,15 +89,12 @@ class SessionController extends ApiController { $hasJoinedForm = new HasJoinedForm($protocol); try { $hasJoinedForm->hasJoined(); + } catch (ForbiddenOperationException $e) { + return 'NO'; } catch (SessionServerException $e) { Yii::$app->response->statusCode = $e->statusCode; - if ($e instanceof ForbiddenOperationException) { - $message = 'NO'; - } else { - $message = $e->getMessage(); - } - return $message; + return $e->getMessage(); } return 'YES'; diff --git a/tests/codeception/api/functional/sessionserver/HasJoinedLegacyCest.php b/tests/codeception/api/functional/sessionserver/HasJoinedLegacyCest.php index b0133ac..8c2e07f 100644 --- a/tests/codeception/api/functional/sessionserver/HasJoinedLegacyCest.php +++ b/tests/codeception/api/functional/sessionserver/HasJoinedLegacyCest.php @@ -44,7 +44,7 @@ class HasJoinedLegacyCest { 'user' => 'random-username', 'serverId' => Uuid::uuid(), ]); - $I->seeResponseCodeIs(401); + $I->seeResponseCodeIs(200); $I->canSeeResponseEquals('NO'); }