tests: replace baggy theme used in EntryController tests

Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
This commit is contained in:
Kevin Decherf 2020-03-21 21:09:57 +01:00
parent 7fc38f667b
commit ef81e3c89b
2 changed files with 33 additions and 46 deletions

View file

@ -39,7 +39,7 @@
<ul class="{% if listMode == 1 %}collection{% else %}row data{% endif %}">
{% for entry in entries %}
<li id="entry-{{ entry.id|e }}" class="col {% if listMode == 0 %}l3 m6{% else %}collection-item{% endif %} s12">
<li id="entry-{{ entry.id|e }}" class="entry col {% if listMode == 0 %}l3 m6{% else %}collection-item{% endif %} s12">
{% if listMode == 1 %}
{% include "@WallabagCore/themes/material/Entry/_card_list.html.twig" with {'entry': entry} only %}
{% elseif not entry.previewPicture is null and entry.mimetype starts with 'image/' %}

View file

@ -90,19 +90,18 @@ class EntryControllerTest extends WallabagCoreTestCase
public function testPostNewViaBookmarklet()
{
$this->logInAs('admin');
$this->useTheme('baggy');
$client = $this->getClient();
$crawler = $client->request('GET', '/');
$this->assertCount(4, $crawler->filter('div[class=entry]'));
$this->assertCount(4, $crawler->filter('li.entry'));
// Good URL
$client->request('GET', '/bookmarklet', ['url' => $this->url]);
$this->assertSame(302, $client->getResponse()->getStatusCode());
$client->followRedirect();
$crawler = $client->request('GET', '/');
$this->assertCount(5, $crawler->filter('div[class=entry]'));
$this->assertCount(5, $crawler->filter('li.entry'));
$em = $client->getContainer()
->get('doctrine.orm.entity_manager');
@ -694,7 +693,6 @@ class EntryControllerTest extends WallabagCoreTestCase
public function testFilterOnReadingTime()
{
$this->logInAs('admin');
$this->useTheme('baggy');
$client = $this->getClient();
$entry = new Entry($this->getLoggedInUser());
$entry->setUrl($this->url);
@ -713,7 +711,7 @@ class EntryControllerTest extends WallabagCoreTestCase
$crawler = $client->submit($form, $data);
$this->assertCount(1, $crawler->filter('div[class=entry]'));
$this->assertCount(1, $crawler->filter('li.entry'));
}
public function testFilterOnReadingTimeWithNegativeValue()
@ -733,17 +731,16 @@ class EntryControllerTest extends WallabagCoreTestCase
$crawler = $client->submit($form, $data);
// forcing negative value results in no entry displayed
$this->assertCount(0, $crawler->filter('div[class=entry]'));
$this->assertCount(0, $crawler->filter('li.entry'));
}
public function testFilterOnReadingTimeOnlyUpper()
{
$this->logInAs('admin');
$this->useTheme('baggy');
$client = $this->getClient();
$crawler = $client->request('GET', '/all/list');
$this->assertCount(5, $crawler->filter('div[class=entry]'));
$this->assertCount(5, $crawler->filter('li.entry'));
$entry = new Entry($this->getLoggedInUser());
$entry->setUrl($this->url);
@ -752,7 +749,7 @@ class EntryControllerTest extends WallabagCoreTestCase
$this->getEntityManager()->flush();
$crawler = $client->request('GET', '/all/list');
$this->assertCount(6, $crawler->filter('div[class=entry]'));
$this->assertCount(6, $crawler->filter('li.entry'));
$form = $crawler->filter('button[id=submit-filter]')->form();
@ -762,13 +759,12 @@ class EntryControllerTest extends WallabagCoreTestCase
$crawler = $client->submit($form, $data);
$this->assertCount(5, $crawler->filter('div[class=entry]'));
$this->assertCount(5, $crawler->filter('li.entry'));
}
public function testFilterOnReadingTimeOnlyLower()
{
$this->logInAs('admin');
$this->useTheme('baggy');
$client = $this->getClient();
$crawler = $client->request('GET', '/unread/list');
@ -781,7 +777,7 @@ class EntryControllerTest extends WallabagCoreTestCase
$crawler = $client->submit($form, $data);
$this->assertCount(0, $crawler->filter('div[class=entry]'));
$this->assertCount(0, $crawler->filter('li.entry'));
$entry = new Entry($this->getLoggedInUser());
$entry->setUrl($this->url);
@ -790,13 +786,12 @@ class EntryControllerTest extends WallabagCoreTestCase
$this->getEntityManager()->flush();
$crawler = $client->submit($form, $data);
$this->assertCount(1, $crawler->filter('div[class=entry]'));
$this->assertCount(1, $crawler->filter('li.entry'));
}
public function testFilterOnUnreadStatus()
{
$this->logInAs('admin');
$this->useTheme('baggy');
$client = $this->getClient();
$crawler = $client->request('GET', '/all/list');
@ -809,7 +804,7 @@ class EntryControllerTest extends WallabagCoreTestCase
$crawler = $client->submit($form, $data);
$this->assertCount(4, $crawler->filter('div[class=entry]'));
$this->assertCount(4, $crawler->filter('li.entry'));
$entry = new Entry($this->getLoggedInUser());
$entry->setUrl($this->url);
@ -819,13 +814,12 @@ class EntryControllerTest extends WallabagCoreTestCase
$crawler = $client->submit($form, $data);
$this->assertCount(5, $crawler->filter('div[class=entry]'));
$this->assertCount(5, $crawler->filter('li.entry'));
}
public function testFilterOnCreationDate()
{
$this->logInAs('admin');
$this->useTheme('baggy');
$client = $this->getClient();
$crawler = $client->request('GET', '/unread/list');
@ -839,7 +833,7 @@ class EntryControllerTest extends WallabagCoreTestCase
$crawler = $client->submit($form, $data);
$this->assertCount(5, $crawler->filter('div[class=entry]'));
$this->assertCount(5, $crawler->filter('li.entry'));
$data = [
'entry_filter[createdAt][left_date]' => date('d/m/Y'),
@ -848,7 +842,7 @@ class EntryControllerTest extends WallabagCoreTestCase
$crawler = $client->submit($form, $data);
$this->assertCount(5, $crawler->filter('div[class=entry]'));
$this->assertCount(5, $crawler->filter('li.entry'));
$data = [
'entry_filter[createdAt][left_date]' => '01/01/1970',
@ -857,7 +851,7 @@ class EntryControllerTest extends WallabagCoreTestCase
$crawler = $client->submit($form, $data);
$this->assertCount(0, $crawler->filter('div[class=entry]'));
$this->assertCount(0, $crawler->filter('li.entry'));
}
public function testPaginationWithFilter()
@ -892,7 +886,6 @@ class EntryControllerTest extends WallabagCoreTestCase
public function testFilterOnDomainName()
{
$this->logInAs('admin');
$this->useTheme('baggy');
$client = $this->getClient();
$crawler = $client->request('GET', '/unread/list');
@ -902,7 +895,7 @@ class EntryControllerTest extends WallabagCoreTestCase
];
$crawler = $client->submit($form, $data);
$this->assertCount(5, $crawler->filter('div[class=entry]'));
$this->assertCount(5, $crawler->filter('li.entry'));
$crawler = $client->request('GET', '/unread/list');
$form = $crawler->filter('button[id=submit-filter]')->form();
@ -911,7 +904,7 @@ class EntryControllerTest extends WallabagCoreTestCase
];
$crawler = $client->submit($form, $data);
$this->assertCount(5, $crawler->filter('div[class=entry]'));
$this->assertCount(5, $crawler->filter('li.entry'));
$form = $crawler->filter('button[id=submit-filter]')->form();
$data = [
@ -919,13 +912,12 @@ class EntryControllerTest extends WallabagCoreTestCase
];
$crawler = $client->submit($form, $data);
$this->assertCount(0, $crawler->filter('div[class=entry]'));
$this->assertCount(0, $crawler->filter('li.entry'));
}
public function testFilterOnStatus()
{
$this->logInAs('admin');
$this->useTheme('baggy');
$client = $this->getClient();
$crawler = $client->request('GET', '/unread/list');
@ -934,20 +926,19 @@ class EntryControllerTest extends WallabagCoreTestCase
$form['entry_filter[isStarred]']->untick();
$crawler = $client->submit($form);
$this->assertCount(1, $crawler->filter('div[class=entry]'));
$this->assertCount(1, $crawler->filter('li.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]'));
$this->assertCount(1, $crawler->filter('li.entry'));
}
public function testFilterOnIsPublic()
{
$this->logInAs('admin');
$this->useTheme('baggy');
$client = $this->getClient();
$crawler = $client->request('GET', '/unread/list');
@ -955,13 +946,12 @@ class EntryControllerTest extends WallabagCoreTestCase
$form['entry_filter[isPublic]']->tick();
$crawler = $client->submit($form);
$this->assertCount(0, $crawler->filter('div[class=entry]'));
$this->assertCount(0, $crawler->filter('li.entry'));
}
public function testPreviewPictureFilter()
{
$this->logInAs('admin');
$this->useTheme('baggy');
$client = $this->getClient();
$crawler = $client->request('GET', '/unread/list');
@ -969,13 +959,12 @@ class EntryControllerTest extends WallabagCoreTestCase
$form['entry_filter[previewPicture]']->tick();
$crawler = $client->submit($form);
$this->assertCount(1, $crawler->filter('div[class=entry]'));
$this->assertCount(1, $crawler->filter('li.entry'));
}
public function testFilterOnLanguage()
{
$this->logInAs('admin');
$this->useTheme('baggy');
$client = $this->getClient();
$entry = new Entry($this->getLoggedInUser());
@ -991,7 +980,7 @@ class EntryControllerTest extends WallabagCoreTestCase
];
$crawler = $client->submit($form, $data);
$this->assertCount(3, $crawler->filter('div[class=entry]'));
$this->assertCount(3, $crawler->filter('li.entry'));
$form = $crawler->filter('button[id=submit-filter]')->form();
$data = [
@ -999,7 +988,7 @@ class EntryControllerTest extends WallabagCoreTestCase
];
$crawler = $client->submit($form, $data);
$this->assertCount(2, $crawler->filter('div[class=entry]'));
$this->assertCount(2, $crawler->filter('li.entry'));
}
public function testShareEntryPublicly()
@ -1181,7 +1170,6 @@ class EntryControllerTest extends WallabagCoreTestCase
public function testFilterOnHttpStatus()
{
$this->logInAs('admin');
$this->useTheme('baggy');
$client = $this->getClient();
$entry = new Entry($this->getLoggedInUser());
@ -1200,7 +1188,7 @@ class EntryControllerTest extends WallabagCoreTestCase
$crawler = $client->submit($form, $data);
$this->assertCount(1, $crawler->filter('div[class=entry]'));
$this->assertCount(1, $crawler->filter('li.entry'));
$entry = new Entry($this->getLoggedInUser());
$entry->setUrl($this->url);
@ -1223,7 +1211,7 @@ class EntryControllerTest extends WallabagCoreTestCase
$crawler = $client->submit($form, $data);
$this->assertCount(2, $crawler->filter('div[class=entry]'));
$this->assertCount(2, $crawler->filter('li.entry'));
$crawler = $client->request('GET', '/all/list');
$form = $crawler->filter('button[id=submit-filter]')->form();
@ -1234,13 +1222,12 @@ class EntryControllerTest extends WallabagCoreTestCase
$crawler = $client->submit($form, $data);
$this->assertCount(8, $crawler->filter('div[class=entry]'));
$this->assertCount(8, $crawler->filter('li.entry'));
}
public function testSearch()
{
$this->logInAs('admin');
$this->useTheme('baggy');
$client = $this->getClient();
$entry = new Entry($this->getLoggedInUser());
@ -1259,7 +1246,7 @@ class EntryControllerTest extends WallabagCoreTestCase
$crawler = $client->submit($form, $data);
$this->assertCount(4, $crawler->filter('div[class=entry]'));
$this->assertCount(4, $crawler->filter('li.entry'));
// Search on starred list
$crawler = $client->request('GET', '/starred/list');
@ -1278,7 +1265,7 @@ class EntryControllerTest extends WallabagCoreTestCase
$crawler = $client->submit($form, $data);
$this->assertCount(1, $crawler->filter('div[class=entry]'));
$this->assertCount(1, $crawler->filter('li.entry'));
$crawler = $client->request('GET', '/archive/list');
@ -1297,7 +1284,7 @@ class EntryControllerTest extends WallabagCoreTestCase
$crawler = $client->submit($form, $data);
$this->assertCount(1, $crawler->filter('div[class=entry]'));
$this->assertCount(1, $crawler->filter('li.entry'));
$client->request('GET', '/delete/' . $entry->getId());
// test on list of all articles
@ -1310,7 +1297,7 @@ class EntryControllerTest extends WallabagCoreTestCase
$crawler = $client->submit($form, $data);
$this->assertCount(0, $crawler->filter('div[class=entry]'));
$this->assertCount(0, $crawler->filter('li.entry'));
// test url search on list of all articles
$entry = new Entry($this->getLoggedInUser());
@ -1329,7 +1316,7 @@ class EntryControllerTest extends WallabagCoreTestCase
$crawler = $client->submit($form, $data);
$this->assertCount(1, $crawler->filter('div[class=entry]'));
$this->assertCount(1, $crawler->filter('li.entry'));
// same as previous test but for case-sensitivity
$crawler = $client->request('GET', '/all/list');
@ -1341,7 +1328,7 @@ class EntryControllerTest extends WallabagCoreTestCase
$crawler = $client->submit($form, $data);
$this->assertCount(1, $crawler->filter('div[class=entry]'));
$this->assertCount(1, $crawler->filter('li.entry'));
}
public function dataForLanguage()