]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
Fixed tests again
[github/wallabag/wallabag.git] / tests / Wallabag / CoreBundle / Controller / EntryControllerTest.php
index a8ab53dacb726928006a5ed397a056402953d4a5..502ab5f91d2d55e2f78d41d96711215018e51667 100644 (file)
@@ -40,6 +40,9 @@ class EntryControllerTest extends WallabagCoreTestCase
         $this->assertContains('login', $client->getResponse()->headers->get('location'));
     }
 
+    /**
+     * @group NetworkCalls
+     */
     public function testQuickstart()
     {
         $this->logInAs('empty');
@@ -87,22 +90,24 @@ class EntryControllerTest extends WallabagCoreTestCase
         $this->assertCount(1, $crawler->filter('form[name=entry]'));
     }
 
+    /**
+     * @group NetworkCalls
+     */
     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');
@@ -132,7 +137,7 @@ class EntryControllerTest extends WallabagCoreTestCase
     }
 
     /**
-     * This test will require an internet connection.
+     * @group NetworkCalls
      */
     public function testPostNewOk()
     {
@@ -170,6 +175,9 @@ class EntryControllerTest extends WallabagCoreTestCase
         $client->getContainer()->get('craue_config')->set('store_article_headers', 0);
     }
 
+    /**
+     * @group NetworkCalls
+     */
     public function testPostWithMultipleAuthors()
     {
         $url = 'https://www.liberation.fr/planete/2017/04/05/donald-trump-et-xi-jinping-tentative-de-flirt-en-floride_1560768';
@@ -199,8 +207,8 @@ class EntryControllerTest extends WallabagCoreTestCase
         $authors = $content->getPublishedBy();
         $this->assertSame('2017-04-05 19:26:13', $content->getPublishedAt()->format('Y-m-d H:i:s'));
         $this->assertSame('fr', $content->getLanguage());
-        $this->assertSame('Raphaël Balenieri, correspondant à Pékin', $authors[0]);
-        $this->assertSame('Frédéric Autran, correspondant à New York', $authors[1]);
+        $this->assertSame('Raphaël Balenieri', $authors[0]);
+        $this->assertSame('Frédéric Autran', $authors[1]);
     }
 
     public function testPostNewOkUrlExist()
@@ -230,6 +238,9 @@ class EntryControllerTest extends WallabagCoreTestCase
         $this->assertContains('/view/', $client->getResponse()->getTargetUrl());
     }
 
+    /**
+     * @group NetworkCalls
+     */
     public function testPostNewOkUrlExistWithAccent()
     {
         $this->logInAs('admin');
@@ -266,7 +277,7 @@ class EntryControllerTest extends WallabagCoreTestCase
     }
 
     /**
-     * This test will require an internet connection.
+     * @group NetworkCalls
      */
     public function testPostNewOkUrlExistWithRedirection()
     {
@@ -304,7 +315,7 @@ class EntryControllerTest extends WallabagCoreTestCase
     }
 
     /**
-     * This test will require an internet connection.
+     * @group NetworkCalls
      */
     public function testPostNewThatWillBeTagged()
     {
@@ -431,7 +442,7 @@ class EntryControllerTest extends WallabagCoreTestCase
     }
 
     /**
-     * This test will require an internet connection.
+     * @group NetworkCalls
      */
     public function testReload()
     {
@@ -528,7 +539,7 @@ class EntryControllerTest extends WallabagCoreTestCase
 
         $this->assertGreaterThan(1, $title = $crawler->filter('div[id=article] h1')->extract(['_text']));
         $this->assertContains('My updated title hehe :)', $title[0]);
-        $this->assertGreaterThan(1, $stats = $crawler->filter('div[class=tools] ul[class=stats] li a[class=tool]')->extract(['_text']));
+        $this->assertGreaterThan(1, $stats = $crawler->filter('div[class="tools grey-text"] ul[class=stats] li a[class="tool grey-text"]')->extract(['_text']));
         $this->assertContains('example.io', trim($stats[1]));
     }
 
@@ -563,7 +574,7 @@ class EntryControllerTest extends WallabagCoreTestCase
         $this->assertGreaterThan(1, $title);
         $this->assertContains('My updated title hehe :)', $title[0]);
 
-        $stats = $crawler->filter('div[class=tools] ul[class=stats] li a[class=tool]')->extract(['_text']);
+        $stats = $crawler->filter('div[class="tools grey-text"] ul[class=stats] li a[class="tool grey-text"]')->extract(['_text']);
         $this->assertCount(1, $stats);
         $this->assertNotContains('example.io', trim($stats[0]));
     }
@@ -694,7 +705,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 +723,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 +743,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 +761,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 +771,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 +789,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 +798,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 +816,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,45 +826,56 @@ 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();
 
+        $em = $this->getEntityManager();
+
+        $today = new \DateTimeImmutable();
+        $tomorrow = $today->add(new \DateInterval('P1D'));
+        $yesterday = $today->sub(new \DateInterval('P1D'));
+
+        $entry = new Entry($this->getLoggedInUser());
+        $entry->setUrl('http://0.0.0.0/testFilterOnCreationDate');
+        $entry->setCreatedAt($yesterday);
+        $em->persist($entry);
+        $em->flush();
+
         $crawler = $client->request('GET', '/unread/list');
 
         $form = $crawler->filter('button[id=submit-filter]')->form();
 
         $data = [
-            'entry_filter[createdAt][left_date]' => date('d/m/Y'),
-            'entry_filter[createdAt][right_date]' => date('d/m/Y', strtotime('+1 day')),
+            'entry_filter[createdAt][left_date]' => $today->format('Y-m-d'),
+            'entry_filter[createdAt][right_date]' => $tomorrow->format('Y-m-d'),
         ];
 
         $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'),
-            'entry_filter[createdAt][right_date]' => date('d/m/Y'),
+            'entry_filter[createdAt][left_date]' => $today->format('Y-m-d'),
+            'entry_filter[createdAt][right_date]' => $today->format('Y-m-d'),
         ];
 
         $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',
-            'entry_filter[createdAt][right_date]' => '01/01/1970',
+            'entry_filter[createdAt][left_date]' => '1970-01-01',
+            'entry_filter[createdAt][right_date]' => '1970-01-01',
         ];
 
         $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 +910,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 +919,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 +928,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 +936,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 +950,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 +970,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 +983,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 +1004,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 +1012,248 @@ 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 testSortOnTitle()
+    {
+        $this->logInAs('admin');
+        $client = $this->getClient();
+
+        $crawler = $client->request('GET', '/unread/list');
+        $form = $crawler->filter('button[id=submit-sort]')->form();
+        $data = [
+            'entry_sort[sortType]' => 'title',
+            'entry_sort[sortOrder]' => 'asc',
+        ];
+        $crawler = $client->submit($form, $data);
+
+        $this->assertCount(4, $crawler->filter('li.entry'));
+
+        $matches = [];
+        preg_match_all('/test title entry([0-9])/', $client->getResponse()->getContent(), $matches);
+
+        $results = array_values(array_unique($matches[0]));
+
+        $ids = [1, 2, 4, 5];
+
+        foreach ($results as $key => $result) {
+            $this->assertSame('test title entry' . $ids[$key], $result);
+        }
+
+        $ids = array_reverse($ids);
+
+        $crawler = $client->request('GET', '/unread/list');
+        $form = $crawler->filter('button[id=submit-sort]')->form();
+        $data = [
+            'entry_sort[sortType]' => 'title',
+            'entry_sort[sortOrder]' => 'desc',
+        ];
+        $crawler = $client->submit($form, $data);
+
+        $matches = [];
+        preg_match_all('/test title entry([0-9])/', $client->getResponse()->getContent(), $matches);
+
+        $results = array_values(array_unique($matches[0]));
+
+        foreach ($results as $key => $result) {
+            $this->assertSame('test title entry' . $ids[$key], $result);
+        }
+    }
+
+    public function testSortOnCreationDate()
+    {
+        $this->logInAs('admin');
+        $client = $this->getClient();
+
+        $entry1 = new Entry($this->getLoggedInUser());
+        $entry1->setTitle('test title entry7');
+        $entry1->setCreatedAt(new \DateTime('2013-04-03T13:37:00'));
+        $this->getEntityManager()->persist($entry1);
+
+        $entry2 = new Entry($this->getLoggedInUser());
+        $entry2->setTitle('test title entry8');
+        $entry2->setCreatedAt(new \DateTime('2012-04-03T13:37:00'));
+        $this->getEntityManager()->persist($entry2);
+
+        $entry3 = new Entry($this->getLoggedInUser());
+        $entry3->setTitle('test title entry9');
+        $entry3->setCreatedAt(new \DateTime('2014-04-03T13:37:00'));
+        $this->getEntityManager()->persist($entry3);
+
+        $this->getEntityManager()->flush();
+
+        $crawler = $client->request('GET', '/unread/list');
+        $form = $crawler->filter('button[id=submit-sort]')->form();
+        $data = [
+            'entry_sort[sortType]' => 'createdAt',
+            'entry_sort[sortOrder]' => 'asc',
+        ];
+        $crawler = $client->submit($form, $data);
+
+        $this->assertCount(7, $crawler->filter('li.entry'));
+
+        $matches = [];
+        preg_match_all('/test title entry([0-9])/', $client->getResponse()->getContent(), $matches);
+
+        $results = array_values(array_unique($matches[0]));
+
+        $ids = [8, 7, 9, 1, 2, 4, 5];
+
+        foreach ($results as $key => $result) {
+            $this->assertSame('test title entry' . $ids[$key], $result);
+        }
+
+        $ids = array_reverse($ids);
+
+        $crawler = $client->request('GET', '/unread/list');
+        $form = $crawler->filter('button[id=submit-sort]')->form();
+        $data = [
+            'entry_sort[sortType]' => 'createdAt',
+            'entry_sort[sortOrder]' => 'desc',
+        ];
+        $crawler = $client->submit($form, $data);
+
+        $matches = [];
+        preg_match_all('/test title entry([0-9])/', $client->getResponse()->getContent(), $matches);
+
+        $results = array_values(array_unique($matches[0]));
+
+        foreach ($results as $key => $result) {
+            $this->assertSame('test title entry' . $ids[$key], $result);
+        }
+    }
+
+    public function testSortOnStarredDate()
+    {
+        $this->logInAs('admin');
+        $client = $this->getClient();
+
+        $entry1 = new Entry($this->getLoggedInUser());
+        $entry1->setTitle('test title entry7');
+        $entry1->setStarred(true);
+        $entry1->setStarredAt(new \DateTime('2013-04-03T13:37:00'));
+        $this->getEntityManager()->persist($entry1);
+
+        $entry2 = new Entry($this->getLoggedInUser());
+        $entry2->setTitle('test title entry8');
+        $entry2->setStarred(true);
+        $entry2->setStarredAt(new \DateTime('2012-04-03T13:37:00'));
+        $this->getEntityManager()->persist($entry2);
+
+        $entry3 = new Entry($this->getLoggedInUser());
+        $entry3->setTitle('test title entry9');
+        $entry3->setStarred(true);
+        $entry3->setStarredAt(new \DateTime('2014-04-03T13:37:00'));
+        $this->getEntityManager()->persist($entry3);
+
+        $this->getEntityManager()->flush();
+
+        $crawler = $client->request('GET', '/starred/list');
+        $form = $crawler->filter('button[id=submit-sort]')->form();
+        $data = [
+            'entry_sort[sortType]' => 'starredAt',
+            'entry_sort[sortOrder]' => 'asc',
+        ];
+        $crawler = $client->submit($form, $data);
+
+        $this->assertCount(4, $crawler->filter('li.entry'));
+
+        $matches = [];
+        preg_match_all('/test title entry([0-9])/', $client->getResponse()->getContent(), $matches);
+
+        $results = array_values(array_unique($matches[0]));
+
+        $ids = [8, 7, 9, 5];
+
+        foreach ($results as $key => $result) {
+            $this->assertSame('test title entry' . $ids[$key], $result);
+        }
+
+        $ids = array_reverse($ids);
+
+        $crawler = $client->request('GET', '/starred/list');
+        $form = $crawler->filter('button[id=submit-sort]')->form();
+        $data = [
+            'entry_sort[sortType]' => 'starredAt',
+            'entry_sort[sortOrder]' => 'desc',
+        ];
+        $crawler = $client->submit($form, $data);
+
+        $matches = [];
+        preg_match_all('/test title entry([0-9])/', $client->getResponse()->getContent(), $matches);
+
+        $results = array_values(array_unique($matches[0]));
+
+        foreach ($results as $key => $result) {
+            $this->assertSame('test title entry' . $ids[$key], $result);
+        }
+    }
+
+    public function testSortOnArchivedDate()
+    {
+        $this->logInAs('admin');
+        $client = $this->getClient();
+
+        $entry1 = new Entry($this->getLoggedInUser());
+        $entry1->setTitle('test title entry7');
+        $entry1->setArchived(true);
+        $entry1->setArchivedAt(new \DateTime('2010-04-03T13:37:00'));
+        $this->getEntityManager()->persist($entry1);
+
+        $entry2 = new Entry($this->getLoggedInUser());
+        $entry2->setTitle('test title entry8');
+        $entry2->setArchived(true);
+        $entry2->setArchivedAt(new \DateTime('2000-04-03T13:37:00'));
+        $this->getEntityManager()->persist($entry2);
+
+        $entry3 = new Entry($this->getLoggedInUser());
+        $entry3->setTitle('test title entry9');
+        $entry3->setArchived(true);
+        $entry3->setArchivedAt(new \DateTime('2020-04-03T13:37:00'));
+        $this->getEntityManager()->persist($entry3);
+
+        $this->getEntityManager()->flush();
+
+        $crawler = $client->request('GET', '/archive/list');
+        $form = $crawler->filter('button[id=submit-sort]')->form();
+        $data = [
+            'entry_sort[sortType]' => 'archivedAt',
+            'entry_sort[sortOrder]' => 'asc',
+        ];
+        $crawler = $client->submit($form, $data);
+
+        $this->assertCount(4, $crawler->filter('li.entry'));
+
+        $matches = [];
+        preg_match_all('/test title entry([0-9])/', $client->getResponse()->getContent(), $matches);
+
+        $results = array_values(array_unique($matches[0]));
+
+        $ids = [8, 7, 9, 6];
+
+        foreach ($results as $key => $result) {
+            $this->assertSame('test title entry' . $ids[$key], $result);
+        }
+
+        $ids = array_reverse($ids);
+
+        $crawler = $client->request('GET', '/archive/list');
+        $form = $crawler->filter('button[id=submit-sort]')->form();
+        $data = [
+            'entry_sort[sortType]' => 'archivedAt',
+            'entry_sort[sortOrder]' => 'desc',
+        ];
+        $crawler = $client->submit($form, $data);
+
+        $matches = [];
+        preg_match_all('/test title entry([0-9])/', $client->getResponse()->getContent(), $matches);
+
+        $results = array_values(array_unique($matches[0]));
+
+        foreach ($results as $key => $result) {
+            $this->assertSame('test title entry' . $ids[$key], $result);
+        }
     }
 
     public function testShareEntryPublicly()
@@ -1055,6 +1309,9 @@ class EntryControllerTest extends WallabagCoreTestCase
         $this->assertSame(404, $client->getResponse()->getStatusCode());
     }
 
+    /**
+     * @group NetworkCalls
+     */
     public function testNewEntryWithDownloadImagesEnabled()
     {
         $this->downloadImagesEnabled = true;
@@ -1181,7 +1438,6 @@ class EntryControllerTest extends WallabagCoreTestCase
     public function testFilterOnHttpStatus()
     {
         $this->logInAs('admin');
-        $this->useTheme('baggy');
         $client = $this->getClient();
 
         $entry = new Entry($this->getLoggedInUser());
@@ -1200,7 +1456,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 +1479,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 +1490,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 +1514,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 +1533,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 +1552,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 +1565,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 +1584,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 +1596,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()
@@ -1360,7 +1615,7 @@ class EntryControllerTest extends WallabagCoreTestCase
                 'de',
             ],
             'it' => [
-                'http://www.ansa.it/sito/notizie/mondo/europa/2017/06/08/voto-gb-seggi-aperti-misure-sicurezza-rafforzate_0cb71f7f-e23b-4d5f-95ca-bc12296419f0.html',
+                'https://www.ansa.it/sito/notizie/mondo/europa/2017/06/08/voto-gb-seggi-aperti-misure-sicurezza-rafforzate_0cb71f7f-e23b-4d5f-95ca-bc12296419f0.html',
                 'it',
             ],
             'zh_CN' => [
@@ -1384,6 +1639,7 @@ class EntryControllerTest extends WallabagCoreTestCase
 
     /**
      * @dataProvider dataForLanguage
+     * @group NetworkCalls
      */
     public function testLanguageValidation($url, $expectedLanguage)
     {
@@ -1415,7 +1671,7 @@ class EntryControllerTest extends WallabagCoreTestCase
     }
 
     /**
-     * This test will require an internet connection.
+     * @group NetworkCalls
      */
     public function testRestrictedArticle()
     {
@@ -1558,4 +1814,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());
+    }
 }