diff options
Diffstat (limited to 'tests/Wallabag/ApiBundle/Controller')
-rw-r--r-- | tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php index 0979ca93..deafd1fa 100644 --- a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php +++ b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php | |||
@@ -373,14 +373,24 @@ class EntryRestControllerTest extends WallabagApiTestCase | |||
373 | ->willThrowException(new \Exception('Test Fetch content fails')); | 373 | ->willThrowException(new \Exception('Test Fetch content fails')); |
374 | $container->set('wallabag_core.content_proxy', $contentProxy); | 374 | $container->set('wallabag_core.content_proxy', $contentProxy); |
375 | 375 | ||
376 | $this->client->request('POST', '/api/entries.json', [ | 376 | try { |
377 | 'url' => 'http://www.example.com/', | 377 | $this->client->request('POST', '/api/entries.json', [ |
378 | ]); | 378 | 'url' => 'http://www.example.com/', |
379 | 379 | ]); | |
380 | $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); | 380 | |
381 | $content = json_decode($this->client->getResponse()->getContent(), true); | 381 | $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); |
382 | $this->assertGreaterThan(0, $content['id']); | 382 | $content = json_decode($this->client->getResponse()->getContent(), true); |
383 | $this->assertEquals('http://www.example.com/', $content['url']); | 383 | $this->assertGreaterThan(0, $content['id']); |
384 | $this->assertEquals('http://www.example.com/', $content['url']); | ||
385 | } finally { | ||
386 | // Remove the created entry to avoid side effects on other tests | ||
387 | if (isset($content['id'])) { | ||
388 | $em = $this->client->getContainer()->get('doctrine.orm.entity_manager'); | ||
389 | $entry = $em->getReference('WallabagCoreBundle:Entry', $content['id']); | ||
390 | $em->remove($entry); | ||
391 | $em->flush(); | ||
392 | } | ||
393 | } | ||
384 | } | 394 | } |
385 | 395 | ||
386 | public function testPostArchivedAndStarredEntry() | 396 | public function testPostArchivedAndStarredEntry() |