diff options
author | Jeremy <jeremy.benoist@gmail.com> | 2015-02-08 23:05:51 +0100 |
---|---|---|
committer | Jeremy <jeremy.benoist@gmail.com> | 2015-02-08 23:13:40 +0100 |
commit | 3b815d2de5a852fe2ebad5827bd4c9070aa175ea (patch) | |
tree | 504e54ecfd8ae6203f76a19a910e5e6c5dee1c3e /src/Wallabag/CoreBundle/Tests/Controller/SecurityControllerTest.php | |
parent | d91691573f108422cc2080462af35ebd62dc93fb (diff) | |
download | wallabag-3b815d2de5a852fe2ebad5827bd4c9070aa175ea.tar.gz wallabag-3b815d2de5a852fe2ebad5827bd4c9070aa175ea.tar.zst wallabag-3b815d2de5a852fe2ebad5827bd4c9070aa175ea.zip |
Add some fixtures
Improve test, so user can login
Fix some leftJoin
Cleanup EntryController
Diffstat (limited to 'src/Wallabag/CoreBundle/Tests/Controller/SecurityControllerTest.php')
-rw-r--r-- | src/Wallabag/CoreBundle/Tests/Controller/SecurityControllerTest.php | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/Tests/Controller/SecurityControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/SecurityControllerTest.php new file mode 100644 index 00000000..54cf5073 --- /dev/null +++ b/src/Wallabag/CoreBundle/Tests/Controller/SecurityControllerTest.php | |||
@@ -0,0 +1,40 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Wallabag\CoreBundle\Tests\Controller; | ||
4 | |||
5 | use Wallabag\CoreBundle\Tests\WallabagTestCase; | ||
6 | |||
7 | class SecurityControllerTest extends WallabagTestCase | ||
8 | { | ||
9 | public function testLogin() | ||
10 | { | ||
11 | $client = $this->getClient(); | ||
12 | |||
13 | $crawler = $client->request('GET', '/new'); | ||
14 | |||
15 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | ||
16 | $this->assertContains('login', $client->getResponse()->headers->get('location')); | ||
17 | } | ||
18 | |||
19 | public function testLoginFail() | ||
20 | { | ||
21 | $client = $this->getClient(); | ||
22 | |||
23 | $crawler = $client->request('GET', '/login'); | ||
24 | |||
25 | $form = $crawler->filter('button[type=submit]')->form(); | ||
26 | $data = array( | ||
27 | '_username' => 'admin', | ||
28 | '_password' => 'admin', | ||
29 | ); | ||
30 | |||
31 | $client->submit($form, $data); | ||
32 | |||
33 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | ||
34 | $this->assertContains('login', $client->getResponse()->headers->get('location')); | ||
35 | |||
36 | $crawler = $client->followRedirect(); | ||
37 | |||
38 | $this->assertContains('Bad credentials', $client->getResponse()->getContent()); | ||
39 | } | ||
40 | } | ||