cloudcreativity / laravel-json-api

JSON API (jsonapi.org) package for Laravel applications.
http://laravel-json-api.readthedocs.io/en/latest/
Apache License 2.0
780 stars 109 forks source link

[BUG] Test failing on Laravel 6.1 #439

Closed umbert-cobiro closed 5 years ago

umbert-cobiro commented 5 years ago

So, if you upgrade to Laravel 6.2 there is a problem with the testing.

Downgrading back solves the problem. I leave a bit of a stack trace and test test code so u can try reproduce :)

Test code:

$group = factory(Group::class)->create();

        $this->doRead($group)
            ->assertFetchedOne([
                'type' => $this->resourceType,
                'id' => "{$group->id}",
                'attributes' => [
                    'text' => $group->text,
                    'landing_pages' => $group->landing_pages,
                    'site' => $group->site_id,
                    'custom' => $group->custom,
                    'created_at' => $group->created_at->toAtomString(),
                    'updated_at' => $group->updated_at->toAtomString(),
                ],
            ]);

Stack trace:

ErrorException: Declaration of CloudCreativity\JsonApi\Testing\Concerns\HasHttpAssertions::assertNoContent(): CloudCreativity\JsonApi\Testing\Concerns\HasHttpAssertions should be compatible with Illuminate\Foundation\Testing\TestResponse::assertNoContent($status = 204)

/Users/umbert/Repos/keywords.services/vendor/cloudcreativity/laravel-json-api/src/Testing/TestResponse.php:32
/Users/umbert/Repos/keywords.services/vendor/cloudcreativity/laravel-json-api/src/Testing/MakesJsonApiRequests.php:178
/Users/umbert/Repos/keywords.services/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php:443
/Users/umbert/Repos/keywords.services/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php:406
/Users/umbert/Repos/keywords.services/vendor/cloudcreativity/laravel-json-api/src/Testing/MakesJsonApiRequests.php:103
/Users/umbert/Repos/keywords.services/vendor/cloudcreativity/laravel-json-api/src/Testing/MakesJsonApiRequests.php:152
/Users/umbert/Repos/keywords.services/vendor/cloudcreativity/laravel-json-api/src/Testing/MakesJsonApiRequests.php:307
jstoone commented 5 years ago

This is caused by a method of the same name was added in 6.2, which caused the collision: https://github.com/laravel/framework/pull/30125

Sending PR.

jstoone commented 5 years ago

Actually @lindyhopchris has already fixed this issue. One step ahead, like always:

https://github.com/cloudcreativity/json-api-testing/commit/d3d5ec1de57519538ab9103266731a604aa9a6a3

We might just need it tagged and updated in this package.

lindyhopchris commented 5 years ago

Yeah spot on, I have already fixed this, though have forgotten I need to tag and release.

Won't take me too long to sort out, will hopefully have time this afternoon (UK time).

lindyhopchris commented 5 years ago

Just released this, the fix is to upgrade the cloudcreativity/json-api-testing dependency to ^2.0. I've also tagged 1.5.0 of this package as well.