]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
TagRestController: fix test for tag without entries 3823/head
authorKevin Decherf <kevin@kdecherf.com>
Sat, 29 Dec 2018 19:43:34 +0000 (20:43 +0100)
committerKevin Decherf <kevin@kdecherf.com>
Sun, 30 Dec 2018 00:34:49 +0000 (01:34 +0100)
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>
tests/Wallabag/ApiBundle/Controller/TagRestControllerTest.php

index 8f1e6f02a674431cd992a7ad25c8a1a7d5706b47..9daa94cd5346bf0a99d8cc73e0366666d830f749 100644 (file)
@@ -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();