Skip to content

NOW MANAGED ON CODEBERG

Test for cover image upload

Nilesh Deepak9872767f20f2
diff --git a/tests/Entity/EntityTest.php b/tests/Entity/EntityTest.php
index 647676ec7..180b302c6 100644
--- a/tests/Entity/EntityTest.php
+++ b/tests/Entity/EntityTest.php
@@ -5,6 +5,7 @@ use BookStack\Chapter;
use BookStack\Page;
use BookStack\Repos\EntityRepo;
use BookStack\Repos\UserRepo;
+use ImageTest;
class EntityTest extends BrowserKitTest
{
@@ -137,6 +138,7 @@ class EntityTest extends BrowserKitTest
$book = factory(Book::class)->make([
'name' => 'My First Book'
]);
+ $imagePath = uploadImage('test-image.jpg', 0);
$this->asAdmin()
->visit('/books')
// Choose to create a book
diff --git a/tests/ImageTest.php b/tests/ImageTest.php
index 3bb41138b..898972f7d 100644
--- a/tests/ImageTest.php
+++ b/tests/ImageTest.php
@@ -30,7 +30,7 @@ class ImageTest extends BrowserKitTest
* @param int $uploadedTo
* @return string
*/
- protected function uploadImage($name, $uploadedTo = 0)
+ public function uploadImage($name, $uploadedTo = 0)
{
$file = $this->getTestImage($name);
$this->call('POST', '/images/gallery/upload', ['uploaded_to' => $uploadedTo], [], ['file' => $file], []);
diff --git a/tests/UserProfileTest.php b/tests/UserProfileTest.php
index 09870e138..c87a7b88a 100644
--- a/tests/UserProfileTest.php
+++ b/tests/UserProfileTest.php
@@ -99,9 +99,10 @@ class UserProfileTest extends BrowserKitTest
{
$this->asAdmin()
->visit('/settings/users/' . $this->user->id)
- ->select('grid', '#books_display')
+ ->select('#books_display', 'List')
->press('Save')
->visit('/books')
+ ->pageNotHasElement('.gallery-item')
->pageHasElement('.entity-list-item');
}
@@ -109,9 +110,10 @@ class UserProfileTest extends BrowserKitTest
{
$this->asAdmin()
->visit('/settings/users/' . $this->user->id)
- ->select('list', '#books_display')
+ ->select('#books_display', 'Grid')
->press('Save')
->visit('/books')
+ ->pageNotHasElement('.entity-list-item')
->pageHasElement('.gallery-item');
}
}