mirror of
https://github.com/elyby/accounts.git
synced 2025-05-31 14:11:46 +05:30
Fixes #27. Serialize empty textures as an object
This commit is contained in:
@@ -36,6 +36,10 @@ return [
|
||||
}
|
||||
|
||||
public function profile(string $username, bool $signed = false): ?array {
|
||||
if ($username === 'NotSynchronized') {
|
||||
return null;
|
||||
}
|
||||
|
||||
$account = common\models\Account::findOne(['username' => $username]);
|
||||
$uuid = $account ? str_replace('-', '', $account->uuid) : '00000000000000000000000000000000';
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace api\tests\functional\sessionserver;
|
||||
|
||||
use api\tests\_pages\SessionServerRoute;
|
||||
@@ -34,6 +36,20 @@ class ProfileCest {
|
||||
$I->canSeeValidTexturesResponse('Admin', 'df936908b2e1544d96f82977ec213022', true);
|
||||
}
|
||||
|
||||
public function getProfileWhichIsNotSynchronized(SessionServerSteps $I) {
|
||||
$I->wantTo('get info about player textures by uuid');
|
||||
$this->route->profile('7ff4a9dcd1774ea0ab567f31218004f9', true);
|
||||
|
||||
// Ensure that empty textures was serialized as an empty object
|
||||
$I->seeResponseIsJson();
|
||||
$I->canSeeResponseContainsJson([
|
||||
'id' => '7ff4a9dcd1774ea0ab567f31218004f9',
|
||||
]);
|
||||
$texturesValue = $I->grabDataFromResponseByJsonPath('$.properties[0].value')[0];
|
||||
$texturesJson = base64_decode($texturesValue);
|
||||
$I->assertStringContainsString('"textures":{}', $texturesJson);
|
||||
}
|
||||
|
||||
public function directCallWithoutUuidPart(FunctionalTester $I) {
|
||||
$I->wantTo('call profile route without passing uuid');
|
||||
$this->route->profile('');
|
||||
|
||||
Reference in New Issue
Block a user