SD9410
Not sure what did I do wrong here
So I am using spatie media library for file upload and things are working as expected however when i am trying to test (pest) i am getting an error which I am a bit confused of
now inside my test
but I am getting this error
haven't faced this problem before.
SpatieMediaLibraryImageColumn::make('avatar')
->collection('avatars')
->circular()
->conversion('thumb')
->extraImgAttributes(['loading' => 'lazy'])
SpatieMediaLibraryImageColumn::make('avatar')
->collection('avatars')
->circular()
->conversion('thumb')
->extraImgAttributes(['loading' => 'lazy'])
beforeEach(function () {
asRole(Role::IS_ADMIN);
$this->author = Author::factory()
->has(Publisher::factory())
->create();
Storage::fake('public');
});
it('can get authors avatar, name, publisher and date of birth', function () {
$authors = $this->author;
$author = $authors->first();
$this->list
->assertTableColumnStateSet('avatar', $author->avatar, record: $author)
->assertTableColumnStateSet('name', $author->name, record: $author)
->assertTableColumnStateSet('publisher.name', $author->publisher->name, record: $author)
->assertTableColumnStateSet('date_of_birth', $author->date_of_birth, record: $author);
});
beforeEach(function () {
asRole(Role::IS_ADMIN);
$this->author = Author::factory()
->has(Publisher::factory())
->create();
Storage::fake('public');
});
it('can get authors avatar, name, publisher and date of birth', function () {
$authors = $this->author;
$author = $authors->first();
$this->list
->assertTableColumnStateSet('avatar', $author->avatar, record: $author)
->assertTableColumnStateSet('name', $author->name, record: $author)
->assertTableColumnStateSet('publisher.name', $author->publisher->name, record: $author)
->assertTableColumnStateSet('date_of_birth', $author->date_of_birth, record: $author);
});
FAILED Tests\Feature\Admin\AuthorResourceTest > `Author List Page` → it can get authors avatar, name, publisher and date of birth
Failed asserting that a table column with name [avatar] has value of [] for record [1] on the [App\Filament\Admin\Resources\AuthorResource\Pages\ListAuthors] component.
Failed asserting that false is true.
at vendor/filament/tables/src/Testing/TestsColumns.php:193
189▕ if (is_array($value)) {
190▕ $value = json_encode($value);
191▕ }
192▕
➜ 193▕ Assert::assertTrue(
194▕ $state == $value,
195▕ message: "Failed asserting that a table column with name [{$name}] has value of [{$value}] for record [{$record->getKey()}] on the [{$livewireClass}] component.",
196▕ );
197▕
FAILED Tests\Feature\Admin\AuthorResourceTest > `Author List Page` → it can get authors avatar, name, publisher and date of birth
Failed asserting that a table column with name [avatar] has value of [] for record [1] on the [App\Filament\Admin\Resources\AuthorResource\Pages\ListAuthors] component.
Failed asserting that false is true.
at vendor/filament/tables/src/Testing/TestsColumns.php:193
189▕ if (is_array($value)) {
190▕ $value = json_encode($value);
191▕ }
192▕
➜ 193▕ Assert::assertTrue(
194▕ $state == $value,
195▕ message: "Failed asserting that a table column with name [{$name}] has value of [{$value}] for record [{$record->getKey()}] on the [{$livewireClass}] component.",
196▕ );
197▕
1 replies