diff options
Diffstat (limited to 'src/Wallabag/CoreBundle/Tests/Controller/TagControllerTest.php')
-rw-r--r-- | src/Wallabag/CoreBundle/Tests/Controller/TagControllerTest.php | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/src/Wallabag/CoreBundle/Tests/Controller/TagControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/TagControllerTest.php index dc93dd6b..d6391282 100644 --- a/src/Wallabag/CoreBundle/Tests/Controller/TagControllerTest.php +++ b/src/Wallabag/CoreBundle/Tests/Controller/TagControllerTest.php | |||
@@ -6,6 +6,8 @@ use Wallabag\CoreBundle\Tests\WallabagCoreTestCase; | |||
6 | 6 | ||
7 | class TagControllerTest extends WallabagCoreTestCase | 7 | class TagControllerTest extends WallabagCoreTestCase |
8 | { | 8 | { |
9 | public $tagName = 'opensource'; | ||
10 | |||
9 | public function testList() | 11 | public function testList() |
10 | { | 12 | { |
11 | $this->logInAs('admin'); | 13 | $this->logInAs('admin'); |
@@ -31,7 +33,7 @@ class TagControllerTest extends WallabagCoreTestCase | |||
31 | $form = $crawler->filter('button[id=tag_save]')->form(); | 33 | $form = $crawler->filter('button[id=tag_save]')->form(); |
32 | 34 | ||
33 | $data = array( | 35 | $data = array( |
34 | 'tag[label]' => 'opensource', | 36 | 'tag[label]' => $this->tagName, |
35 | ); | 37 | ); |
36 | 38 | ||
37 | $client->submit($form, $data); | 39 | $client->submit($form, $data); |
@@ -65,4 +67,30 @@ class TagControllerTest extends WallabagCoreTestCase | |||
65 | 67 | ||
66 | $this->assertEquals(2, count($newEntry->getTags())); | 68 | $this->assertEquals(2, count($newEntry->getTags())); |
67 | } | 69 | } |
70 | |||
71 | public function testRemoveTagFromEntry() | ||
72 | { | ||
73 | $this->logInAs('admin'); | ||
74 | $client = $this->getClient(); | ||
75 | |||
76 | $entry = $client->getContainer() | ||
77 | ->get('doctrine.orm.entity_manager') | ||
78 | ->getRepository('WallabagCoreBundle:Entry') | ||
79 | ->findOneByUsernameAndNotArchived('admin'); | ||
80 | |||
81 | $tag = $client->getContainer() | ||
82 | ->get('doctrine.orm.entity_manager') | ||
83 | ->getRepository('WallabagCoreBundle:Tag') | ||
84 | ->findOneByEntryAndTagLabel($entry, $this->tagName); | ||
85 | |||
86 | $client->request('GET', '/remove-tag/'.$entry->getId().'/'.$tag->getId()); | ||
87 | |||
88 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | ||
89 | |||
90 | $this->assertNotContains($this->tagName, $entry->getTags()); | ||
91 | |||
92 | $client->request('GET', '/remove-tag/'.$entry->getId().'/'.$tag->getId()); | ||
93 | |||
94 | $this->assertEquals(404, $client->getResponse()->getStatusCode()); | ||
95 | } | ||
68 | } | 96 | } |