]> BookStack Code Mirror - bookstack/blob - tests/ActivityTrackingTest.php
Updated user interfaces for LDAP and added email from LDAP
[bookstack] / tests / ActivityTrackingTest.php
1 <?php
2
3 use Illuminate\Foundation\Testing\WithoutMiddleware;
4 use Illuminate\Foundation\Testing\DatabaseMigrations;
5 use Illuminate\Foundation\Testing\DatabaseTransactions;
6
7 class ActivityTrackingTest extends TestCase
8 {
9
10     public function testRecentlyViewedBooks()
11     {
12         $books = \BookStack\Book::all()->take(10);
13
14         $this->asAdmin()->visit('/books')
15             ->dontSeeInElement('#recents', $books[0]->name)
16             ->dontSeeInElement('#recents', $books[1]->name)
17             ->visit($books[0]->getUrl())
18             ->visit($books[1]->getUrl())
19             ->visit('/books')
20             ->seeInElement('#recents', $books[0]->name)
21             ->seeInElement('#recents', $books[1]->name);
22     }
23
24     public function testPopularBooks()
25     {
26         $books = \BookStack\Book::all()->take(10);
27
28         $this->asAdmin()->visit('/books')
29             ->dontSeeInElement('#popular', $books[0]->name)
30             ->dontSeeInElement('#popular', $books[1]->name)
31             ->visit($books[0]->getUrl())
32             ->visit($books[1]->getUrl())
33             ->visit($books[0]->getUrl())
34             ->visit('/books')
35             ->seeInNthElement('#popular .book', 0, $books[0]->name)
36             ->seeInNthElement('#popular .book', 1, $books[1]->name);
37     }
38 }