Test for cover image upload

This commit is contained in:
Nilesh Deepak 2017-07-15 16:19:35 +05:30
parent dd4d2f4696
commit 9872767f20
3 changed files with 7 additions and 3 deletions

View File

@ -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

View File

@ -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], []);

View 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');
}
}