aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Tests/Controller/SecurityControllerTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/Wallabag/CoreBundle/Tests/Controller/SecurityControllerTest.php')
-rw-r--r--src/Wallabag/CoreBundle/Tests/Controller/SecurityControllerTest.php40
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
3namespace Wallabag\CoreBundle\Tests\Controller;
4
5use Wallabag\CoreBundle\Tests\WallabagTestCase;
6
7class 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}