mirror of
https://github.com/wallabag/wallabag.git
synced 2024-09-28 14:22:02 +00:00
Remove the created entry to avoid side effects on other tests
This commit is contained in:
parent
08f29ae7b6
commit
a9357a8311
1 changed files with 17 additions and 7 deletions
|
@ -373,6 +373,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
|
||||||
->willThrowException(new \Exception('Test Fetch content fails'));
|
->willThrowException(new \Exception('Test Fetch content fails'));
|
||||||
$container->set('wallabag_core.content_proxy', $contentProxy);
|
$container->set('wallabag_core.content_proxy', $contentProxy);
|
||||||
|
|
||||||
|
try {
|
||||||
$this->client->request('POST', '/api/entries.json', [
|
$this->client->request('POST', '/api/entries.json', [
|
||||||
'url' => 'http://www.example.com/',
|
'url' => 'http://www.example.com/',
|
||||||
]);
|
]);
|
||||||
|
@ -381,6 +382,15 @@ class EntryRestControllerTest extends WallabagApiTestCase
|
||||||
$content = json_decode($this->client->getResponse()->getContent(), true);
|
$content = json_decode($this->client->getResponse()->getContent(), true);
|
||||||
$this->assertGreaterThan(0, $content['id']);
|
$this->assertGreaterThan(0, $content['id']);
|
||||||
$this->assertEquals('http://www.example.com/', $content['url']);
|
$this->assertEquals('http://www.example.com/', $content['url']);
|
||||||
|
} finally {
|
||||||
|
// Remove the created entry to avoid side effects on other tests
|
||||||
|
if (isset($content['id'])) {
|
||||||
|
$em = $this->client->getContainer()->get('doctrine.orm.entity_manager');
|
||||||
|
$entry = $em->getReference('WallabagCoreBundle:Entry', $content['id']);
|
||||||
|
$em->remove($entry);
|
||||||
|
$em->flush();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testPostArchivedAndStarredEntry()
|
public function testPostArchivedAndStarredEntry()
|
||||||
|
|
Loading…
Reference in a new issue