diff options
author | Jeremy Benoist <j0k3r@users.noreply.github.com> | 2016-02-11 16:49:03 +0100 |
---|---|---|
committer | Jeremy Benoist <j0k3r@users.noreply.github.com> | 2016-02-11 16:49:03 +0100 |
commit | 9b5edf33a00490b033692efca9987a35225835ba (patch) | |
tree | 73d3c24ecdeab3b65b1ea2ca2d90fe6d31d5780c /src/Wallabag/CoreBundle/Tests/Controller/TagControllerTest.php | |
parent | 5db084e05b84ac87179336b96b5db9579fa78c67 (diff) | |
parent | e686a76d343a3745c3dfe8010d9e5784e56bb17c (diff) | |
download | wallabag-9b5edf33a00490b033692efca9987a35225835ba.tar.gz wallabag-9b5edf33a00490b033692efca9987a35225835ba.tar.zst wallabag-9b5edf33a00490b033692efca9987a35225835ba.zip |
Merge pull request #1663 from wallabag/v2-remove-tags-from-entry
remove tag from entry #1377
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 | } |