aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2015-08-20 17:59:58 +0200
committerNicolas LÅ“uillet <nicolas@loeuillet.org>2015-08-21 07:30:48 +0200
commite1779760999f676cb7a74a201bc2a389959702d4 (patch)
treeeded736468a27083aebc725ba9e133fc6c7d7ab2 /src
parent89659c9eae338cd29e5919b5ffde6924189a59ca (diff)
downloadwallabag-e1779760999f676cb7a74a201bc2a389959702d4.tar.gz
wallabag-e1779760999f676cb7a74a201bc2a389959702d4.tar.zst
wallabag-e1779760999f676cb7a74a201bc2a389959702d4.zip
filters: add test for status filter and adapt other tests results
Diffstat (limited to 'src')
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/Entry/entries.html.twig2
-rw-r--r--src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php31
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 a794df0e..118a2f4b 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 @@
21 {% if entries is empty %} 21 {% if entries is empty %}
22 <div class="messages warning"><p>{% trans %}No articles found.{% endtrans %}</p></div> 22 <div class="messages warning"><p>{% trans %}No articles found.{% endtrans %}</p></div>
23 {% else %} 23 {% else %}
24 <div><form>{{ form_rest(form) }}<button class="btn waves-effect waves-light" type="submit" id="submit-filter" value="filter">Filter</button></form></div> 24 <div><form action="{{ path('all') }}">{{ form_rest(form) }}<button class="btn waves-effect waves-light" type="submit" id="submit-filter" value="filter">Filter</button></form></div>
25 {% for entry in entries %} 25 {% for entry in entries %}
26 <div id="entry-{{ entry.id|e }}" class="entry"> 26 <div id="entry-{{ entry.id|e }}" class="entry">
27 <h2><a href="{{ path('view', { 'id': entry.id }) }}">{{ entry.title|raw }}</a></h2> 27 <h2><a href="{{ path('view', { 'id': entry.id }) }}">{{ entry.title|raw }}</a></h2>
diff --git a/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php
index 86a19f61..5f0a6076 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
276 276
277 $crawler = $client->submit($form, $data); 277 $crawler = $client->submit($form, $data);
278 278
279 $this->assertCount(4, $crawler->filter('div[class=entry]')); 279 $this->assertCount(5, $crawler->filter('div[class=entry]'));
280 280
281 $data = array( 281 $data = array(
282 'entry_filter[createdAt][left_date]' => '01/01/1970', 282 'entry_filter[createdAt][left_date]' => '01/01/1970',
@@ -307,6 +307,14 @@ class EntryControllerTest extends WallabagCoreTestCase
307 $crawler = $client->request('GET', 'unread/list'.$parameters); 307 $crawler = $client->request('GET', 'unread/list'.$parameters);
308 308
309 $this->assertContains($parameters, $client->getResponse()->getContent()); 309 $this->assertContains($parameters, $client->getResponse()->getContent());
310
311 // reset pagination
312 $crawler = $client->request('GET', '/config');
313 $form = $crawler->filter('button[id=config_save]')->form();
314 $data = array(
315 'config[items_per_page]' => '12',
316 );
317 $client->submit($form, $data);
310 } 318 }
311 319
312 public function testFilterOnDomainName() 320 public function testFilterOnDomainName()
@@ -331,4 +339,25 @@ class EntryControllerTest extends WallabagCoreTestCase
331 $crawler = $client->submit($form, $data); 339 $crawler = $client->submit($form, $data);
332 $this->assertCount(0, $crawler->filter('div[class=entry]')); 340 $this->assertCount(0, $crawler->filter('div[class=entry]'));
333 } 341 }
342
343 public function testFilterOnStatus()
344 {
345 $this->logInAs('admin');
346 $client = $this->getClient();
347
348 $crawler = $client->request('GET', '/unread/list');
349 $form = $crawler->filter('button[id=submit-filter]')->form();
350 $form['entry_filter[isArchived]']->tick();
351 $form['entry_filter[isStarred]']->untick();
352
353 $crawler = $client->submit($form);
354 $this->assertCount(1, $crawler->filter('div[class=entry]'));
355
356 $form = $crawler->filter('button[id=submit-filter]')->form();
357 $form['entry_filter[isArchived]']->untick();
358 $form['entry_filter[isStarred]']->tick();
359
360 $crawler = $client->submit($form);
361 $this->assertCount(1, $crawler->filter('div[class=entry]'));
362 }
334} 363}