X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/8c945034b9f12e728c601502e730d2cfe4c937cf..refs/pull/4554/head:/tests/Api/AttachmentsApiTest.php diff --git a/tests/Api/AttachmentsApiTest.php b/tests/Api/AttachmentsApiTest.php index c295f7384..b03f280ac 100644 --- a/tests/Api/AttachmentsApiTest.php +++ b/tests/Api/AttachmentsApiTest.php @@ -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,