]> BookStack Code Mirror - bookstack/blobdiff - tests/Permissions/RestrictionsTest.php
Finished migration of last angular code
[bookstack] / tests / Permissions / RestrictionsTest.php
index 7007985e4ff19d72738e3c26919666290db4471f..faceab92c7322dd7c00f662e70673a2ceb8eae9a 100644 (file)
@@ -226,6 +226,7 @@ class RestrictionsTest extends BrowserKitTest
             ->type('test content', 'html')
             ->press('Save Page')
             ->seePageIs($chapter->book->getUrl() . '/page/test-page');
+
         $this->visit($chapterUrl)->seeInElement('.action-buttons', 'New Page');
     }
 
@@ -522,4 +523,21 @@ class RestrictionsTest extends BrowserKitTest
             ->see('Delete Chapter');
     }
 
+    public function test_page_visible_if_has_permissions_when_book_not_visible()
+    {
+        $book = \BookStack\Book::first();
+        $bookChapter = $book->chapters->first();
+        $bookPage = $bookChapter->pages->first();
+
+        $this->setEntityRestrictions($book, []);
+        $this->setEntityRestrictions($bookPage, ['view']);
+
+        $this->actingAs($this->viewer);
+        $this->get($bookPage->getUrl());
+        $this->assertResponseOk();
+        $this->see($bookPage->name);
+        $this->dontSee(substr($book->name, 0, 15));
+        $this->dontSee(substr($bookChapter->name, 0, 15));
+    }
+
 }