class EntityTest extends TestCase
{
- public function testEntityCreation()
+ public function test_entity_creation()
{
// Test Creation
return \BookStack\Book::find($book->id);
}
- public function testBookSortPageShows()
+ public function test_book_sort_page_shows()
{
$books = \BookStack\Book::all();
$bookToSort = $books[0];
->see($books[1]->name);
}
- public function testBookSortItemReturnsBookContent()
+ public function test_book_sort_item_returns_book_content()
{
$books = \BookStack\Book::all();
$bookToSort = $books[0];
return $book;
}
- public function testPageSearch()
+ public function test_page_search()
{
$book = \BookStack\Book::all()->first();
$page = $book->pages->first();
->seePageIs($page->getUrl());
}
+ public function test_invalid_page_search()
+ {
+ $this->asAdmin()
+ ->visit('/')
+ ->type('<p>test</p>', 'term')
+ ->press('header-search-box-button')
+ ->see('Search Results')
+ ->seeStatusCode(200);
+ }
+
+ public function test_empty_search_redirects_back()
+ {
+ $this->asAdmin()
+ ->visit('/')
+ ->visit('/search/all')
+ ->seePageIs('/');
+ }
+
+ public function test_book_search()
+ {
+ $book = \BookStack\Book::all()->first();
+ $page = $book->pages->last();
+ $chapter = $book->chapters->last();
+
+ $this->asAdmin()
+ ->visit('/search/book/' . $book->id . '?term=' . urlencode($page->name))
+ ->see($page->name)
+
+ ->visit('/search/book/' . $book->id . '?term=' . urlencode($chapter->name))
+ ->see($chapter->name);
+ }
+
+ public function test_empty_book_search_redirects_back()
+ {
+ $book = \BookStack\Book::all()->first();
+ $this->asAdmin()
+ ->visit('/books')
+ ->visit('/search/book/' . $book->id . '?term=')
+ ->seePageIs('/books');
+ }
+
- public function testEntitiesViewableAfterCreatorDeletion()
+ public function test_entities_viewable_after_creator_deletion()
{
// Create required assets and revisions
$creator = $this->getNewUser();
$this->checkEntitiesViewable($entities);
}
- public function testEntitiesViewableAfterUpdaterDeletion()
+ public function test_entities_viewable_after_updater_deletion()
{
// Create required assets and revisions
$creator = $this->getNewUser();