client resources: server data

This commit is contained in:
robert dennis
2026-10-12 05:18:58 -04:00
parent fa117372fb
commit 2705126612
21 changed files with 239 additions and 497 deletions
@@ -10,18 +10,14 @@ use Pterodactyl\Tests\TestCase;
use Pterodactyl\Transformers\Api\Admin\UserTransformer as AdminUserTransformer;
use Pterodactyl\Transformers\Api\Application\BaseTransformer;
use Pterodactyl\Transformers\Api\Application\UserTransformer;
use Pterodactyl\Transformers\Api\Client\BackupTransformer;
uses(TestCase::class);
test('the Application API refuses admin and client transformers', function (string $transformer): void {
test('the Application API refuses admin transformers, which return every extension field', function (): void {
$controller = new class extends ApplicationApiController {};
expect(fn (): BaseTransformer => $controller->getTransformer($transformer))->toThrow(InvalidArgumentException::class, 'does not belong to the Application API');
})->with([
'admin, which returns every extension field' => [AdminUserTransformer::class],
'client' => [BackupTransformer::class],
]);
expect(fn (): BaseTransformer => $controller->getTransformer(AdminUserTransformer::class))->toThrow(InvalidArgumentException::class, 'does not belong to the Application API');
});
test('the Application API resolves its own transformers', function (): void {
$controller = new class extends ApplicationApiController {};