diff options
Diffstat (limited to 'tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php')
-rw-r--r-- | tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php | 25 |
1 files changed, 25 insertions, 0 deletions
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 | |||
569 | */ | 569 | */ |
570 | public function testDeleteUserTag($tag) | 570 | public function testDeleteUserTag($tag) |
571 | { | 571 | { |
572 | $tagName = $tag['label']; | ||
573 | |||
572 | $this->client->request('DELETE', '/api/tags/'.$tag['id'].'.json'); | 574 | $this->client->request('DELETE', '/api/tags/'.$tag['id'].'.json'); |
573 | 575 | ||
574 | $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); | 576 | $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); |
@@ -585,6 +587,13 @@ class WallabagRestControllerTest extends WallabagApiTestCase | |||
585 | ->findAllByTagId($this->user->getId(), $tag['id']); | 587 | ->findAllByTagId($this->user->getId(), $tag['id']); |
586 | 588 | ||
587 | $this->assertCount(0, $entries); | 589 | $this->assertCount(0, $entries); |
590 | |||
591 | $tag = $this->client->getContainer() | ||
592 | ->get('doctrine.orm.entity_manager') | ||
593 | ->getRepository('WallabagCoreBundle:Tag') | ||
594 | ->findOneByLabel($tagName); | ||
595 | |||
596 | $this->assertNull($tag, $tagName.' was removed because it begun an orphan tag'); | ||
588 | } | 597 | } |
589 | 598 | ||
590 | public function testDeleteTagByLabel() | 599 | public function testDeleteTagByLabel() |
@@ -802,6 +811,22 @@ class WallabagRestControllerTest extends WallabagApiTestCase | |||
802 | $this->assertEquals(true, $content['exists']); | 811 | $this->assertEquals(true, $content['exists']); |
803 | } | 812 | } |
804 | 813 | ||
814 | public function testGetEntriesExistsWithManyUrls() | ||
815 | { | ||
816 | $url1 = 'http://0.0.0.0/entry2'; | ||
817 | $url2 = 'http://0.0.0.0/entry10'; | ||
818 | $this->client->request('GET', '/api/entries/exists?urls[]='.$url1.'&urls[]='.$url2); | ||
819 | |||
820 | $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); | ||
821 | |||
822 | $content = json_decode($this->client->getResponse()->getContent(), true); | ||
823 | |||
824 | $this->assertArrayHasKey($url1, $content); | ||
825 | $this->assertArrayHasKey($url2, $content); | ||
826 | $this->assertEquals(true, $content[$url1]); | ||
827 | $this->assertEquals(false, $content[$url2]); | ||
828 | } | ||
829 | |||
805 | public function testGetEntriesExistsWhichDoesNotExists() | 830 | public function testGetEntriesExistsWhichDoesNotExists() |
806 | { | 831 | { |
807 | $this->client->request('GET', '/api/entries/exists?url=http://google.com/entry2'); | 832 | $this->client->request('GET', '/api/entries/exists?url=http://google.com/entry2'); |