X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=tests%2FWallabag%2FApiBundle%2FController%2FWallabagRestControllerTest.php;h=5dcb3e000dac75d68f0026851856dcdc0692973b;hb=9c1547069178e8395ce4d43eac760d61e03aa2b0;hp=65b65290c2e83731c0e535b11f9ff673fa35406b;hpb=9d127b3b9365c73bc393bc303545f24c159cee31;p=github%2Fwallabag%2Fwallabag.git diff --git a/tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php b/tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php index 65b65290..5dcb3e00 100644 --- a/tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php +++ b/tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php @@ -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() @@ -794,6 +803,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');