mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-10-30 07:32:39 +01:00
Fixed failing home test after changes in last commit
Also made a restriction test more reliable. Also renamed restrictionstest to entitypermissionstest to be more consistent with newer app wording.
This commit is contained in:
parent
4b4642c8ea
commit
f1e1a745b0
@ -98,16 +98,16 @@ class HomepageTest extends TestCase
|
|||||||
{
|
{
|
||||||
$editor = $this->getEditor();
|
$editor = $this->getEditor();
|
||||||
setting()->putUser($editor, 'bookshelves_view_type', 'grid');
|
setting()->putUser($editor, 'bookshelves_view_type', 'grid');
|
||||||
|
$shelf = Bookshelf::query()->firstOrFail();
|
||||||
|
|
||||||
$this->setSettings(['app-homepage-type' => 'bookshelves']);
|
$this->setSettings(['app-homepage-type' => 'bookshelves']);
|
||||||
|
|
||||||
$this->asEditor();
|
$this->asEditor();
|
||||||
$homeVisit = $this->get('/');
|
$homeVisit = $this->get('/');
|
||||||
$homeVisit->assertSee('Shelves');
|
$homeVisit->assertSee('Shelves');
|
||||||
$homeVisit->assertSee('bookshelf-grid-item grid-card');
|
|
||||||
$homeVisit->assertSee('grid-card-content');
|
$homeVisit->assertSee('grid-card-content');
|
||||||
$homeVisit->assertSee('grid-card-footer');
|
|
||||||
$homeVisit->assertSee('featured-image-container');
|
$homeVisit->assertSee('featured-image-container');
|
||||||
|
$homeVisit->assertElementContains('.grid-card', $shelf->name);
|
||||||
|
|
||||||
$this->setSettings(['app-homepage-type' => false]);
|
$this->setSettings(['app-homepage-type' => false]);
|
||||||
$this->test_default_homepage_visible();
|
$this->test_default_homepage_visible();
|
||||||
|
@ -6,9 +6,10 @@ use BookStack\Entities\Models\Chapter;
|
|||||||
use BookStack\Entities\Models\Entity;
|
use BookStack\Entities\Models\Entity;
|
||||||
use BookStack\Auth\User;
|
use BookStack\Auth\User;
|
||||||
use BookStack\Entities\Models\Page;
|
use BookStack\Entities\Models\Page;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
use Tests\BrowserKitTest;
|
use Tests\BrowserKitTest;
|
||||||
|
|
||||||
class RestrictionsTest extends BrowserKitTest
|
class EntityPermissionsTest extends BrowserKitTest
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -642,11 +643,15 @@ class RestrictionsTest extends BrowserKitTest
|
|||||||
public function test_page_visible_if_has_permissions_when_book_not_visible()
|
public function test_page_visible_if_has_permissions_when_book_not_visible()
|
||||||
{
|
{
|
||||||
$book = Book::first();
|
$book = Book::first();
|
||||||
|
|
||||||
$this->setEntityRestrictions($book, []);
|
|
||||||
|
|
||||||
$bookChapter = $book->chapters->first();
|
$bookChapter = $book->chapters->first();
|
||||||
$bookPage = $bookChapter->pages->first();
|
$bookPage = $bookChapter->pages->first();
|
||||||
|
|
||||||
|
foreach ([$book, $bookChapter, $bookPage] as $entity) {
|
||||||
|
$entity->name = Str::random(24);
|
||||||
|
$entity->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->setEntityRestrictions($book, []);
|
||||||
$this->setEntityRestrictions($bookPage, ['view']);
|
$this->setEntityRestrictions($bookPage, ['view']);
|
||||||
|
|
||||||
$this->actingAs($this->viewer);
|
$this->actingAs($this->viewer);
|
Loading…
Reference in New Issue
Block a user