3 namespace Wallabag\CoreBundle\Tests\Controller
;
5 use Wallabag\CoreBundle\Tests\WallabagTestCase
;
7 class SecurityControllerTest
extends WallabagTestCase
9 public function testLogin()
11 $client = $this->getClient();
13 $crawler = $client->request('GET', '/new');
15 $this->assertEquals(302, $client->getResponse()->getStatusCode());
16 $this->assertContains('login', $client->getResponse()->headers
->get('location'));
19 public function testLoginFail()
21 $client = $this->getClient();
23 $crawler = $client->request('GET', '/login');
25 $form = $crawler->filter('button[type=submit]')->form();
27 '_username' => 'admin',
28 '_password' => 'admin',
31 $client->submit($form, $data);
33 $this->assertEquals(302, $client->getResponse()->getStatusCode());
34 $this->assertContains('login', $client->getResponse()->headers
->get('location'));
36 $crawler = $client->followRedirect();
38 $this->assertContains('Bad credentials', $client->getResponse()->getContent());