]> BookStack Code Mirror - bookstack/blobdiff - tests/Settings/RecycleBinTest.php
respective book and chapter structure added.
[bookstack] / tests / Settings / RecycleBinTest.php
index 990df607e1c14b9f5c37cb6c1f2a488ef77e950b..33284b4b3ff85f2297c024873e5851c2e8544c7f 100644 (file)
@@ -14,7 +14,7 @@ class RecycleBinTest extends TestCase
     public function test_recycle_bin_routes_permissions()
     {
         $page = $this->entities->page();
-        $editor = $this->getEditor();
+        $editor = $this->users->editor();
         $this->actingAs($editor)->delete($page->getUrl());
         $deletion = Deletion::query()->firstOrFail();
 
@@ -33,7 +33,7 @@ class RecycleBinTest extends TestCase
             $this->assertPermissionError($resp);
         }
 
-        $this->giveUserPermissions($editor, ['restrictions-manage-all']);
+        $this->permissions->grantUserRolePermissions($editor, ['restrictions-manage-all']);
 
         foreach ($routes as $route) {
             [$method, $url] = explode(':', $route);
@@ -41,7 +41,7 @@ class RecycleBinTest extends TestCase
             $this->assertPermissionError($resp);
         }
 
-        $this->giveUserPermissions($editor, ['settings-manage']);
+        $this->permissions->grantUserRolePermissions($editor, ['settings-manage']);
 
         foreach ($routes as $route) {
             DB::beginTransaction();
@@ -56,7 +56,7 @@ class RecycleBinTest extends TestCase
     {
         $page = $this->entities->page();
         $book = Book::query()->whereHas('pages')->whereHas('chapters')->withCount(['pages', 'chapters'])->first();
-        $editor = $this->getEditor();
+        $editor = $this->users->editor();
         $this->actingAs($editor)->delete($page->getUrl());
         $this->actingAs($editor)->delete($book->getUrl());
 
@@ -73,7 +73,7 @@ class RecycleBinTest extends TestCase
     {
         $page = $this->entities->page();
         $book = Book::query()->where('id', '!=', $page->book_id)->whereHas('pages')->whereHas('chapters')->with(['pages', 'chapters'])->firstOrFail();
-        $editor = $this->getEditor();
+        $editor = $this->users->editor();
         $this->actingAs($editor)->delete($page->getUrl());
         $this->actingAs($editor)->delete($book->getUrl());
 
@@ -153,22 +153,22 @@ class RecycleBinTest extends TestCase
 
         $this->assertDatabaseHas('activities', [
             'type'        => 'page_delete',
-            'entity_id'   => $page->id,
-            'entity_type' => $page->getMorphClass(),
+            'loggable_id'   => $page->id,
+            'loggable_type' => $page->getMorphClass(),
         ]);
 
         $this->asAdmin()->delete("/settings/recycle-bin/{$deletion->id}");
 
         $this->assertDatabaseMissing('activities', [
             'type'        => 'page_delete',
-            'entity_id'   => $page->id,
-            'entity_type' => $page->getMorphClass(),
+            'loggable_id'   => $page->id,
+            'loggable_type' => $page->getMorphClass(),
         ]);
 
         $this->assertDatabaseHas('activities', [
             'type'        => 'page_delete',
-            'entity_id'   => null,
-            'entity_type' => null,
+            'loggable_id'   => null,
+            'loggable_type' => null,
             'detail'      => $page->name,
         ]);
     }