diff options
author | Jeremy Benoist <jeremy.benoist@gmail.com> | 2016-06-24 11:55:45 +0200 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2016-06-24 11:55:47 +0200 |
commit | fdc90ceb172bb7b237e34a1a01f53018c09f514b (patch) | |
tree | 6b2a4ad27428497713eef68ce57d4b58f18507cc /tests/Wallabag/CoreBundle/Controller | |
parent | 2bc9cad78ed43eaadfc8844c0b55700e7045cbd7 (diff) | |
download | wallabag-fdc90ceb172bb7b237e34a1a01f53018c09f514b.tar.gz wallabag-fdc90ceb172bb7b237e34a1a01f53018c09f514b.tar.zst wallabag-fdc90ceb172bb7b237e34a1a01f53018c09f514b.zip |
Change the way to login user in tests
Instead of using a HTTP request we just login user like FOSUser does.
It allows us to mock service in container for functional tests.
Also, fix a bad config name in fos_user for firewall
And finally, add functional test to PocketImport
Diffstat (limited to 'tests/Wallabag/CoreBundle/Controller')
-rw-r--r-- | tests/Wallabag/CoreBundle/Controller/SecurityControllerTest.php | 2 | ||||
-rw-r--r-- | tests/Wallabag/CoreBundle/Controller/TagControllerTest.php | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/tests/Wallabag/CoreBundle/Controller/SecurityControllerTest.php b/tests/Wallabag/CoreBundle/Controller/SecurityControllerTest.php index f503ff4b..03355f5a 100644 --- a/tests/Wallabag/CoreBundle/Controller/SecurityControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/SecurityControllerTest.php | |||
@@ -36,7 +36,7 @@ class SecurityControllerTest extends WallabagCoreTestCase | |||
36 | $em->persist($user); | 36 | $em->persist($user); |
37 | $em->flush(); | 37 | $em->flush(); |
38 | 38 | ||
39 | $this->logInAs('admin'); | 39 | $this->logInAsUsingHttp('admin'); |
40 | $crawler = $client->request('GET', '/config'); | 40 | $crawler = $client->request('GET', '/config'); |
41 | $this->assertContains('scheb_two_factor.trusted', $crawler->filter('body')->extract(['_text'])[0]); | 41 | $this->assertContains('scheb_two_factor.trusted', $crawler->filter('body')->extract(['_text'])[0]); |
42 | 42 | ||
diff --git a/tests/Wallabag/CoreBundle/Controller/TagControllerTest.php b/tests/Wallabag/CoreBundle/Controller/TagControllerTest.php index a019d36c..58450e5f 100644 --- a/tests/Wallabag/CoreBundle/Controller/TagControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/TagControllerTest.php | |||
@@ -39,6 +39,12 @@ class TagControllerTest extends WallabagCoreTestCase | |||
39 | $client->submit($form, $data); | 39 | $client->submit($form, $data); |
40 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 40 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); |
41 | 41 | ||
42 | // be sure to reload the entry | ||
43 | $entry = $client->getContainer() | ||
44 | ->get('doctrine.orm.entity_manager') | ||
45 | ->getRepository('WallabagCoreBundle:Entry') | ||
46 | ->findOneByUsernameAndNotArchived('admin'); | ||
47 | |||
42 | $this->assertEquals(1, count($entry->getTags())); | 48 | $this->assertEquals(1, count($entry->getTags())); |
43 | 49 | ||
44 | # tag already exists and already assigned | 50 | # tag already exists and already assigned |