mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-10-01 01:36:00 -04:00
Updated cover image methods so image parameter is not optional but still nullable
This commit is contained in:
parent
98ab3c1ffb
commit
5978d9a0d3
@ -76,7 +76,7 @@ class BaseRepo
|
||||
* @throws ImageUploadException
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function updateCoverImage(HasCoverImage $entity, UploadedFile $coverImage = null, bool $removeImage = false)
|
||||
public function updateCoverImage(HasCoverImage $entity, ?UploadedFile $coverImage, bool $removeImage = false)
|
||||
{
|
||||
if ($coverImage) {
|
||||
$this->imageRepo->destroyImage($entity->cover);
|
||||
|
@ -108,7 +108,7 @@ class BookRepo
|
||||
* @throws ImageUploadException
|
||||
* @throws Exception
|
||||
*/
|
||||
public function updateCoverImage(Book $book, UploadedFile $coverImage = null, bool $removeImage = false)
|
||||
public function updateCoverImage(Book $book, ?UploadedFile $coverImage, bool $removeImage = false)
|
||||
{
|
||||
$this->baseRepo->updateCoverImage($book, $coverImage, $removeImage);
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ class BookshelfRepo
|
||||
* @throws ImageUploadException
|
||||
* @throws Exception
|
||||
*/
|
||||
public function updateCoverImage(Bookshelf $shelf, UploadedFile $coverImage = null, bool $removeImage = false)
|
||||
public function updateCoverImage(Bookshelf $shelf, ?UploadedFile $coverImage, bool $removeImage = false)
|
||||
{
|
||||
$this->baseRepo->updateCoverImage($shelf, $coverImage, $removeImage);
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ class BookShelfTest extends TestCase
|
||||
$lastImage = Image::query()->orderByDesc('id')->firstOrFail();
|
||||
$shelf = Bookshelf::query()->where('name', '=', $shelfInfo['name'])->first();
|
||||
$this->assertDatabaseHas('bookshelves', [
|
||||
'id' => $shelf,
|
||||
'id' => $shelf->id,
|
||||
'image_id' => $lastImage->id,
|
||||
]);
|
||||
$this->assertEquals($lastImage->id, $shelf->cover->id);
|
||||
|
Loading…
Reference in New Issue
Block a user