]> BookStack Code Mirror - bookstack/blobdiff - tests/Entity/BookShelfTest.php
Fix English translations
[bookstack] / tests / Entity / BookShelfTest.php
index 8f41e83ab05b5c34fc05822bc7b87eb0ede37e5e..cb3acfb1e8eb8724d3a927e0b4c8c1a5a11d9823 100644 (file)
@@ -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();
@@ -284,7 +303,7 @@ class BookShelfTest extends TestCase
         $newBook = Book::query()->orderBy('id', 'desc')->first();
 
         $resp = $this->asEditor()->get($newBook->getUrl());
-        $resp->assertSee($shelfInfo['name']);
+        $resp->assertElementContains('.tri-layout-left-contents', $shelfInfo['name']);
 
         // Remove shelf
         $this->delete($shelf->getUrl());