]> BookStack Code Mirror - bookstack/blobdiff - tests/Entity/SortTest.php
Moved more tests out of EntityTest
[bookstack] / tests / Entity / SortTest.php
index e058b39aa143a50559823ea308479b1269bff62b..5cfc5c3c5b935f9f2396fc38b4bf0521bfed1b6f 100644 (file)
@@ -216,6 +216,19 @@ class SortTest extends TestCase
         $this->assertEquals($newBook->id, $pageToCheck->book_id);
     }
 
+    public function test_book_sort_page_shows()
+    {
+        /** @var Book $bookToSort */
+        $bookToSort = Book::query()->first();
+
+        $resp = $this->asAdmin()->get($bookToSort->getUrl());
+        $resp->assertElementExists('a[href="' . $bookToSort->getUrl('/sort') . '"]');
+
+        $resp = $this->get($bookToSort->getUrl('/sort'));
+        $resp->assertStatus(200);
+        $resp->assertSee($bookToSort->name);
+    }
+
     public function test_book_sort()
     {
         $oldBook = Book::query()->first();
@@ -259,6 +272,21 @@ class SortTest extends TestCase
         $checkResp->assertSee($newBook->name);
     }
 
+    public function test_book_sort_item_returns_book_content()
+    {
+        $books = Book::all();
+        $bookToSort = $books[0];
+        $firstPage = $bookToSort->pages[0];
+        $firstChapter = $bookToSort->chapters[0];
+
+        $resp = $this->asAdmin()->get($bookToSort->getUrl() . '/sort-item');
+
+        // Ensure book details are returned
+        $resp->assertSee($bookToSort->name);
+        $resp->assertSee($firstPage->name);
+        $resp->assertSee($firstChapter->name);
+    }
+
     public function test_pages_in_book_show_sorted_by_priority()
     {
         /** @var Book $book */