X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=tests%2FWallabag%2FCoreBundle%2FController%2FTagControllerTest.php;h=2c32393f74449f373c3a0e168c40dc36ca213cdb;hb=fb479be3a0af95bba45c13b11e1f85bb9c753d25;hp=58450e5fb0933632480e8a7c60e6c30a20efc7a3;hpb=9f8c43e222feb88f18597e42ab0512fda483d46d;p=github%2Fwallabag%2Fwallabag.git diff --git a/tests/Wallabag/CoreBundle/Controller/TagControllerTest.php b/tests/Wallabag/CoreBundle/Controller/TagControllerTest.php index 58450e5f..2c32393f 100644 --- a/tests/Wallabag/CoreBundle/Controller/TagControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/TagControllerTest.php @@ -47,7 +47,7 @@ class TagControllerTest extends WallabagCoreTestCase $this->assertEquals(1, count($entry->getTags())); - # tag already exists and already assigned + // tag already exists and already assigned $client->submit($form, $data); $this->assertEquals(302, $client->getResponse()->getStatusCode()); @@ -58,7 +58,7 @@ class TagControllerTest extends WallabagCoreTestCase $this->assertEquals(1, count($newEntry->getTags())); - # tag already exists but still not assigned to this entry + // tag already exists but still not assigned to this entry $data = [ 'tag[label]' => 'foo', ]; @@ -131,4 +131,35 @@ class TagControllerTest extends WallabagCoreTestCase $this->assertEquals(404, $client->getResponse()->getStatusCode()); } + + public function testShowEntriesForTagAction() + { + $this->logInAs('admin'); + $client = $this->getClient(); + + $entry = $client->getContainer() + ->get('doctrine.orm.entity_manager') + ->getRepository('WallabagCoreBundle:Entry') + ->findOneByUsernameAndNotArchived('admin'); + + $tag = $client->getContainer() + ->get('doctrine.orm.entity_manager') + ->getRepository('WallabagCoreBundle:Tag') + ->findOneByEntryAndTagLabel($entry, 'foo'); + + $crawler = $client->request('GET', '/tag/list/'.$tag->getSlug()); + + $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertCount(2, $crawler->filter('div[class=entry]')); + + $tag = $client->getContainer() + ->get('doctrine.orm.entity_manager') + ->getRepository('WallabagCoreBundle:Tag') + ->findOneByLabel('baz'); + + $crawler = $client->request('GET', '/tag/list/'.$tag->getSlug()); + + $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertCount(0, $crawler->filter('div[class=entry]')); + } }