From: Jeremy Benoist Date: Sat, 8 Oct 2016 12:07:13 +0000 (+0200) Subject: Fix some tests X-Git-Tag: 2.2.0~3^2~92^2~6 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=c3396c65ef8532091614ec9ae298ba124d58b2b9;p=github%2Fwallabag%2Fwallabag.git Fix some tests --- diff --git a/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php b/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php index 75a5e308..7929b63d 100644 --- a/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php @@ -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