]> BookStack Code Mirror - bookstack/blobdiff - tests/Entity/ConvertTest.php
Opensearch: Fixed XML declaration when php short tags enabled
[bookstack] / tests / Entity / ConvertTest.php
index 16dd890683640499ed0f5ba33c3b669b478a7c26..d9b1ee466cf1db9656cfd922d7bbdefa585c613d 100644 (file)
@@ -2,8 +2,8 @@
 
 namespace Tests\Entity;
 
-use BookStack\Actions\ActivityType;
-use BookStack\Actions\Tag;
+use BookStack\Activity\ActivityType;
+use BookStack\Activity\Models\Tag;
 use BookStack\Entities\Models\Book;
 use BookStack\Entities\Models\Bookshelf;
 use BookStack\Entities\Models\Chapter;
@@ -42,6 +42,7 @@ class ConvertTest extends TestCase
         $this->assertEquals('Penguins', $newBook->tags->first()->value);
         $this->assertEquals($chapter->name, $newBook->name);
         $this->assertEquals($chapter->description, $newBook->description);
+        $this->assertEquals($chapter->description_html, $newBook->description_html);
 
         $this->assertActivityExists(ActivityType::BOOK_CREATE_FROM_CHAPTER, $newBook);
     }
@@ -49,16 +50,16 @@ class ConvertTest extends TestCase
     public function test_convert_chapter_to_book_requires_permissions()
     {
         $chapter = $this->entities->chapter();
-        $user = $this->getViewer();
+        $user = $this->users->viewer();
 
         $permissions = ['chapter-delete-all', 'book-create-all', 'chapter-update-all'];
-        $this->giveUserPermissions($user, $permissions);
+        $this->permissions->grantUserRolePermissions($user, $permissions);
 
         foreach ($permissions as $permission) {
-            $this->removePermissionFromUser($user, $permission);
+            $this->permissions->removeUserRolePermissions($user, [$permission]);
             $resp = $this->actingAs($user)->post($chapter->getUrl('/convert-to-book'));
             $this->assertPermissionError($resp);
-            $this->giveUserPermissions($user, [$permission]);
+            $this->permissions->grantUserRolePermissions($user, [$permission]);
         }
 
         $resp = $this->actingAs($user)->post($chapter->getUrl('/convert-to-book'));
@@ -105,6 +106,7 @@ class ConvertTest extends TestCase
         $this->assertEquals('Ducks', $newShelf->tags->first()->value);
         $this->assertEquals($book->name, $newShelf->name);
         $this->assertEquals($book->description, $newShelf->description);
+        $this->assertEquals($book->description_html, $newShelf->description_html);
         $this->assertEquals($newShelf->books()->count(), $bookChapterCount + 1);
         $this->assertEquals($systemBookCount + $bookChapterCount, Book::query()->count());
         $this->assertActivityExists(ActivityType::BOOKSHELF_CREATE_FROM_BOOK, $newShelf);
@@ -122,16 +124,16 @@ class ConvertTest extends TestCase
     public function test_book_convert_to_shelf_requires_permissions()
     {
         $book = $this->entities->book();
-        $user = $this->getViewer();
+        $user = $this->users->viewer();
 
         $permissions = ['book-delete-all', 'bookshelf-create-all', 'book-update-all', 'book-create-all'];
-        $this->giveUserPermissions($user, $permissions);
+        $this->permissions->grantUserRolePermissions($user, $permissions);
 
         foreach ($permissions as $permission) {
-            $this->removePermissionFromUser($user, $permission);
+            $this->permissions->removeUserRolePermissions($user, [$permission]);
             $resp = $this->actingAs($user)->post($book->getUrl('/convert-to-shelf'));
             $this->assertPermissionError($resp);
-            $this->giveUserPermissions($user, [$permission]);
+            $this->permissions->grantUserRolePermissions($user, [$permission]);
         }
 
         $resp = $this->actingAs($user)->post($book->getUrl('/convert-to-shelf'));