mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-07-17 00:32:36 +00: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\Page;
|
||||||
use BookStack\Repos\EntityRepo;
|
use BookStack\Repos\EntityRepo;
|
||||||
use BookStack\Repos\UserRepo;
|
use BookStack\Repos\UserRepo;
|
||||||
|
use ImageTest;
|
||||||
|
|
||||||
class EntityTest extends BrowserKitTest
|
class EntityTest extends BrowserKitTest
|
||||||
{
|
{
|
||||||
|
@ -137,6 +138,7 @@ class EntityTest extends BrowserKitTest
|
||||||
$book = factory(Book::class)->make([
|
$book = factory(Book::class)->make([
|
||||||
'name' => 'My First Book'
|
'name' => 'My First Book'
|
||||||
]);
|
]);
|
||||||
|
$imagePath = uploadImage('test-image.jpg', 0);
|
||||||
$this->asAdmin()
|
$this->asAdmin()
|
||||||
->visit('/books')
|
->visit('/books')
|
||||||
// Choose to create a book
|
// Choose to create a book
|
||||||
|
|
|
@ -30,7 +30,7 @@ class ImageTest extends BrowserKitTest
|
||||||
* @param int $uploadedTo
|
* @param int $uploadedTo
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function uploadImage($name, $uploadedTo = 0)
|
public function uploadImage($name, $uploadedTo = 0)
|
||||||
{
|
{
|
||||||
$file = $this->getTestImage($name);
|
$file = $this->getTestImage($name);
|
||||||
$this->call('POST', '/images/gallery/upload', ['uploaded_to' => $uploadedTo], [], ['file' => $file], []);
|
$this->call('POST', '/images/gallery/upload', ['uploaded_to' => $uploadedTo], [], ['file' => $file], []);
|
||||||
|
|
|
@ -99,9 +99,10 @@ class UserProfileTest extends BrowserKitTest
|
||||||
{
|
{
|
||||||
$this->asAdmin()
|
$this->asAdmin()
|
||||||
->visit('/settings/users/' . $this->user->id)
|
->visit('/settings/users/' . $this->user->id)
|
||||||
->select('grid', '#books_display')
|
->select('#books_display', 'List')
|
||||||
->press('Save')
|
->press('Save')
|
||||||
->visit('/books')
|
->visit('/books')
|
||||||
|
->pageNotHasElement('.gallery-item')
|
||||||
->pageHasElement('.entity-list-item');
|
->pageHasElement('.entity-list-item');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,9 +110,10 @@ class UserProfileTest extends BrowserKitTest
|
||||||
{
|
{
|
||||||
$this->asAdmin()
|
$this->asAdmin()
|
||||||
->visit('/settings/users/' . $this->user->id)
|
->visit('/settings/users/' . $this->user->id)
|
||||||
->select('list', '#books_display')
|
->select('#books_display', 'Grid')
|
||||||
->press('Save')
|
->press('Save')
|
||||||
->visit('/books')
|
->visit('/books')
|
||||||
|
->pageNotHasElement('.entity-list-item')
|
||||||
->pageHasElement('.gallery-item');
|
->pageHasElement('.gallery-item');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user