1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-28 17:02:04 +03:00

Moved more tests out of EntityTest

This commit is contained in:
Dan Brown
2021-09-15 22:18:37 +01:00
parent 121a746d59
commit de8cceb0f7
6 changed files with 138 additions and 128 deletions

View 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 */