]> BookStack Code Mirror - bookstack/blobdiff - tests/Api/AttachmentsApiTest.php
respective book and chapter structure added.
[bookstack] / tests / Api / AttachmentsApiTest.php
index c295f738439c2cd1a5cc53d8d0a6b378207e077c..b03f280ac6784074ab692df20b3ded892d6c8f32 100644 (file)
@@ -50,9 +50,7 @@ class AttachmentsApiTest extends TestCase
             ],
         ]]);
 
-        $page->restricted = true;
-        $page->save();
-        $this->entities->regenPermissions($page);
+        $this->permissions->setEntityPermissions($page, [], []);
 
         $resp = $this->getJson($this->baseEndpoint . '?count=1&sort=+id');
         $resp->assertJsonMissing(['data' => [
@@ -248,13 +246,13 @@ class AttachmentsApiTest extends TestCase
     public function test_attachment_not_visible_on_other_users_draft()
     {
         $this->actingAsApiAdmin();
-        $editor = $this->getEditor();
+        $editor = $this->users->editor();
 
         $page = $this->entities->page();
         $page->draft = true;
         $page->owned_by = $editor->id;
         $page->save();
-        $this->entities->regenPermissions($page);
+        $this->permissions->regenerateForEntity($page);
 
         $attachment = $this->createAttachmentForPage($page, [
             'name'  => 'my attachment',
@@ -344,7 +342,7 @@ class AttachmentsApiTest extends TestCase
 
     protected function createAttachmentForPage(Page $page, $attributes = []): Attachment
     {
-        $admin = $this->getAdmin();
+        $admin = $this->users->admin();
         /** @var Attachment $attachment */
         $attachment = $page->attachments()->forceCreate(array_merge([
             'uploaded_to' => $page->id,