]> BookStack Code Mirror - bookstack/blobdiff - tests/PublicActionTest.php
Permissions: Updated guest user handling so additional roles apply
[bookstack] / tests / PublicActionTest.php
index 97299f7570b5c21fb5149d5edca59acb8df50ac0..6f0e2f1d3bb4d886684af5e7ee3863926a552460 100644 (file)
@@ -193,4 +193,18 @@ class PublicActionTest extends TestCase
         $resp->assertRedirect($book->getUrl());
         $this->followRedirects($resp)->assertSee($book->name);
     }
+
+    public function test_public_view_can_take_on_other_roles()
+    {
+        $this->setSettings(['app-public' => 'true']);
+        $newRole = $this->users->attachNewRole(User::getDefault(), []);
+        $page = $this->entities->page();
+        $this->permissions->disableEntityInheritedPermissions($page);
+        $this->permissions->addEntityPermission($page, ['view', 'update'], $newRole);
+
+        $resp = $this->get($page->getUrl());
+        $resp->assertOk();
+
+        $this->withHtml($resp)->assertLinkExists($page->getUrl('/edit'));
+    }
 }