NOW MANAGED ON CODEBERG
Test for cover image.
Nilesh Deepaka488ef6b00a5
diff --git a/tests/Entity/EntityTest.php b/tests/Entity/EntityTest.phpindex 180b302c6..b818fcc38 100644--- a/tests/Entity/EntityTest.php+++ b/tests/Entity/EntityTest.php@@ -5,7 +5,6 @@ use BookStack\Chapter;use BookStack\Page;use BookStack\Repos\EntityRepo;use BookStack\Repos\UserRepo;-use ImageTest;class EntityTest extends BrowserKitTest{@@ -138,7 +137,8 @@ class EntityTest extends BrowserKitTest$book = factory(Book::class)->make(['name' => 'My First Book']);- $imagePath = uploadImage('test-image.jpg', 0);++ $this->uploadImage('test-image.jpg', 0);$this->asAdmin()->visit('/books')// Choose to create a book@@ -277,4 +277,20 @@ class EntityTest extends BrowserKitTest->seeInElement('#recently-created-pages', $entityChain['page']->name);}+ protected function uploadImage($name, $uploadedTo = 0)+ {+ $file = $this->getTestImage($name);+ $this->call('POST', '/images/gallery/upload', ['uploaded_to' => $uploadedTo], [], ['file' => $file], []);+ return $this->getTestImagePath('gallery', $name);+ }++ protected function getTestImage($fileName)+ {+ return new \Illuminate\Http\UploadedFile(base_path('tests/test-data/test-image.jpg'), $fileName, 'image/jpeg', 5238);+ }++ protected function getTestImagePath($type, $fileName)+ {+ return '/uploads/images/' . $type . '/' . Date('Y-m-M') . '/' . $fileName;+ }}diff --git a/tests/ImageTest.php b/tests/ImageTest.phpindex 898972f7d..3bb41138b 100644--- a/tests/ImageTest.php+++ b/tests/ImageTest.php@@ -30,7 +30,7 @@ class ImageTest extends BrowserKitTest* @param int $uploadedTo* @return string*/- public function uploadImage($name, $uploadedTo = 0)+ protected function uploadImage($name, $uploadedTo = 0){$file = $this->getTestImage($name);$this->call('POST', '/images/gallery/upload', ['uploaded_to' => $uploadedTo], [], ['file' => $file], []);