mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-01-19 05:52:48 +08:00
Test for cover image upload
This commit is contained in:
parent
dd4d2f4696
commit
9872767f20
|
@ -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
|
||||
|
|
|
@ -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], []);
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user