jasonmccreary / laravel-test-assertions

A set of helpful assertions when testing Laravel applications.
321 stars 34 forks source link

Package incompatible with laravel/framework 8.62.0 #32

Closed mortenscheel closed 3 years ago

mortenscheel commented 3 years ago

PhpUnit throws a fatal error when using this package with laravel 8.62.0 and PHP 8.0:

PHP Fatal error:  Declaration of JMac\Testing\Traits\AdditionalAssertions::assertNotSoftDeleted(Illuminate\Database\Eloquent\Model $model) must be compatible with Illuminate\Foundation\Testing\TestCase::assertNotSoftDeleted($table, array $data = [], $connection = null, $deletedAtColumn = 'deleted_at') in /var/www/html/tests/TestCase.php on line 182

This is because assertNotSoftDeleted() has been added to Illuminate\Foundation\Testing\Concerns\InteractsWithDatabase but with a different method signature.

A temporary workaround is to add the following method to the class that imports the AdditionalAssertions trait:

protected function assertNotSoftDeleted($table, array $data = [], $connection = null, $deletedAtColumn = 'deleted_at')
{
    return parent::assertNotSoftDeleted($table, $data, $connection, $deletedAtColumn);
}
jasonmccreary commented 3 years ago

This was already reported in #30 and resolved with the 2.0.0 release.

mortenscheel commented 3 years ago

Ok thanks. I thought I was using the latest version.