aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Wallabag/ApiBundle/Controller/UserRestControllerTest.php14
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/Wallabag/ApiBundle/Controller/UserRestControllerTest.php b/tests/Wallabag/ApiBundle/Controller/UserRestControllerTest.php
index 21d59a16..3f4969a5 100644
--- a/tests/Wallabag/ApiBundle/Controller/UserRestControllerTest.php
+++ b/tests/Wallabag/ApiBundle/Controller/UserRestControllerTest.php
@@ -49,12 +49,24 @@ class UserRestControllerTest extends WallabagApiTestCase
49 $this->assertEquals('google', $content['username']); 49 $this->assertEquals('google', $content['username']);
50 50
51 $this->assertEquals('application/json', $this->client->getResponse()->headers->get('Content-Type')); 51 $this->assertEquals('application/json', $this->client->getResponse()->headers->get('Content-Type'));
52
53 // remove the created user to avoid side effect on other tests
54 // @todo remove these lines when test will be isolated
55 $em = $this->client->getContainer()->get('doctrine.orm.entity_manager');
56
57 $query = $em->createQuery('DELETE FROM Wallabag\CoreBundle\Entity\Config c WHERE c.user = :user_id');
58 $query->setParameter('user_id', $content['id']);
59 $query->execute();
60
61 $query = $em->createQuery('DELETE FROM Wallabag\UserBundle\Entity\User u WHERE u.id = :id');
62 $query->setParameter('id', $content['id']);
63 $query->execute();
52 } 64 }
53 65
54 public function testCreateNewUserWithExistingEmail() 66 public function testCreateNewUserWithExistingEmail()
55 { 67 {
56 $this->client->request('PUT', '/api/user.json', [ 68 $this->client->request('PUT', '/api/user.json', [
57 'username' => 'google', 69 'username' => 'admin',
58 'password' => 'googlegoogle', 70 'password' => 'googlegoogle',
59 'email' => 'bigboss@wallabag.org', 71 'email' => 'bigboss@wallabag.org',
60 ]); 72 ]);