2026-10-09 06:26:45 +01:00
<? php
declare ( strict_types = 1 );
namespace Pterodactyl\Tests\Pest\Unit\Http\ApplicationApiControllerTest ;
use InvalidArgumentException ;
use Pterodactyl\Http\Controllers\Api\Application\ApplicationApiController ;
use Pterodactyl\Tests\TestCase ;
use Pterodactyl\Transformers\Api\Admin\UserTransformer as AdminUserTransformer ;
use Pterodactyl\Transformers\Api\Application\BaseTransformer ;
use Pterodactyl\Transformers\Api\Application\UserTransformer ;
uses ( TestCase :: class );
2026-10-11 21:15:38 -04:00
test ( 'the Application API refuses admin transformers, which return every extension field' , function () : void {
2026-10-09 06:26:45 +01:00
$controller = new class extends ApplicationApiController {};
2026-10-11 21:15:38 -04:00
expect ( fn () : BaseTransformer => $controller -> getTransformer ( AdminUserTransformer :: class )) -> toThrow ( InvalidArgumentException :: class , 'does not belong to the Application API' );
});
2026-10-09 06:26:45 +01:00
test ( 'the Application API resolves its own transformers' , function () : void {
$controller = new class extends ApplicationApiController {};
expect ( $controller -> getTransformer ( UserTransformer :: class )) -> toBeInstanceOf ( UserTransformer :: class );
});