2016-09-21 13:43:43 +05:30
|
|
|
<?php
|
2024-12-02 15:40:55 +05:30
|
|
|
namespace api\tests\functional\mojang;
|
2016-09-21 13:43:43 +05:30
|
|
|
|
2019-02-21 01:28:52 +05:30
|
|
|
use api\tests\_pages\MojangApiRoute;
|
|
|
|
use api\tests\FunctionalTester;
|
2019-12-21 04:56:06 +05:30
|
|
|
use function Ramsey\Uuid\v4 as uuid;
|
2016-09-21 13:43:43 +05:30
|
|
|
|
|
|
|
class UuidToUsernamesHistoryCest {
|
|
|
|
|
2024-12-02 15:40:55 +05:30
|
|
|
private MojangApiRoute $route;
|
2016-09-21 13:43:43 +05:30
|
|
|
|
2024-12-02 15:40:55 +05:30
|
|
|
public function _before(FunctionalTester $I): void {
|
2016-09-21 13:43:43 +05:30
|
|
|
$this->route = new MojangApiRoute($I);
|
|
|
|
}
|
|
|
|
|
2024-12-02 15:40:55 +05:30
|
|
|
public function getUsernameByUuid(FunctionalTester $I): void {
|
2016-09-21 13:43:43 +05:30
|
|
|
$I->wantTo('get usernames history by uuid for user, without history');
|
|
|
|
$this->route->usernamesByUuid('df936908b2e1544d96f82977ec213022');
|
|
|
|
$I->canSeeResponseCodeIs(200);
|
|
|
|
$I->canSeeResponseIsJson();
|
|
|
|
$I->canSeeResponseContainsJson([
|
|
|
|
[
|
|
|
|
'name' => 'Admin',
|
|
|
|
],
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
2024-12-02 15:40:55 +05:30
|
|
|
public function getUsernameByUuidWithHistory(FunctionalTester $I): void {
|
2016-09-21 13:43:43 +05:30
|
|
|
$I->wantTo('get usernames history by dashed uuid and expect history with time marks');
|
|
|
|
$this->route->usernamesByUuid('d6b3e935-6466-4cb8-86db-b5df91ae6541');
|
|
|
|
$I->canSeeResponseCodeIs(200);
|
|
|
|
$I->canSeeResponseIsJson();
|
|
|
|
$I->canSeeResponseContainsJson([
|
|
|
|
[
|
|
|
|
'name' => 'klik202',
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'name' => 'klik201',
|
|
|
|
'changedToAt' => 1474404141000,
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'name' => 'klik202',
|
|
|
|
'changedToAt' => 1474404143000,
|
|
|
|
],
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
2024-12-02 15:40:55 +05:30
|
|
|
public function passWrongUuid(FunctionalTester $I): void {
|
2016-09-21 13:43:43 +05:30
|
|
|
$I->wantTo('get user username by some wrong uuid');
|
2019-12-21 04:56:06 +05:30
|
|
|
$this->route->usernamesByUuid(uuid());
|
2016-09-21 13:43:43 +05:30
|
|
|
$I->canSeeResponseCodeIs(204);
|
|
|
|
$I->canSeeResponseEquals('');
|
|
|
|
}
|
|
|
|
|
2024-12-02 15:40:55 +05:30
|
|
|
public function passUuidOfDeletedAccount(FunctionalTester $I): void {
|
2020-06-12 02:57:02 +05:30
|
|
|
$I->wantTo('get username by passing uuid of the account marked for deleting');
|
|
|
|
$this->route->usernamesByUuid('6383de63-8f85-4ed5-92b7-5401a1fa68cd');
|
|
|
|
$I->canSeeResponseCodeIs(204);
|
|
|
|
$I->canSeeResponseEquals('');
|
|
|
|
}
|
|
|
|
|
2024-12-02 15:40:55 +05:30
|
|
|
public function passWrongUuidFormat(FunctionalTester $I): void {
|
2016-09-21 13:43:43 +05:30
|
|
|
$I->wantTo('call profile route with invalid uuid string');
|
|
|
|
$this->route->usernamesByUuid('bla-bla-bla');
|
|
|
|
$I->canSeeResponseCodeIs(400);
|
|
|
|
$I->canSeeResponseIsJson();
|
|
|
|
$I->canSeeResponseContainsJson([
|
|
|
|
'error' => 'IllegalArgumentException',
|
|
|
|
'errorMessage' => 'Invalid uuid format.',
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|