]> BookStack Code Mirror - bookstack/blob - tests/ActivityTrackingTest.php
Apply fixes from StyleCI
[bookstack] / tests / ActivityTrackingTest.php
1 <?php
2
3 namespace Tests;
4
5 use BookStack\Entities\Models\Book;
6
7 class ActivityTrackingTest extends BrowserKitTest
8 {
9     public function test_recently_viewed_books()
10     {
11         $books = Book::all()->take(10);
12
13         $this->asAdmin()->visit('/books')
14             ->dontSeeInElement('#recents', $books[0]->name)
15             ->dontSeeInElement('#recents', $books[1]->name)
16             ->visit($books[0]->getUrl())
17             ->visit($books[1]->getUrl())
18             ->visit('/books')
19             ->seeInElement('#recents', $books[0]->name)
20             ->seeInElement('#recents', $books[1]->name);
21     }
22
23     public function test_popular_books()
24     {
25         $books = Book::all()->take(10);
26
27         $this->asAdmin()->visit('/books')
28             ->dontSeeInElement('#popular', $books[0]->name)
29             ->dontSeeInElement('#popular', $books[1]->name)
30             ->visit($books[0]->getUrl())
31             ->visit($books[1]->getUrl())
32             ->visit($books[0]->getUrl())
33             ->visit('/books')
34             ->seeInNthElement('#popular .book', 0, $books[0]->name)
35             ->seeInNthElement('#popular .book', 1, $books[1]->name);
36     }
37 }