]> BookStack Code Mirror - bookstack/blob - tests/PublicViewTest.php
Updated user interfaces for LDAP and added email from LDAP
[bookstack] / tests / PublicViewTest.php
1 <?php
2
3 class PublicViewTest extends TestCase
4 {
5
6     public function testBooksViewable()
7     {
8         $this->setSettings(['app-public' => 'true']);
9         $books = \BookStack\Book::orderBy('name', 'asc')->take(10)->get();
10         $bookToVisit = $books[1];
11
12         // Check books index page is showing
13         $this->visit('/books')
14             ->seeStatusCode(200)
15             ->see($books[0]->name)
16             // Check indavidual book page is showing and it's child contents are visible.
17             ->click($bookToVisit->name)
18             ->seePageIs($bookToVisit->getUrl())
19             ->see($bookToVisit->name)
20             ->see($bookToVisit->chapters()->first()->name);
21     }
22
23     public function testChaptersViewable()
24     {
25         $this->setSettings(['app-public' => 'true']);
26         $chapterToVisit = \BookStack\Chapter::first();
27         $pageToVisit = $chapterToVisit->pages()->first();
28
29         // Check chapters index page is showing
30         $this->visit($chapterToVisit->getUrl())
31             ->seeStatusCode(200)
32             ->see($chapterToVisit->name)
33             // Check indavidual chapter page is showing and it's child contents are visible.
34             ->see($pageToVisit->name)
35             ->click($pageToVisit->name)
36             ->see($chapterToVisit->book->name)
37             ->see($chapterToVisit->name)
38             ->seePageIs($pageToVisit->getUrl());
39     }
40
41 }