diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 6afd34397d..747ef12961 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -15,6 +15,7 @@ ->in(__DIR__) ->exclude([ 'src/Core/Bridge/Symfony/Maker/Resources/skeleton', + 'src/Laravel/config', 'tests/Fixtures/app/var', 'docs/guides', 'docs/var', diff --git a/src/Laravel/Tests/JsonApiTest.php b/src/Laravel/Tests/JsonApiTest.php index 3b0075f478..3d062880b5 100644 --- a/src/Laravel/Tests/JsonApiTest.php +++ b/src/Laravel/Tests/JsonApiTest.php @@ -14,6 +14,8 @@ namespace ApiPlatform\Laravel\Tests; use ApiPlatform\Laravel\Test\ApiTestAssertionsTrait; +use Illuminate\Contracts\Config\Repository; +use Illuminate\Foundation\Application; use Illuminate\Foundation\Testing\RefreshDatabase; use Orchestra\Testbench\Concerns\WithWorkbench; use Orchestra\Testbench\TestCase; @@ -26,6 +28,16 @@ class JsonApiTest extends TestCase use RefreshDatabase; use WithWorkbench; + /** + * @param Application $app + */ + protected function defineEnvironment($app): void + { + tap($app['config'], function (Repository $config): void { + $config->set('api-platform.formats', ['jsonapi' => ['application/vnd.api+json']]); + }); + } + public function testGetCollection(): void { $response = $this->get('/api/books', ['accept' => ['application/vnd.api+json']]); diff --git a/src/Laravel/config/api-platform.php b/src/Laravel/config/api-platform.php index b8c77110a3..779039c810 100644 --- a/src/Laravel/config/api-platform.php +++ b/src/Laravel/config/api-platform.php @@ -1,16 +1,5 @@ - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -declare(strict_types=1); - return [ 'title' => 'API Platform', 'description' => 'My awesome API', @@ -31,7 +20,7 @@ 'formats' => [ 'jsonld' => ['application/ld+json'], - 'jsonapi' => ['application/vnd.api+json'], + //'jsonapi' => ['application/vnd.api+json'], ], 'patch_formats' => [ @@ -39,9 +28,9 @@ ], 'docs_formats' => [ - 'jsonopenapi' => ['application/vnd.openapi+json'], - 'json' => ['application/json'], 'jsonld' => ['application/ld+json'], + //'jsonapi' => ['application/vnd.api+json'], + 'jsonopenapi' => ['application/vnd.openapi+json'], 'html' => ['text/html'], ],