diff options
author | Kevin Decherf <kevin@kdecherf.com> | 2018-12-29 20:43:34 +0100 |
---|---|---|
committer | Kevin Decherf <kevin@kdecherf.com> | 2018-12-30 01:34:49 +0100 |
commit | 6c40d7fc85b98e335adf765d1c6b4465647da62c (patch) | |
tree | cd039dc92f7a7a0dde5c6ca7484b8a9eefc359ca /tests/Wallabag | |
parent | 2a0e0a47d853937702d235bdb91df0ca0e3116b6 (diff) | |
download | wallabag-6c40d7fc85b98e335adf765d1c6b4465647da62c.tar.gz wallabag-6c40d7fc85b98e335adf765d1c6b4465647da62c.tar.zst wallabag-6c40d7fc85b98e335adf765d1c6b4465647da62c.zip |
TagRestController: fix test for tag without entries
As the deletion now requires that at least one entry for the user must
be linked to the given tag, we fix the test testDeleteUserTag by linking
it to an entry.
Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
Diffstat (limited to 'tests/Wallabag')
-rw-r--r-- | tests/Wallabag/ApiBundle/Controller/TagRestControllerTest.php | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/tests/Wallabag/ApiBundle/Controller/TagRestControllerTest.php b/tests/Wallabag/ApiBundle/Controller/TagRestControllerTest.php index 8f1e6f02..9daa94cd 100644 --- a/tests/Wallabag/ApiBundle/Controller/TagRestControllerTest.php +++ b/tests/Wallabag/ApiBundle/Controller/TagRestControllerTest.php | |||
@@ -32,12 +32,22 @@ class TagRestControllerTest extends WallabagApiTestCase | |||
32 | 32 | ||
33 | public function testDeleteUserTag() | 33 | public function testDeleteUserTag() |
34 | { | 34 | { |
35 | $em = $this->client->getContainer()->get('doctrine.orm.entity_manager'); | ||
36 | $entry = $this->client->getContainer() | ||
37 | ->get('doctrine.orm.entity_manager') | ||
38 | ->getRepository('WallabagCoreBundle:Entry') | ||
39 | ->findOneWithTags($this->user->getId()); | ||
40 | |||
41 | $entry = $entry[0]; | ||
42 | |||
35 | $tagLabel = 'tagtest'; | 43 | $tagLabel = 'tagtest'; |
36 | $tag = new Tag(); | 44 | $tag = new Tag(); |
37 | $tag->setLabel($tagLabel); | 45 | $tag->setLabel($tagLabel); |
38 | |||
39 | $em = $this->client->getContainer()->get('doctrine.orm.entity_manager'); | ||
40 | $em->persist($tag); | 46 | $em->persist($tag); |
47 | |||
48 | $entry->addTag($tag); | ||
49 | |||
50 | $em->persist($entry); | ||
41 | $em->flush(); | 51 | $em->flush(); |
42 | $em->clear(); | 52 | $em->clear(); |
43 | 53 | ||