aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Wallabag/ApiBundle
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2017-05-30 09:57:57 +0200
committerJeremy Benoist <jeremy.benoist@gmail.com>2017-05-30 09:57:57 +0200
commitfe6461e4aaff5aa2fd846492e3abd9ea38c07a5b (patch)
tree77b4996fe2d4dfdb794153fb3a10b4845c62561a /tests/Wallabag/ApiBundle
parentd069bff4f606be75c47a3415f2a5af13d6f04865 (diff)
downloadwallabag-fe6461e4aaff5aa2fd846492e3abd9ea38c07a5b.tar.gz
wallabag-fe6461e4aaff5aa2fd846492e3abd9ea38c07a5b.tar.zst
wallabag-fe6461e4aaff5aa2fd846492e3abd9ea38c07a5b.zip
Avoid side effect on other tests
Diffstat (limited to 'tests/Wallabag/ApiBundle')
-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 ]);