]> BookStack Code Mirror - bookstack/blobdiff - tests/Entity/ChapterTest.php
Added 'Sort Book' action to chapters
[bookstack] / tests / Entity / ChapterTest.php
index 5a761b94fdb67b5e1fb2f684e57b88aca761b140..d58b83da9cd66a73b50d403c19cc78dc5cc61817 100644 (file)
@@ -146,4 +146,16 @@ class ChapterTest extends TestCase
         $newChapter2 = Chapter::query()->where('name', '=', 'My copied again chapter')->first();
         $this->assertEquals($chapter->pages()->count(), $newChapter2->pages()->count());
     }
+
+    public function test_sort_book_action_visible_if_permissions_allow()
+    {
+        /** @var Chapter $chapter */
+        $chapter = Chapter::query()->first();
+
+        $resp = $this->actingAs($this->getViewer())->get($chapter->getUrl());
+        $this->withHtml($resp)->assertLinkNotExists($chapter->book->getUrl('sort'));
+
+        $resp = $this->asEditor()->get($chapter->getUrl());
+        $this->withHtml($resp)->assertLinkExists($chapter->book->getUrl('sort'));
+    }
 }