diff options
Diffstat (limited to 'tests/Wallabag/CoreBundle/Controller/TagControllerTest.php')
-rw-r--r-- | tests/Wallabag/CoreBundle/Controller/TagControllerTest.php | 35 |
1 files changed, 33 insertions, 2 deletions
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 | |||
47 | 47 | ||
48 | $this->assertEquals(1, count($entry->getTags())); | 48 | $this->assertEquals(1, count($entry->getTags())); |
49 | 49 | ||
50 | # tag already exists and already assigned | 50 | // tag already exists and already assigned |
51 | $client->submit($form, $data); | 51 | $client->submit($form, $data); |
52 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 52 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); |
53 | 53 | ||
@@ -58,7 +58,7 @@ class TagControllerTest extends WallabagCoreTestCase | |||
58 | 58 | ||
59 | $this->assertEquals(1, count($newEntry->getTags())); | 59 | $this->assertEquals(1, count($newEntry->getTags())); |
60 | 60 | ||
61 | # tag already exists but still not assigned to this entry | 61 | // tag already exists but still not assigned to this entry |
62 | $data = [ | 62 | $data = [ |
63 | 'tag[label]' => 'foo', | 63 | 'tag[label]' => 'foo', |
64 | ]; | 64 | ]; |
@@ -131,4 +131,35 @@ class TagControllerTest extends WallabagCoreTestCase | |||
131 | 131 | ||
132 | $this->assertEquals(404, $client->getResponse()->getStatusCode()); | 132 | $this->assertEquals(404, $client->getResponse()->getStatusCode()); |
133 | } | 133 | } |
134 | |||
135 | public function testShowEntriesForTagAction() | ||
136 | { | ||
137 | $this->logInAs('admin'); | ||
138 | $client = $this->getClient(); | ||
139 | |||
140 | $entry = $client->getContainer() | ||
141 | ->get('doctrine.orm.entity_manager') | ||
142 | ->getRepository('WallabagCoreBundle:Entry') | ||
143 | ->findOneByUsernameAndNotArchived('admin'); | ||
144 | |||
145 | $tag = $client->getContainer() | ||
146 | ->get('doctrine.orm.entity_manager') | ||
147 | ->getRepository('WallabagCoreBundle:Tag') | ||
148 | ->findOneByEntryAndTagLabel($entry, 'foo'); | ||
149 | |||
150 | $crawler = $client->request('GET', '/tag/list/'.$tag->getSlug()); | ||
151 | |||
152 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | ||
153 | $this->assertCount(2, $crawler->filter('div[class=entry]')); | ||
154 | |||
155 | $tag = $client->getContainer() | ||
156 | ->get('doctrine.orm.entity_manager') | ||
157 | ->getRepository('WallabagCoreBundle:Tag') | ||
158 | ->findOneByLabel('baz'); | ||
159 | |||
160 | $crawler = $client->request('GET', '/tag/list/'.$tag->getSlug()); | ||
161 | |||
162 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | ||
163 | $this->assertCount(0, $crawler->filter('div[class=entry]')); | ||
164 | } | ||
134 | } | 165 | } |