aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Wallabag/ApiBundle/Controller
diff options
context:
space:
mode:
authoradev <adev2000@gmail.com>2017-05-09 23:19:24 +0200
committeradev <adev2000@gmail.com>2017-05-09 23:19:24 +0200
commita9357a8311b2a3a9a114ec8400a9878d5f1f8345 (patch)
treeea9c8bd217f9543f3358851efbe98cd7faa12bac /tests/Wallabag/ApiBundle/Controller
parent08f29ae7b6af585f3af1dd2f8b01854fb0985668 (diff)
downloadwallabag-a9357a8311b2a3a9a114ec8400a9878d5f1f8345.tar.gz
wallabag-a9357a8311b2a3a9a114ec8400a9878d5f1f8345.tar.zst
wallabag-a9357a8311b2a3a9a114ec8400a9878d5f1f8345.zip
Remove the created entry to avoid side effects on other tests
Diffstat (limited to 'tests/Wallabag/ApiBundle/Controller')
-rw-r--r--tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php26
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()