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

Added mass actions for Material design in list view

This commit is contained in:
Nicolas Lœuillet 2020-04-12 16:31:12 +02:00
parent 31e3a233a4
commit 467327771a
No known key found for this signature in database
GPG key ID: 3A8718BE51C3BA8E
9 changed files with 191 additions and 2 deletions

View file

@ -1557,4 +1557,81 @@ class EntryControllerTest extends WallabagCoreTestCase
$this->assertSame(302, $client->getResponse()->getStatusCode());
$this->assertContains('/view/', $client->getResponse()->getTargetUrl(), 'All random');
}
public function testMass()
{
$this->logInAs('admin');
$client = $this->getClient();
$entry1 = new Entry($this->getLoggedInUser());
$entry1->setUrl($this->url);
$this->getEntityManager()->persist($entry1);
$entry2 = new Entry($this->getLoggedInUser());
$entry2->setUrl($this->url);
$this->getEntityManager()->persist($entry2);
$this->getEntityManager()->flush();
$this->getEntityManager()->clear();
$entries = [];
$entries[] = $entry1->getId();
$entries[] = $entry2->getId();
// Mass actions : archive
$client->request('POST', '/mass', [
'toggle-archive' => '',
'entry-checkbox' => $entries,
]);
$this->assertSame(302, $client->getResponse()->getStatusCode());
$res = $client->getContainer()
->get('doctrine.orm.entity_manager')
->getRepository('WallabagCoreBundle:Entry')
->find($entry1->getId());
$this->assertSame(1, $res->isArchived());
$res = $client->getContainer()
->get('doctrine.orm.entity_manager')
->getRepository('WallabagCoreBundle:Entry')
->find($entry2->getId());
$this->assertSame(1, $res->isArchived());
// Mass actions : star
$client->request('POST', '/mass', [
'toggle-star' => '',
'entry-checkbox' => $entries,
]);
$this->assertSame(302, $client->getResponse()->getStatusCode());
$res = $client->getContainer()
->get('doctrine.orm.entity_manager')
->getRepository('WallabagCoreBundle:Entry')
->find($entry1->getId());
$this->assertSame(1, $res->isStarred());
$res = $client->getContainer()
->get('doctrine.orm.entity_manager')
->getRepository('WallabagCoreBundle:Entry')
->find($entry2->getId());
$this->assertSame(1, $res->isStarred());
// Mass actions : delete
$client->request('POST', '/mass', [
'delete' => '',
'entry-checkbox' => $entries,
]);
$client->request('GET', '/delete/' . $entry1->getId());
$this->assertSame(404, $client->getResponse()->getStatusCode());
$client->request('GET', '/delete/' . $entry2->getId());
$this->assertSame(404, $client->getResponse()->getStatusCode());
}
}