-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed crash on public entitiy viewing
- Loading branch information
1 parent
9969698
commit 5e21ecc
Showing
2 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
class PublicViewTest extends TestCase | ||
{ | ||
|
||
public function testBooksViewable() | ||
{ | ||
$this->setSettings(['app-public' => 'true']); | ||
$books = \BookStack\Book::orderBy('name', 'asc')->take(10)->get(); | ||
$bookToVisit = $books[1]; | ||
|
||
// Check books index page is showing | ||
$this->visit('/books') | ||
->seeStatusCode(200) | ||
->see($books[0]->name) | ||
// Check indavidual book page is showing and it's child contents are visible. | ||
->click($bookToVisit->name) | ||
->seePageIs($bookToVisit->getUrl()) | ||
->see($bookToVisit->name) | ||
->see($bookToVisit->chapters()->first()->name); | ||
} | ||
|
||
public function testChaptersViewable() | ||
{ | ||
$this->setSettings(['app-public' => 'true']); | ||
$chapterToVisit = \BookStack\Chapter::first(); | ||
$pageToVisit = $chapterToVisit->pages()->first(); | ||
|
||
// Check chapters index page is showing | ||
$this->visit($chapterToVisit->getUrl()) | ||
->seeStatusCode(200) | ||
->see($chapterToVisit->name) | ||
// Check indavidual chapter page is showing and it's child contents are visible. | ||
->see($pageToVisit->name) | ||
->click($pageToVisit->name) | ||
->see($chapterToVisit->book->name) | ||
->see($chapterToVisit->name) | ||
->seePageIs($pageToVisit->getUrl()); | ||
} | ||
|
||
} |