]));
$resp->assertRedirect();
$editorId = $this->users->editor()->id;
- $this->assertDatabaseHas('bookshelves', array_merge($shelfInfo, ['created_by' => $editorId, 'updated_by' => $editorId]));
+ $this->assertDatabaseHasEntityData('bookshelf', array_merge($shelfInfo, ['created_by' => $editorId, 'updated_by' => $editorId]));
$shelf = Bookshelf::where('name', '=', $shelfInfo['name'])->first();
$shelfPage = $this->get($shelf->getUrl());
$lastImage = Image::query()->orderByDesc('id')->firstOrFail();
$shelf = Bookshelf::query()->where('name', '=', $shelfInfo['name'])->first();
- $this->assertDatabaseHas('bookshelves', [
- 'id' => $shelf->id,
+ $this->assertDatabaseHas('entity_container_data', [
+ 'entity_id' => $shelf->id,
+ 'entity_type' => 'bookshelf',
'image_id' => $lastImage->id,
]);
- $this->assertEquals($lastImage->id, $shelf->cover->id);
+ $this->assertEquals($lastImage->id, $shelf->coverInfo()->getImage()->id);
$this->assertEquals('cover_bookshelf', $lastImage->type);
}
$this->assertSessionHas('success');
$editorId = $this->users->editor()->id;
- $this->assertDatabaseHas('bookshelves', array_merge($shelfInfo, ['id' => $shelf->id, 'created_by' => $editorId, 'updated_by' => $editorId]));
+ $this->assertDatabaseHasEntityData('bookshelf', array_merge($shelfInfo, ['id' => $shelf->id, 'created_by' => $editorId, 'updated_by' => $editorId]));
$shelfPage = $this->get($shelf->getUrl());
$shelfPage->assertSee($shelfInfo['name']);