From: Kevin Decherf Date: Sat, 29 Dec 2018 19:43:34 +0000 (+0100) Subject: TagRestController: fix test for tag without entries X-Git-Tag: 2.3.6~8^2 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=6c40d7fc85b98e335adf765d1c6b4465647da62c;p=github%2Fwallabag%2Fwallabag.git 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 --- 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 public function testDeleteUserTag() { + $em = $this->client->getContainer()->get('doctrine.orm.entity_manager'); + $entry = $this->client->getContainer() + ->get('doctrine.orm.entity_manager') + ->getRepository('WallabagCoreBundle:Entry') + ->findOneWithTags($this->user->getId()); + + $entry = $entry[0]; + $tagLabel = 'tagtest'; $tag = new Tag(); $tag->setLabel($tagLabel); - - $em = $this->client->getContainer()->get('doctrine.orm.entity_manager'); $em->persist($tag); + + $entry->addTag($tag); + + $em->persist($entry); $em->flush(); $em->clear();