]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
Added a test to check if entries are also deleted
authorNicolas LÅ“uillet <nicolas@loeuillet.org>
Fri, 9 Sep 2016 08:08:12 +0000 (10:08 +0200)
committerJeremy Benoist <jeremy.benoist@gmail.com>
Sat, 8 Oct 2016 11:27:18 +0000 (13:27 +0200)
tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php

index 282bf5707e2cea56f89a048547d1dab7359bcecc..75a5e3089ce694b248d6994f94fef92dfaa0607b 100644 (file)
@@ -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);
     }
 }