mirror of
https://github.com/elyby/accounts.git
synced 2024-12-25 14:49:46 +05:30
57d492da8a
* start updating to PHP 8.3
* taking off!
Co-authored-by: ErickSkrauch <erickskrauch@yandex.ru>
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
* dropped this
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
* migrate to symfonymailer
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
* this is so stupid 😭
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
* ah, free, at last.
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
* oh, Gabriel.
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
* now dawns thy reckoning.
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
* and thy gore shall GLISTEN before the temples of man.
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
* creature of steel.
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
* my gratitude upon thee for my freedom.
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
* but the crimes thy kind has committed against humanity
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
* Upgrade PHP-CS-Fixer and do fix the codebase
* First review round (maybe I have broken something)
* are NOT forgotten.
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
* Enable parallel PHP-CS-Fixer runner
* PHPStan level 1
* PHPStan level 2
* PHPStan level 3
* PHPStan level 4
* PHPStan level 5
* Levels 6 and 7 takes too much effort. Generate a baseline and fix them eventually
* Resolve TODO's related to the php-mock
* Drastically reduce baseline size with the Rector
* More code modernization with help of the Rector
* Update GitLab CI
---------
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
Co-authored-by: ErickSkrauch <erickskrauch@yandex.ru>
80 lines
2.7 KiB
PHP
80 lines
2.7 KiB
PHP
<?php
|
|
namespace api\tests\functional\_steps;
|
|
|
|
use api\rbac\Permissions as P;
|
|
use api\tests\_pages\SessionServerRoute;
|
|
use api\tests\FunctionalTester;
|
|
use function Ramsey\Uuid\v4 as uuid;
|
|
|
|
class SessionServerSteps extends FunctionalTester {
|
|
|
|
public function amJoined($byLegacy = false): array {
|
|
$oauthSteps = new OauthSteps($this->scenario);
|
|
$accessToken = $oauthSteps->getAccessToken([P::MINECRAFT_SERVER_SESSION]);
|
|
$route = new SessionServerRoute($this);
|
|
$serverId = uuid();
|
|
$username = 'Admin';
|
|
|
|
if ($byLegacy) {
|
|
$route->joinLegacy([
|
|
'sessionId' => 'token:' . $accessToken . ':df936908-b2e1-544d-96f8-2977ec213022',
|
|
'user' => $username,
|
|
'serverId' => $serverId,
|
|
]);
|
|
|
|
$this->seeResponseCodeIs(200);
|
|
$this->canSeeResponseEquals('OK');
|
|
} else {
|
|
$route->join([
|
|
'accessToken' => $accessToken,
|
|
'selectedProfile' => 'df936908-b2e1-544d-96f8-2977ec213022',
|
|
'serverId' => $serverId,
|
|
]);
|
|
|
|
$this->seeResponseCodeIs(204);
|
|
$this->canSeeResponseEquals('');
|
|
}
|
|
|
|
return [$username, $serverId];
|
|
}
|
|
|
|
public function canSeeValidTexturesResponse(
|
|
string $expectedUsername,
|
|
string $expectedUuid,
|
|
bool $shouldBeSigned = false,
|
|
): void {
|
|
$this->seeResponseIsJson();
|
|
$this->canSeeResponseContainsJson([
|
|
'name' => $expectedUsername,
|
|
'id' => $expectedUuid,
|
|
'properties' => [
|
|
[
|
|
'name' => 'textures',
|
|
],
|
|
[
|
|
'name' => 'ely',
|
|
'value' => 'but why are you asking?',
|
|
],
|
|
],
|
|
]);
|
|
if ($shouldBeSigned) {
|
|
$this->canSeeResponseJsonMatchesJsonPath('$.properties[?(@.name == "textures")].signature');
|
|
} else {
|
|
$this->cantSeeResponseJsonMatchesJsonPath('$.properties[?(@.name == "textures")].signature');
|
|
}
|
|
|
|
$this->canSeeResponseJsonMatchesJsonPath('$.properties[0].value');
|
|
$value = $this->grabDataFromResponseByJsonPath('$.properties[0].value')[0];
|
|
$decoded = json_decode(base64_decode((string)$value), true);
|
|
$this->assertArrayHasKey('timestamp', $decoded);
|
|
$this->assertArrayHasKey('textures', $decoded);
|
|
$this->assertSame($expectedUuid, $decoded['profileId']);
|
|
$this->assertSame($expectedUsername, $decoded['profileName']);
|
|
$textures = $decoded['textures'];
|
|
$this->assertArrayHasKey('SKIN', $textures);
|
|
$skinTextures = $textures['SKIN'];
|
|
$this->assertArrayHasKey('url', $skinTextures);
|
|
}
|
|
|
|
}
|