From e1779760999f676cb7a74a201bc2a389959702d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Thu, 20 Aug 2015 17:59:58 +0200 Subject: [PATCH] filters: add test for status filter and adapt other tests results --- .../Resources/views/Entry/entries.html.twig | 2 +- .../Tests/Controller/EntryControllerTest.php | 31 ++++++++++++++++++- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/src/Wallabag/CoreBundle/Resources/views/Entry/entries.html.twig b/src/Wallabag/CoreBundle/Resources/views/Entry/entries.html.twig index a794df0e5..118a2f4be 100644 --- a/src/Wallabag/CoreBundle/Resources/views/Entry/entries.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/Entry/entries.html.twig @@ -21,7 +21,7 @@ {% if entries is empty %}

{% trans %}No articles found.{% endtrans %}

{% else %} -
{{ form_rest(form) }}
+
{{ form_rest(form) }}
{% for entry in entries %}

{{ entry.title|raw }}

diff --git a/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php index 86a19f616..5f0a60763 100644 --- a/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php +++ b/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php @@ -276,7 +276,7 @@ class EntryControllerTest extends WallabagCoreTestCase $crawler = $client->submit($form, $data); - $this->assertCount(4, $crawler->filter('div[class=entry]')); + $this->assertCount(5, $crawler->filter('div[class=entry]')); $data = array( 'entry_filter[createdAt][left_date]' => '01/01/1970', @@ -307,6 +307,14 @@ class EntryControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', 'unread/list'.$parameters); $this->assertContains($parameters, $client->getResponse()->getContent()); + + // reset pagination + $crawler = $client->request('GET', '/config'); + $form = $crawler->filter('button[id=config_save]')->form(); + $data = array( + 'config[items_per_page]' => '12', + ); + $client->submit($form, $data); } public function testFilterOnDomainName() @@ -331,4 +339,25 @@ class EntryControllerTest extends WallabagCoreTestCase $crawler = $client->submit($form, $data); $this->assertCount(0, $crawler->filter('div[class=entry]')); } + + public function testFilterOnStatus() + { + $this->logInAs('admin'); + $client = $this->getClient(); + + $crawler = $client->request('GET', '/unread/list'); + $form = $crawler->filter('button[id=submit-filter]')->form(); + $form['entry_filter[isArchived]']->tick(); + $form['entry_filter[isStarred]']->untick(); + + $crawler = $client->submit($form); + $this->assertCount(1, $crawler->filter('div[class=entry]')); + + $form = $crawler->filter('button[id=submit-filter]')->form(); + $form['entry_filter[isArchived]']->untick(); + $form['entry_filter[isStarred]']->tick(); + + $crawler = $client->submit($form); + $this->assertCount(1, $crawler->filter('div[class=entry]')); + } }