]> BookStack Code Mirror - bookstack/blobdiff - tests/Permissions/EntityOwnerChangeTest.php
Added more complexity in an attempt to make ldap host failover fit
[bookstack] / tests / Permissions / EntityOwnerChangeTest.php
index 2f06bff2e8e766cb360826ec436b2321a55715f9..e94759760ce90fd7306314e3fffcb5a8c2996300 100644 (file)
@@ -1,19 +1,15 @@
-<?php namespace Tests\Permissions;
+<?php
+
+namespace Tests\Permissions;
 
 use BookStack\Auth\User;
-use BookStack\Entities\Models\Book;
-use BookStack\Entities\Models\Bookshelf;
-use BookStack\Entities\Models\Chapter;
-use BookStack\Entities\Models\Page;
-use Illuminate\Support\Str;
 use Tests\TestCase;
 
 class EntityOwnerChangeTest extends TestCase
 {
-
     public function test_changing_page_owner()
     {
-        $page = Page::query()->first();
+        $page = $this->entities->page();
         $user = User::query()->where('id', '!=', $page->owned_by)->first();
 
         $this->asAdmin()->put($page->getUrl('permissions'), ['owned_by' => $user->id]);
@@ -22,7 +18,7 @@ class EntityOwnerChangeTest extends TestCase
 
     public function test_changing_chapter_owner()
     {
-        $chapter = Chapter::query()->first();
+        $chapter = $this->entities->chapter();
         $user = User::query()->where('id', '!=', $chapter->owned_by)->first();
 
         $this->asAdmin()->put($chapter->getUrl('permissions'), ['owned_by' => $user->id]);
@@ -31,7 +27,7 @@ class EntityOwnerChangeTest extends TestCase
 
     public function test_changing_book_owner()
     {
-        $book = Book::query()->first();
+        $book = $this->entities->book();
         $user = User::query()->where('id', '!=', $book->owned_by)->first();
 
         $this->asAdmin()->put($book->getUrl('permissions'), ['owned_by' => $user->id]);
@@ -40,11 +36,10 @@ class EntityOwnerChangeTest extends TestCase
 
     public function test_changing_shelf_owner()
     {
-        $shelf = Bookshelf::query()->first();
+        $shelf = $this->entities->shelf();
         $user = User::query()->where('id', '!=', $shelf->owned_by)->first();
 
         $this->asAdmin()->put($shelf->getUrl('permissions'), ['owned_by' => $user->id]);
         $this->assertDatabaseHas('bookshelves', ['owned_by' => $user->id, 'id' => $shelf->id]);
     }
-
-}
\ No newline at end of file
+}