2016-09-06 15:26:39 +05:30
|
|
|
<?php
|
2019-02-21 01:28:52 +05:30
|
|
|
namespace api\tests\functional\sessionserver;
|
2016-09-06 15:26:39 +05:30
|
|
|
|
2019-02-21 01:28:52 +05:30
|
|
|
use api\tests\_pages\SessionServerRoute;
|
|
|
|
use api\tests\functional\_steps\SessionServerSteps;
|
|
|
|
use api\tests\FunctionalTester;
|
2019-12-21 04:56:06 +05:30
|
|
|
use function Ramsey\Uuid\v4 as uuid;
|
2016-09-06 15:26:39 +05:30
|
|
|
|
|
|
|
class HasJoinedLegacyCest {
|
|
|
|
|
2024-12-02 15:40:55 +05:30
|
|
|
private SessionServerRoute $route;
|
2016-09-06 15:26:39 +05:30
|
|
|
|
2024-12-02 15:40:55 +05:30
|
|
|
public function _before(FunctionalTester $I): void {
|
2016-09-06 15:26:39 +05:30
|
|
|
$this->route = new SessionServerRoute($I);
|
|
|
|
}
|
|
|
|
|
2024-12-02 15:40:55 +05:30
|
|
|
public function hasJoined(SessionServerSteps $I): void {
|
2016-09-06 15:26:39 +05:30
|
|
|
$I->wantTo('test hasJoined user to some server by legacy version');
|
2019-02-26 04:56:02 +05:30
|
|
|
[$username, $serverId] = $I->amJoined(true);
|
2016-09-06 15:26:39 +05:30
|
|
|
|
|
|
|
$this->route->hasJoinedLegacy([
|
|
|
|
'user' => $username,
|
|
|
|
'serverId' => $serverId,
|
|
|
|
]);
|
|
|
|
$I->seeResponseCodeIs(200);
|
|
|
|
$I->canSeeResponseEquals('YES');
|
|
|
|
}
|
|
|
|
|
2024-12-02 15:40:55 +05:30
|
|
|
public function wrongArguments(FunctionalTester $I): void {
|
2016-09-06 15:26:39 +05:30
|
|
|
$I->wantTo('get error on wrong amount of arguments');
|
|
|
|
$this->route->hasJoinedLegacy([
|
|
|
|
'wrong' => 'argument',
|
|
|
|
]);
|
|
|
|
$I->canSeeResponseCodeIs(400);
|
|
|
|
$I->canSeeResponseEquals('credentials can not be null.');
|
|
|
|
}
|
|
|
|
|
2024-12-02 15:40:55 +05:30
|
|
|
public function hasJoinedWithNoJoinOperation(FunctionalTester $I): void {
|
2016-09-06 15:26:39 +05:30
|
|
|
$I->wantTo('hasJoined by legacy version to some server without join call');
|
|
|
|
$this->route->hasJoinedLegacy([
|
|
|
|
'user' => 'random-username',
|
2019-12-21 04:56:06 +05:30
|
|
|
'serverId' => uuid(),
|
2016-09-06 15:26:39 +05:30
|
|
|
]);
|
2017-02-13 16:14:14 +05:30
|
|
|
$I->seeResponseCodeIs(200);
|
2016-09-06 15:26:39 +05:30
|
|
|
$I->canSeeResponseEquals('NO');
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|