aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Wallabag
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Wallabag')
-rw-r--r--tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php77
1 files changed, 77 insertions, 0 deletions
diff --git a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
index b5655f71..5b806830 100644
--- a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
+++ b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
@@ -1557,4 +1557,81 @@ class EntryControllerTest extends WallabagCoreTestCase
1557 $this->assertSame(302, $client->getResponse()->getStatusCode()); 1557 $this->assertSame(302, $client->getResponse()->getStatusCode());
1558 $this->assertContains('/view/', $client->getResponse()->getTargetUrl(), 'All random'); 1558 $this->assertContains('/view/', $client->getResponse()->getTargetUrl(), 'All random');
1559 } 1559 }
1560
1561 public function testMass()
1562 {
1563 $this->logInAs('admin');
1564 $client = $this->getClient();
1565
1566 $entry1 = new Entry($this->getLoggedInUser());
1567 $entry1->setUrl($this->url);
1568 $this->getEntityManager()->persist($entry1);
1569
1570 $entry2 = new Entry($this->getLoggedInUser());
1571 $entry2->setUrl($this->url);
1572 $this->getEntityManager()->persist($entry2);
1573
1574 $this->getEntityManager()->flush();
1575 $this->getEntityManager()->clear();
1576
1577 $entries = [];
1578 $entries[] = $entry1->getId();
1579 $entries[] = $entry2->getId();
1580
1581 // Mass actions : archive
1582 $client->request('POST', '/mass', [
1583 'toggle-archive' => '',
1584 'entry-checkbox' => $entries,
1585 ]);
1586
1587 $this->assertSame(302, $client->getResponse()->getStatusCode());
1588
1589 $res = $client->getContainer()
1590 ->get('doctrine.orm.entity_manager')
1591 ->getRepository('WallabagCoreBundle:Entry')
1592 ->find($entry1->getId());
1593
1594 $this->assertSame(1, $res->isArchived());
1595
1596 $res = $client->getContainer()
1597 ->get('doctrine.orm.entity_manager')
1598 ->getRepository('WallabagCoreBundle:Entry')
1599 ->find($entry2->getId());
1600
1601 $this->assertSame(1, $res->isArchived());
1602
1603 // Mass actions : star
1604 $client->request('POST', '/mass', [
1605 'toggle-star' => '',
1606 'entry-checkbox' => $entries,
1607 ]);
1608
1609 $this->assertSame(302, $client->getResponse()->getStatusCode());
1610
1611 $res = $client->getContainer()
1612 ->get('doctrine.orm.entity_manager')
1613 ->getRepository('WallabagCoreBundle:Entry')
1614 ->find($entry1->getId());
1615
1616 $this->assertSame(1, $res->isStarred());
1617
1618 $res = $client->getContainer()
1619 ->get('doctrine.orm.entity_manager')
1620 ->getRepository('WallabagCoreBundle:Entry')
1621 ->find($entry2->getId());
1622
1623 $this->assertSame(1, $res->isStarred());
1624
1625 // Mass actions : delete
1626 $client->request('POST', '/mass', [
1627 'delete' => '',
1628 'entry-checkbox' => $entries,
1629 ]);
1630
1631 $client->request('GET', '/delete/' . $entry1->getId());
1632 $this->assertSame(404, $client->getResponse()->getStatusCode());
1633
1634 $client->request('GET', '/delete/' . $entry2->getId());
1635 $this->assertSame(404, $client->getResponse()->getStatusCode());
1636 }
1560} 1637}