1
0
Fork 0
mirror of https://github.com/wallabag/wallabag.git synced 2025-08-01 17:38:38 +00:00

Added annotated filter

This commit is contained in:
Nicolas Lœuillet 2021-08-02 16:57:42 +02:00 committed by Jeremy Benoist
parent 6dfc031839
commit cd975c5f13
No known key found for this signature in database
GPG key ID: BCA73962457ACC3C
4 changed files with 63 additions and 5 deletions

View file

@ -3,6 +3,7 @@
namespace Tests\Wallabag\CoreBundle\Controller;
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
use Wallabag\AnnotationBundle\Entity\Annotation;
use Wallabag\CoreBundle\Entity\Config;
use Wallabag\CoreBundle\Entity\Entry;
use Wallabag\CoreBundle\Entity\SiteCredential;
@ -888,6 +889,44 @@ class EntryControllerTest extends WallabagCoreTestCase
$this->assertCount(0, $crawler->filter('li.entry'));
}
public function testFilterOnAnnotatedStatus()
{
$this->logInAs('admin');
$client = $this->getClient();
$crawler = $client->request('GET', '/all/list');
$form = $crawler->filter('button[id=submit-filter]')->form();
$data = [
'entry_filter[isAnnotated]' => true,
];
$crawler = $client->submit($form, $data);
$this->assertCount(2, $crawler->filter('li.entry'));
$entry = new Entry($this->getLoggedInUser());
$entry->setUrl($this->url);
$em = $this->getClient()->getContainer()->get('doctrine.orm.entity_manager');
$user = $em
->getRepository('WallabagUserBundle:User')
->findOneByUserName('admin');
$annotation = new Annotation($user);
$annotation->setEntry($entry);
$annotation->setText('This is my annotation /o/');
$annotation->setQuote('content');
$this->getEntityManager()->persist($entry);
$this->getEntityManager()->flush();
$crawler = $client->submit($form, $data);
$this->assertCount(3, $crawler->filter('li.entry'));
}
public function testPaginationWithFilter()
{
$this->logInAs('admin');