mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-11-23 20:09:01 +08:00
38 lines
1.1 KiB
PHP
38 lines
1.1 KiB
PHP
<?php namespace Tests;
|
|
|
|
|
|
use BookStack\Entities\Book;
|
|
|
|
class ActivityTrackingTest extends BrowserKitTest
|
|
{
|
|
|
|
public function test_recently_viewed_books()
|
|
{
|
|
$books = Book::all()->take(10);
|
|
|
|
$this->asAdmin()->visit('/books')
|
|
->dontSeeInElement('#recents', $books[0]->name)
|
|
->dontSeeInElement('#recents', $books[1]->name)
|
|
->visit($books[0]->getUrl())
|
|
->visit($books[1]->getUrl())
|
|
->visit('/books')
|
|
->seeInElement('#recents', $books[0]->name)
|
|
->seeInElement('#recents', $books[1]->name);
|
|
}
|
|
|
|
public function test_popular_books()
|
|
{
|
|
$books = Book::all()->take(10);
|
|
|
|
$this->asAdmin()->visit('/books')
|
|
->dontSeeInElement('#popular', $books[0]->name)
|
|
->dontSeeInElement('#popular', $books[1]->name)
|
|
->visit($books[0]->getUrl())
|
|
->visit($books[1]->getUrl())
|
|
->visit($books[0]->getUrl())
|
|
->visit('/books')
|
|
->seeInNthElement('#popular .book', 0, $books[0]->name)
|
|
->seeInNthElement('#popular .book', 1, $books[1]->name);
|
|
}
|
|
}
|