From b84026871169cee8cdd4aba892c128beee98e91a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Fri, 9 Sep 2016 10:08:12 +0200 Subject: Added a test to check if entries are also deleted --- .../CoreBundle/Controller/ConfigControllerTest.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php b/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php index 282bf570..75a5e308 100644 --- a/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php @@ -637,6 +637,20 @@ class ConfigControllerTest extends WallabagCoreTestCase $this->logInAs('wallace'); $client = $this->getClient(); + // create entry to check after user deletion + // that this entry is also deleted + $crawler = $client->request('GET', '/new'); + + $this->assertEquals(200, $client->getResponse()->getStatusCode()); + + $form = $crawler->filter('form[name=entry]')->form(); + $data = [ + 'entry[url]' => $url = 'https://github.com/wallabag/wallabag', + ]; + + $client->submit($form, $data); + $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $crawler = $client->request('GET', '/config'); $deleteLink = $crawler->filter('.delete-account')->last()->link(); @@ -654,5 +668,12 @@ class ConfigControllerTest extends WallabagCoreTestCase ; $this->assertNull($user); + + $entries = $client->getContainer() + ->get('doctrine.orm.entity_manager') + ->getRepository('WallabagCoreBundle:Entry') + ->findByUser($this->getLoggedInUserId()); + + $this->assertEmpty($entries); } } -- cgit v1.2.3