. */ declare(strict_types=1); namespace App\Tests\API; use ApiPlatform\Symfony\Bundle\Test\ApiTestCase; use ApiPlatform\Symfony\Bundle\Test\Client; use App\DataFixtures\APITokenFixtures; abstract class AuthenticatedApiTestCase extends ApiTestCase { /** * Creates an API client with authentication. * @param string $token * @return Client */ protected static function createAuthenticatedClient(string $token = APITokenFixtures::TOKEN_ADMIN): Client { return static::createClient(defaultOptions: ['headers' => ['authorization' => 'Token '.$token]]); } }