aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php')
-rw-r--r--tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php21
1 files changed, 16 insertions, 5 deletions
diff --git a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
index ddeca4c0..1489a472 100644
--- a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
+++ b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
@@ -431,18 +431,29 @@ class EntryRestControllerTest extends WallabagApiTestCase
431 $this->assertSame(404, $this->client->getResponse()->getStatusCode()); 431 $this->assertSame(404, $this->client->getResponse()->getStatusCode());
432 } 432 }
433 433
434 $this->client->request('DELETE', '/api/entries/' . $entry->getId() . '.json'); 434 public function testDeleteEntryExpectId()
435 {
436 $em = $this->client->getContainer()->get('doctrine.orm.entity_manager');
437 $entry = new Entry($em->getReference(User::class, 1));
438 $entry->setUrl('http://0.0.0.0/test-delete-entry-id');
439 $em->persist($entry);
440 $em->flush();
441
442 $em->clear();
443
444 $id = $entry->getId();
445
446 $this->client->request('DELETE', '/api/entries/' . $id . '.json?expect=id');
435 447
436 $this->assertSame(200, $this->client->getResponse()->getStatusCode()); 448 $this->assertSame(200, $this->client->getResponse()->getStatusCode());
437 449
438 $content = json_decode($this->client->getResponse()->getContent(), true); 450 $content = json_decode($this->client->getResponse()->getContent(), true);
439 451
440 $this->assertSame($entry->getTitle(), $content['title']); 452 $this->assertSame($id, $content['id']);
441 $this->assertSame($entry->getUrl(), $content['url']); 453 $this->assertArrayNotHasKey('url', $content);
442 $this->assertSame($entry->getId(), $content['id']);
443 454
444 // We'll try to delete this entry again 455 // We'll try to delete this entry again
445 $this->client->request('DELETE', '/api/entries/' . $entry->getId() . '.json'); 456 $this->client->request('DELETE', '/api/entries/' . $id . '.json');
446 457
447 $this->assertSame(404, $this->client->getResponse()->getStatusCode()); 458 $this->assertSame(404, $this->client->getResponse()->getStatusCode());
448 } 459 }