filters: add test for status filter and adapt other tests results

This commit is contained in:
Nicolas Lœuillet 2015-08-20 17:59:58 +02:00
parent 89659c9eae
commit e177976099
2 changed files with 31 additions and 2 deletions

View file

@ -21,7 +21,7 @@
{% if entries is empty %}
<div class="messages warning"><p>{% trans %}No articles found.{% endtrans %}</p></div>
{% else %}
<div><form>{{ form_rest(form) }}<button class="btn waves-effect waves-light" type="submit" id="submit-filter" value="filter">Filter</button></form></div>
<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>
{% for entry in entries %}
<div id="entry-{{ entry.id|e }}" class="entry">
<h2><a href="{{ path('view', { 'id': entry.id }) }}">{{ entry.title|raw }}</a></h2>

View file

@ -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]'));
}
}