X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/47e645909e7e5dd315dce150cfb9faa19a5bde31..refs/pull/2238/head:/tests/Entity/BookShelfTest.php diff --git a/tests/Entity/BookShelfTest.php b/tests/Entity/BookShelfTest.php index abee4d34a..cb3acfb1e 100644 --- a/tests/Entity/BookShelfTest.php +++ b/tests/Entity/BookShelfTest.php @@ -56,6 +56,25 @@ class BookShelfTest extends TestCase $resp->assertElementContains('a', 'New Shelf'); } + public function test_book_not_visible_in_shelf_list_view_if_user_cant_view_shelf() + { + config()->set([ + 'app.views.bookshelves' => 'list', + ]); + $shelf = Bookshelf::query()->first(); + $book = $shelf->books()->first(); + + $resp = $this->asEditor()->get('/shelves'); + $resp->assertSee($book->name); + $resp->assertSee($book->getUrl()); + + $this->setEntityRestrictions($book, []); + + $resp = $this->asEditor()->get('/shelves'); + $resp->assertDontSee($book->name); + $resp->assertDontSee($book->getUrl()); + } + public function test_shelves_create() { $booksToInclude = Book::take(2)->get();