]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
Fix some tests
authorJeremy Benoist <jeremy.benoist@gmail.com>
Sat, 8 Oct 2016 12:07:13 +0000 (14:07 +0200)
committerJeremy Benoist <jeremy.benoist@gmail.com>
Sat, 8 Oct 2016 12:07:13 +0000 (14:07 +0200)
tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php

index 75a5e3089ce694b248d6994f94fef92dfaa0607b..7929b63d403eb4a8ccf55dfc2e57bde941b96b7e 100644 (file)
@@ -3,6 +3,8 @@
 namespace Tests\Wallabag\CoreBundle\Controller;
 
 use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
+use Wallabag\CoreBundle\Entity\Config;
+use Wallabag\UserBundle\Entity\User;
 
 class ConfigControllerTest extends WallabagCoreTestCase
 {
@@ -583,12 +585,6 @@ class ConfigControllerTest extends WallabagCoreTestCase
 
         $em = $client->getContainer()->get('doctrine.orm.entity_manager');
 
-        $user = $em
-            ->getRepository('WallabagUserBundle:User')
-            ->findOneByUsername('wallace');
-        $user->setExpired(1);
-        $em->persist($user);
-
         $user = $em
             ->getRepository('WallabagUserBundle:User')
             ->findOneByUsername('empty');
@@ -611,12 +607,6 @@ class ConfigControllerTest extends WallabagCoreTestCase
         $client->request('GET', '/account/delete');
         $this->assertEquals(403, $client->getResponse()->getStatusCode());
 
-        $user = $em
-            ->getRepository('WallabagUserBundle:User')
-            ->findOneByUsername('wallace');
-        $user->setExpired(0);
-        $em->persist($user);
-
         $user = $em
             ->getRepository('WallabagUserBundle:User')
             ->findOneByUsername('empty');
@@ -634,8 +624,31 @@ class ConfigControllerTest extends WallabagCoreTestCase
 
     public function testDeleteAccount()
     {
-        $this->logInAs('wallace');
         $client = $this->getClient();
+        $em = $client->getContainer()->get('doctrine.orm.entity_manager');
+
+        $user = new User();
+        $user->setName('Wallace');
+        $user->setEmail('wallace@wallabag.org');
+        $user->setUsername('wallace');
+        $user->setPlainPassword('wallace');
+        $user->setEnabled(true);
+        $user->addRole('ROLE_SUPER_ADMIN');
+
+        $em->persist($user);
+
+        $config = new Config($user);
+
+        $config->setTheme('material');
+        $config->setItemsPerPage(30);
+        $config->setReadingSpeed(1);
+        $config->setLanguage('en');
+        $config->setPocketConsumerKey('xxxxx');
+
+        $em->persist($config);
+        $em->flush();
+
+        $this->logInAs('wallace');
 
         // create entry to check after user deletion
         // that this entry is also deleted