X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/cdb1c7ef88a0054c46ba9eb040464bdea274b095..refs/pull/945/head:/tests/Permissions/RestrictionsTest.php diff --git a/tests/Permissions/RestrictionsTest.php b/tests/Permissions/RestrictionsTest.php index 53e7ad3f3..2bbb1a5fa 100644 --- a/tests/Permissions/RestrictionsTest.php +++ b/tests/Permissions/RestrictionsTest.php @@ -592,4 +592,26 @@ class RestrictionsTest extends BrowserKitTest ->see('You do not have permission') ->seePageIs('/'); } + + public function test_can_create_page_if_chapter_has_permissions_when_book_not_visible() + { + $book = Book::first(); + $this->setEntityRestrictions($book, []); + $bookChapter = $book->chapters->first(); + $this->setEntityRestrictions($bookChapter, ['view']); + + $this->actingAs($this->user)->visit($bookChapter->getUrl()) + ->dontSee('New Page'); + + $this->setEntityRestrictions($bookChapter, ['view', 'create']); + + $this->actingAs($this->user)->visit($bookChapter->getUrl()) + ->click('New Page') + ->seeStatusCode(200) + ->type('test page', 'name') + ->type('test content', 'html') + ->press('Save Page') + ->seePageIs($book->getUrl('/page/test-page')) + ->seeStatusCode(200); + } }