]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php
Ensure orphan tag are remove in API
[github/wallabag/wallabag.git] / tests / Wallabag / ApiBundle / Controller / WallabagRestControllerTest.php
index 65b65290c2e83731c0e535b11f9ff673fa35406b..c797daf7aa3a9444e87df384fe87a4eb9f4c3789 100644 (file)
@@ -561,6 +561,8 @@ class WallabagRestControllerTest extends WallabagApiTestCase
      */
     public function testDeleteUserTag($tag)
     {
+        $tagName = $tag['label'];
+
         $this->client->request('DELETE', '/api/tags/'.$tag['id'].'.json');
 
         $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
@@ -577,6 +579,13 @@ class WallabagRestControllerTest extends WallabagApiTestCase
             ->findAllByTagId($this->user->getId(), $tag['id']);
 
         $this->assertCount(0, $entries);
+
+        $tag = $this->client->getContainer()
+            ->get('doctrine.orm.entity_manager')
+            ->getRepository('WallabagCoreBundle:Tag')
+            ->findOneByLabel($tagName);
+
+        $this->assertNull($tag, $tagName.' was removed because it begun an orphan tag');
     }
 
     public function testDeleteTagByLabel()