From aed50a8698bd3efe698771abbbf7331e5f1e8aad Mon Sep 17 00:00:00 2001 From: Laravel Shift Date: Tue, 12 Mar 2024 21:31:10 -0400 Subject: [PATCH] Laravel 11.x Compatibility (#49) * Bump dependencies for Laravel 11 * Update GitHub Actions for Laravel 11 * Allow PHP 8.3 * Bump collections * formatting * formatting * formatting * Fix tests * Update upgrade guide * Linting * Fix build * Fix version constraint * Fix compatibility issue * Fix migrations * Fix conflict * lint --------- Co-authored-by: Tim MacDonald --- .github/workflows/main.yml | 255 ++++++++++--------- UPGRADE.md | 27 ++ composer.json | 18 +- src/Concerns/Implementation.php | 4 +- src/JsonApiResource.php | 7 +- src/JsonApiResourceCollection.php | 5 +- tests/Feature/AttributesTest.php | 33 --- tests/Feature/FeatureTest.php | 16 +- tests/Feature/JsonApiTest.php | 18 -- tests/Feature/RelationshipsTest.php | 63 ----- tests/Feature/ResourceIdentificationTest.php | 6 - tests/TestCase.php | 2 - 12 files changed, 185 insertions(+), 269 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index dfe5ccd..4d8f70e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,128 +1,137 @@ name: CI on: - push: - branches: [ main ] - pull_request: - branches: [ main ] + push: + branches: + - main + pull_request: + branches: + - main jobs: - lint: - runs-on: ubuntu-latest - name: 'Lint' - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Get composer cache directory - id: composer-cache - run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - - - name: Cache dependencies - uses: actions/cache@v3 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} - restore-keys: ${{ runner.os }}-composer- - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: '8.1' - coverage: pcov - - - name: Install dependencies - run: composer update - - - name: Check platform requirements - run: composer check-platform-reqs - - - name: PHP-CS-Fixer - run: composer fix -- --dry-run - - # - name: composer normalize - # run: composer normalize --dry-run --no-interaction --verbose - - # - name: test coverage - # run: | - # ./vendor/bin/phpunit --coverage-clover=coverage.xml --debug --verbose - # bash <(curl -s https://codecov.io/bash) - # env: - # CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - - # - name: Infection - # run: ./vendor/bin/infection --show-mutations --min-covered-msi=100 --no-progress --no-interaction --verbose - # env: - # INFECTION_BADGE_API_KEY: ${{ secrets.INFECTION_BADGE_API_KEY }} - - # - name: Psalm - # run: ./vendor/bin/psalm --shepherd --no-progress - - # - name: PHPStan - # run: ./vendor/bin/phpstan --no-interaction --verbose - # - # composer-require-checker - # composer-unused - - tests: - runs-on: ubuntu-latest - name: 'PHP: ${{ matrix.php }}; Laravel: ${{ matrix.laravel }}; Prefer: ${{ matrix.prefer }}' - strategy: - matrix: - php: ['8.1', '8.2'] - laravel: ['^9.0', '^10.0'] - prefer: ['prefer-lowest', 'prefer-stable'] - include: - - testbench: '^7.0' - laravel: '^9.0' - - testbench: '^8.0' - laravel: '^10.0' - - steps: - - name: checkout code - uses: actions/checkout@v3 - - - name: Get composer cache directory - id: composer-cache - run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - - - name: Cache dependencies - uses: actions/cache@v3 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-php-${{ matrix.php }}-laravel-${{ matrix.laravel }}-prefer-${{ matrix.prefer }}-composer-${{ hashFiles('**/composer.json') }} - restore-keys: ${{ runner.os }}-php-${{ matrix.php }}-laravel-{{ matrix.laravel }}-prefer-${{ matrix.prefer}}-composer- - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - coverage: none - - - name: Remove dev packages - run: | - composer remove --dev --no-update \ - friendsofphp/php-cs-fixer \ - infection/infection \ - nunomaduro/larastan \ - phpstan/phpstan-strict-rules - - - name: Require Laravel and Testbench version - run: composer require --no-update laravel/framework:"${{ matrix.laravel }}" illuminate/collections:"${{ matrix.laravel }}" illuminate/database:"${{ matrix.laravel }}" illuminate/http:"${{ matrix.laravel }}" illuminate/support:"${{ matrix.laravel }}" orchestra/testbench:"${{ matrix.testbench }}" - - - name: Support prefer-lowest in PHP 8.1 - if: ${{ matrix.php == 8.1 && matrix.prefer == 'prefer-lowest' }} - run: composer require --no-update nesbot/carbon:"^2.62.1" - - - name: Support prefer-lowest in PHP 8.2 - if: ${{ matrix.php == 8.2 && matrix.prefer == 'prefer-lowest' }} - run: composer require --no-update nesbot/carbon:"^2.62.1" - - - name: Install dependencies - run: composer update --${{ matrix.prefer }} - - - name: Check platform requirements - run: composer check-platform-reqs --verbose - - - name: Run tests - run: composer test + lint: + runs-on: ubuntu-latest + name: Lint + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Get composer cache directory + id: composer-cache + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + + - name: Cache dependencies + uses: actions/cache@v3 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: ${{ runner.os }}-composer- + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.1' + coverage: pcov + + - name: Install dependencies + run: composer update + + - name: Check platform requirements + run: composer check-platform-reqs + + - name: PHP-CS-Fixer + run: composer fix -- --dry-run + + # - name: composer normalize + # run: composer normalize --dry-run --no-interaction --verbose + + # - name: test coverage + # run: "./vendor/bin/phpunit --coverage-clover=coverage.xml --debug --verbose && bash <(curl -s https://codecov.io/bash)" + # env: + # CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + + # - name: Infection + # run: "./vendor/bin/infection --show-mutations --min-covered-msi=100 --no-progress --no-interaction --verbose" + # env: + # INFECTION_BADGE_API_KEY: ${{ secrets.INFECTION_BADGE_API_KEY }} + + # - name: Psalm + # run: ./vendor/bin/psalm --shepherd --no-progress + + # - name: PHPStan + # run: ./vendor/bin/phpstan --no-interaction --verbose + + # composer-require-checker + # composer-unused + + tests: + runs-on: ubuntu-latest + name: "PHP: ${{ matrix.php }}; Laravel: ${{ matrix.laravel }}; Prefer: ${{ matrix.prefer }}" + strategy: + matrix: + php: ['8.1', '8.2', '8.3'] + laravel: [^9.0, ^10.0, ^11.0] + prefer: [prefer-lowest, prefer-stable] + include: + - testbench: ^7.0 + laravel: ^9.0 + - testbench: ^8.0 + laravel: ^10.0 + - testbench: ^9.0 + laravel: ^11.0 + exclude: + - laravel: ^11.0 + php: '8.1' + + steps: + - name: checkout code + uses: actions/checkout@v3 + + - name: Get composer cache directory + id: composer-cache + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + + - name: Cache dependencies + uses: actions/cache@v3 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-php-${{ matrix.php }}-laravel-${{ matrix.laravel }}-prefer-${{ matrix.prefer }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: ${{ runner.os }}-php-${{ matrix.php }}-laravel-{{ matrix.laravel }}-prefer-${{ matrix.prefer}}-composer- + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: none + + - name: Remove dev packages + run: | + composer remove --dev --no-update \ + friendsofphp/php-cs-fixer \ + infection/infection \ + nunomaduro/larastan \ + phpstan/phpstan-strict-rules + + - name: Require Laravel and Testbench version + run: composer require --no-update laravel/framework:"${{ matrix.laravel }}" illuminate/collections:"${{ matrix.laravel }}" illuminate/database:"${{ matrix.laravel }}" illuminate/http:"${{ matrix.laravel }}" illuminate/support:"${{ matrix.laravel }}" orchestra/testbench:"${{ matrix.testbench }}" + + - name: Support prefer-lowest in PHP 8.1 + if: ${{ matrix.php == 8.1 && matrix.prefer == 'prefer-lowest' }} + run: composer require --no-update nesbot/carbon:"^2.62.1" + + - name: Support prefer-lowest in PHP 8.2 + if: ${{ matrix.php == 8.2 && matrix.prefer == 'prefer-lowest' }} + run: composer require --no-update nesbot/carbon:"^2.62.1" + + - name: Support prefer-lowest in PHP 8.3 + if: ${{ matrix.php == 8.3 && matrix.prefer == 'prefer-lowest' }} + run: composer require --no-update nesbot/carbon:"^2.62.1" + + - name: Install dependencies + run: composer update --${{ matrix.prefer }} + + - name: Check platform requirements + run: composer check-platform-reqs --verbose + + - name: Run tests + run: composer test diff --git a/UPGRADE.md b/UPGRADE.md index e9a412c..52b3bf3 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -103,3 +103,30 @@ Now collections are formatted correctly. The `posts` value is now an object and } } ``` + +## Server implementation no longer included by default + +Previously, the top level `jsonapi` property was included in every response... + +```json5 +{ + // ... + "jsonapi": { + "version": "1.0" + } +} +``` + +This is no longer the case. If you would like to include a server implementation in your API responses you may call the `JsonApiResource::resolveServerImplementationUsing` method in a service provider or middleware: + +```php +use TiMacDonald\JsonApi\JsonApiResource; +use TiMacDonald\JsonApi\ServerImplementation; + + +JsonApiResource::resolveServerImplementationUsing(function () { + return new ServerImplementation(version: '1.4.3', meta: [ + 'secure' => true, + ]); +}); +``` diff --git a/composer.json b/composer.json index 71db81e..a7c8fc7 100644 --- a/composer.json +++ b/composer.json @@ -17,19 +17,19 @@ } ], "require": { - "php": "~8.1.0 || ~8.2.0", - "illuminate/collections": "^9.0 || ^10.0", - "illuminate/database": "^9.0 || ^10.0", - "illuminate/http": "^9.0 || ^10.0", - "illuminate/support": "^9.0 || ^10.0", - "symfony/http-kernel": "^6.0" + "php": "~8.1.0 || ~8.2.0 || ~8.3.0", + "illuminate/collections": "^9.0 || ^10.0 || ^11.0", + "illuminate/database": "^9.0 || ^10.0 || ^11.0", + "illuminate/http": "^9.0 || ^10.0 || ^11.0", + "illuminate/support": "^9.0 || ^10.0 || ^11.0", + "symfony/http-kernel": "^6.0 || ^7.0" }, "require-dev": { "friendsofphp/php-cs-fixer": "^3.13", - "laravel/framework": "^9.0 || ^10.0", + "laravel/framework": "^9.0 || ^10.0 || ^11.0", "opis/json-schema": "^2.3", - "orchestra/testbench": "^7.0 || ^8.0", - "phpunit/phpunit": "^9.0" + "orchestra/testbench": "^7.0 || ^8.0 || ^9.0", + "phpunit/phpunit": "^9.0 || ^10.5" }, "config": { "preferred-install": "dist", diff --git a/src/Concerns/Implementation.php b/src/Concerns/Implementation.php index c856ea0..f520f4e 100644 --- a/src/Concerns/Implementation.php +++ b/src/Concerns/Implementation.php @@ -13,7 +13,7 @@ trait Implementation /** * @api * - * @param (callable(): JsonApiServerImplementation) $callback + * @param (callable(): ServerImplementation) $callback * @return void */ public static function resolveServerImplementationUsing(callable $callback) @@ -24,7 +24,7 @@ public static function resolveServerImplementationUsing(callable $callback) /** * @internal * - * @return (callable(Request): (JsonApiServerImplementation|null)) + * @return (callable(Request): (ServerImplementation|null)) */ public static function serverImplementationResolver() { diff --git a/src/JsonApiResource.php b/src/JsonApiResource.php index 18ddee1..f986707 100644 --- a/src/JsonApiResource.php +++ b/src/JsonApiResource.php @@ -99,7 +99,7 @@ public function toResourceIdentifier(Request $request) } /** - * @return JsonApiServerImplementation|null + * @return ServerImplementation|null */ public static function toServerImplementation(Request $request) { @@ -124,9 +124,10 @@ public function toArray($request) } /** - * @return array{included?: array, jsonapi: JsonApiServerImplementation} + * @param Request $request + * @return array{included?: array, jsonapi: ServerImplementation} */ - public function with(Request $request) + public function with($request) { return [ ...($included = $this->included($request) diff --git a/src/JsonApiResourceCollection.php b/src/JsonApiResourceCollection.php index e211e06..acce004 100644 --- a/src/JsonApiResourceCollection.php +++ b/src/JsonApiResourceCollection.php @@ -42,9 +42,10 @@ private function resolveResourceIdentifiers(Request $request) } /** - * @return array{included?: array, jsonapi?: JsonApiServerImplementation} + * @param Request $request + * @return array{included?: array, jsonapi?: ServerImplementation} */ - public function with(Request $request) + public function with($request) { return [ ...($included = $this->collection diff --git a/tests/Feature/AttributesTest.php b/tests/Feature/AttributesTest.php index 07df643..b8f87db 100644 --- a/tests/Feature/AttributesTest.php +++ b/tests/Feature/AttributesTest.php @@ -42,9 +42,6 @@ public function toAttributes($request): array 'email' => 'tim@example.com', ], ], - 'jsonapi' => [ - 'version' => '1.0', - ], ]); $this->assertValidJsonApi($response); } @@ -80,9 +77,6 @@ public function toAttributes($request): array 'location' => 'Melbourne', ], ], - 'jsonapi' => [ - 'version' => '1.0', - ], ]); $this->assertValidJsonApi($response); } @@ -114,9 +108,6 @@ public function toAttributes($request): array 'id' => 'expected-id', 'type' => 'basicModels', ], - 'jsonapi' => [ - 'version' => '1.0', - ], ]); $this->assertValidJsonApi($response); } @@ -147,9 +138,6 @@ public function toAttributes($request): array 'location' => 'Melbourne', ], ], - 'jsonapi' => [ - 'version' => '1.0', - ], ]); $this->assertValidJsonApi($response); } @@ -176,9 +164,6 @@ public function toAttributes($request): array 'id' => 'expected-id', 'type' => 'basicModels', ], - 'jsonapi' => [ - 'version' => '1.0', - ], ]); $this->assertValidJsonApi($response); } @@ -226,9 +211,6 @@ public function testItCanSpecifyMinimalAttributes(): void 'type' => 'basicModels', 'id' => 'user-id', ], - 'jsonapi' => [ - 'version' => '1.0', - ], ]); $this->assertValidJsonApi($response); } @@ -254,9 +236,6 @@ public function testItCanRequestAttributesWhenUsingMinimalAttributes() 'name' => 'user-name', ], ], - 'jsonapi' => [ - 'version' => '1.0', - ], ]); $this->assertValidJsonApi($response); } @@ -302,9 +281,6 @@ public function testItCanUseSparseFieldsetsWithIncludedCollections(): void ], ], ], - 'jsonapi' => [ - 'version' => '1.0', - ], 'included' => [ [ 'id' => 'post-id-1', @@ -355,9 +331,6 @@ public function toAttributes($request): array 'email' => 'tim@example.com', ], ], - 'jsonapi' => [ - 'version' => '1.0', - ], ]); $this->assertValidJsonApi($response); } @@ -394,9 +367,6 @@ public function toAttributes($request): array 'address' => '123 fake street', ], ], - 'jsonapi' => [ - 'version' => '1.0', - ], ]); $this->assertValidJsonApi($response); } @@ -434,9 +404,6 @@ public function toAttributes($request): array 'address' => '123 fake street', ], ], - 'jsonapi' => [ - 'version' => '1.0', - ], ]); $this->assertValidJsonApi($response); } diff --git a/tests/Feature/FeatureTest.php b/tests/Feature/FeatureTest.php index 572edb1..28f1061 100644 --- a/tests/Feature/FeatureTest.php +++ b/tests/Feature/FeatureTest.php @@ -4,7 +4,7 @@ namespace Tests\Feature; -use Illuminate\Foundation\Testing\RefreshDatabase; +use Illuminate\Foundation\Testing\LazilyRefreshDatabase; use Illuminate\Support\Facades\Route; use Tests\Models\BasicModel; use Tests\Resources\UserResource; @@ -12,12 +12,15 @@ class FeatureTest extends TestCase { - use RefreshDatabase; + use LazilyRefreshDatabase; - public function setUp(): void + /** + * Define database migrations. + * + * @return void + */ + protected function defineDatabaseMigrations() { - parent::setUp(); - $this->loadMigrationsFrom(__DIR__ . '/../database'); } @@ -92,9 +95,6 @@ public function testItCanPaginate(): void ], ], ], - 'jsonapi' => [ - 'version' => '1.0', - ], ]); $this->assertValidJsonApi($response); } diff --git a/tests/Feature/JsonApiTest.php b/tests/Feature/JsonApiTest.php index ad1d658..e764919 100644 --- a/tests/Feature/JsonApiTest.php +++ b/tests/Feature/JsonApiTest.php @@ -37,9 +37,6 @@ public function testItCanReturnASingleResource(): void 'name' => 'user-name', ], ], - 'jsonapi' => [ - 'version' => '1.0', - ], ]); $this->assertValidJsonApi($response); } @@ -78,9 +75,6 @@ public function testItCanReturnACollection(): void ], ], ], - 'jsonapi' => [ - 'version' => '1.0', - ], ]); $this->assertValidJsonApi($response); } @@ -120,9 +114,6 @@ public function toMeta($request): array 'meta-key' => 'meta-value', ], ], - 'jsonapi' => [ - 'version' => '1.0', - ], ]); $this->assertValidJsonApi($response); } @@ -164,9 +155,6 @@ public function toLinks($request): array ], ], ], - 'jsonapi' => [ - 'version' => '1.0', - ], ]); $this->assertValidJsonApi($response); } @@ -203,9 +191,6 @@ public function testItCanCustomiseTheTypeResolution(): void 'id' => 'expected-id', 'type' => 'Tests\\Models\\BasicModel', ], - 'jsonapi' => [ - 'version' => '1.0', - ], ]); $this->assertValidJsonApi($response); } @@ -222,9 +207,6 @@ public function testItCanCustomiseTheIdResolution(): void 'id' => 'expected-id', 'type' => 'basicModels', ], - 'jsonapi' => [ - 'version' => '1.0', - ], ]); $this->assertValidJsonApi($response); } diff --git a/tests/Feature/RelationshipsTest.php b/tests/Feature/RelationshipsTest.php index 024edda..7244e45 100644 --- a/tests/Feature/RelationshipsTest.php +++ b/tests/Feature/RelationshipsTest.php @@ -57,9 +57,6 @@ public function toRelationships($request): array 'content' => 'post-content', ], ], - 'jsonapi' => [ - 'version' => '1.0', - ], ]); $this->assertValidJsonApi($response); } @@ -97,9 +94,6 @@ public function testItCanIncludeASingleToOneResourceForASingleResource(): void ], ], ], - 'jsonapi' => [ - 'version' => '1.0', - ], 'included' => [ [ 'id' => 'author-id', @@ -164,9 +158,6 @@ public function testItCanIncludeNestedToOneResourcesForASingleResource(): void ], ], ], - 'jsonapi' => [ - 'version' => '1.0', - ], 'included' => [ [ 'id' => 'author-id', @@ -256,9 +247,6 @@ public function toRelationships($request): array ], ], ], - 'jsonapi' => [ - 'version' => '1.0', - ], 'included' => [ [ 'id' => 'child-id-1', @@ -323,9 +311,6 @@ public function toRelationships($request): array ], ], ], - 'jsonapi' => [ - 'version' => '1.0', - ], 'included' => [ [ 'id' => 'child-id-1', @@ -418,9 +403,6 @@ public function testItCanIncludeToOneResourcesForACollectionOfResources(): void ], ], ], - 'jsonapi' => [ - 'version' => '1.0', - ], 'included' => [ [ 'id' => 'author-id-1', @@ -486,9 +468,6 @@ public function testItCanIncludeACollectionOfResourcesForASingleResource(): void ], ], ], - 'jsonapi' => [ - 'version' => '1.0', - ], 'included' => [ [ 'id' => 'post-id-1', @@ -623,9 +602,6 @@ public function testItCanIncludeAManyManyManyRelationship(): void ], ], ], - 'jsonapi' => [ - 'version' => '1.0', - ], 'included' => [ [ 'id' => 'comment-id-1', @@ -797,9 +773,6 @@ public function toAttributes($request): array ], ], ], - 'jsonapi' => [ - 'version' => '1.0', - ], 'included' => [ [ 'id' => 'relation-id', @@ -869,9 +842,6 @@ public function testItFiltersOutDuplicateIncludesForACollectionOfResources(): vo ], ], ], - 'jsonapi' => [ - 'version' => '1.0', - ], 'included' => [ [ 'id' => 'avatar-id', @@ -925,9 +895,6 @@ public function testItFiltersOutDuplicateResourceObjectsIncludesForASingleResour ], ], ], - 'jsonapi' => [ - 'version' => '1.0', - ], 'included' => [ [ 'id' => 'post-id', @@ -963,9 +930,6 @@ public function testItHasIncludedArrayWhenIncludeParameterIsPresentForASingleRes 'name' => 'user-name', ], ], - 'jsonapi' => [ - 'version' => '1.0', - ], ]); $this->assertValidJsonApi($response); } @@ -993,9 +957,6 @@ public function testItHasIncludedArrayWhenIncludeParameterIsPresentForACollectio ], ], ], - 'jsonapi' => [ - 'version' => '1.0', - ], ]); $this->assertValidJsonApi($response); } @@ -1023,9 +984,6 @@ public function testItCanReturnNullForEmptyToOneRelationships(): void ], ], ], - 'jsonapi' => [ - 'version' => '1.0', - ], ]); $this->assertValidJsonApi($response); } @@ -1053,9 +1011,6 @@ public function testItCanReturnAnEmptyArrayForEmptyToManyRelationships(): void ], ], ], - 'jsonapi' => [ - 'version' => '1.0', - ], ]); $this->assertValidJsonApi($response); } @@ -1151,9 +1106,6 @@ public function testCollectionIncludesDoesntBecomeNumericKeyedObjectAfterFilteri ], ], ], - 'jsonapi' => [ - 'version' => '1.0', - ], 'included' => [ [ 'id' => '1', @@ -1250,9 +1202,6 @@ public function testSingleResourceIncludesDoesntBecomeNumericKeyedObjectAfterFil ], ], ], - 'jsonapi' => [ - 'version' => '1.0', - ], ] ); } @@ -1284,9 +1233,6 @@ public function toRelationships($request): array 'name' => 'user-name', ], ], - 'jsonapi' => [ - 'version' => '1.0', - ], ]); $this->assertValidJsonApi($response); } @@ -1330,9 +1276,6 @@ public function toRelationships($request): array ], ], ], - 'jsonapi' => [ - 'version' => '1.0', - ], 'included' => [ [ 'id' => '2', @@ -1386,9 +1329,6 @@ public function toRelationships($request): array ], ], ], - 'jsonapi' => [ - 'version' => '1.0', - ], 'included' => [ [ 'id' => '2', @@ -1459,9 +1399,6 @@ public function testItCanIncludeDeepNestedResourcesForASingleResource(): void ], ], ], - 'jsonapi' => [ - 'version' => '1.0', - ], 'included' => [ [ 'id' => 'author-id', diff --git a/tests/Feature/ResourceIdentificationTest.php b/tests/Feature/ResourceIdentificationTest.php index 3369ef6..6bd1d53 100644 --- a/tests/Feature/ResourceIdentificationTest.php +++ b/tests/Feature/ResourceIdentificationTest.php @@ -78,9 +78,6 @@ public function testItResolvesTheIdAndTypeOfAModel(): void 'id' => 'user-id', 'type' => 'basicModels', ], - 'jsonapi' => [ - 'version' => '1.0', - ], ]); $this->assertValidJsonApi($response); } @@ -102,9 +99,6 @@ public function testItCastsAModelsIntegerIdToAString(): void 'id' => '55', 'type' => 'basicModels', ], - 'jsonapi' => [ - 'version' => '1.0', - ], ]); $this->assertValidJsonApi($response); } diff --git a/tests/TestCase.php b/tests/TestCase.php index 46199d3..a136c96 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -9,8 +9,6 @@ use Orchestra\Testbench\TestCase as BaseTestCase; use RuntimeException; -use TiMacDonald\JsonApi\JsonApiResource; - use function is_string; class TestCase extends BaseTestCase