X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=tests%2FWallabag%2FApiBundle%2FController%2FTagRestControllerTest.php;h=90b132ebecbf4600c1d341d6f7027ad76cfbffca;hb=d181bd728565454ec53d960f321ed0a4c3bf26c8;hp=bde5251f5d32ddca62a3fa5c18ce85e3bd52a2dd;hpb=267087d969e68e2f5abcb18f526120d835d9a686;p=github%2Fwallabag%2Fwallabag.git diff --git a/tests/Wallabag/ApiBundle/Controller/TagRestControllerTest.php b/tests/Wallabag/ApiBundle/Controller/TagRestControllerTest.php index bde5251f..90b132eb 100644 --- a/tests/Wallabag/ApiBundle/Controller/TagRestControllerTest.php +++ b/tests/Wallabag/ApiBundle/Controller/TagRestControllerTest.php @@ -54,7 +54,18 @@ class TagRestControllerTest extends WallabagApiTestCase $this->assertNull($tag, $tagName.' was removed because it begun an orphan tag'); } - public function testDeleteTagByLabel() + public function dataForDeletingTagByLabel() + { + return [ + 'by_query' => [true], + 'by_body' => [false], + ]; + } + + /** + * @dataProvider dataForDeletingTagByLabel + */ + public function testDeleteTagByLabel($useQueryString) { $em = $this->client->getContainer()->get('doctrine.orm.entity_manager'); $entry = $this->client->getContainer() @@ -73,7 +84,11 @@ class TagRestControllerTest extends WallabagApiTestCase $em->persist($entry); $em->flush(); - $this->client->request('DELETE', '/api/tag/label.json', ['tag' => $tag->getLabel()]); + if ($useQueryString) { + $this->client->request('DELETE', '/api/tag/label.json?tag='.$tag->getLabel()); + } else { + $this->client->request('DELETE', '/api/tag/label.json', ['tag' => $tag->getLabel()]); + } $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); @@ -98,7 +113,10 @@ class TagRestControllerTest extends WallabagApiTestCase $this->assertEquals(404, $this->client->getResponse()->getStatusCode()); } - public function testDeleteTagsByLabel() + /** + * @dataProvider dataForDeletingTagByLabel + */ + public function testDeleteTagsByLabel($useQueryString) { $em = $this->client->getContainer()->get('doctrine.orm.entity_manager'); $entry = $this->client->getContainer() @@ -122,7 +140,11 @@ class TagRestControllerTest extends WallabagApiTestCase $em->persist($entry); $em->flush(); - $this->client->request('DELETE', '/api/tags/label.json', ['tags' => $tag->getLabel().','.$tag2->getLabel()]); + if ($useQueryString) { + $this->client->request('DELETE', '/api/tags/label.json?tags='.$tag->getLabel().','.$tag2->getLabel()); + } else { + $this->client->request('DELETE', '/api/tags/label.json', ['tags' => $tag->getLabel().','.$tag2->getLabel()]); + } $this->assertEquals(200, $this->client->getResponse()->getStatusCode());