X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=tests%2FWallabag%2FApiBundle%2FController%2FWallabagRestControllerTest.php;fp=tests%2FWallabag%2FApiBundle%2FController%2FWallabagRestControllerTest.php;h=6bca3c8bb9b1931b84bc16394bd5e33eb6f6485b;hb=b1b561da518ae3add4445c46ef8398a314c8de37;hp=79353857c65f29824d706e37559f02117eecb80e;hpb=3f3a60879e168f4a8040c441e295fa63e024961d;p=github%2Fwallabag%2Fwallabag.git diff --git a/tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php b/tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php index 79353857..6bca3c8b 100644 --- a/tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php +++ b/tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php @@ -569,6 +569,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()); @@ -585,6 +587,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() @@ -802,6 +811,22 @@ class WallabagRestControllerTest extends WallabagApiTestCase $this->assertEquals(true, $content['exists']); } + public function testGetEntriesExistsWithManyUrls() + { + $url1 = 'http://0.0.0.0/entry2'; + $url2 = 'http://0.0.0.0/entry10'; + $this->client->request('GET', '/api/entries/exists?urls[]='.$url1.'&urls[]='.$url2); + + $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); + + $content = json_decode($this->client->getResponse()->getContent(), true); + + $this->assertArrayHasKey($url1, $content); + $this->assertArrayHasKey($url2, $content); + $this->assertEquals(true, $content[$url1]); + $this->assertEquals(false, $content[$url2]); + } + public function testGetEntriesExistsWhichDoesNotExists() { $this->client->request('GET', '/api/entries/exists?url=http://google.com/entry2');