mirror of
https://github.com/wallabag/wallabag.git
synced 2025-08-01 17:38:38 +00:00
41 lines
1.1 KiB
PHP
41 lines
1.1 KiB
PHP
|
<?php
|
||
|
|
||
|
namespace Wallabag\CoreBundle\Tests\Controller;
|
||
|
|
||
|
use Wallabag\CoreBundle\Tests\WallabagTestCase;
|
||
|
|
||
|
class SecurityControllerTest extends WallabagTestCase
|
||
|
{
|
||
|
public function testLogin()
|
||
|
{
|
||
|
$client = $this->getClient();
|
||
|
|
||
|
$crawler = $client->request('GET', '/new');
|
||
|
|
||
|
$this->assertEquals(302, $client->getResponse()->getStatusCode());
|
||
|
$this->assertContains('login', $client->getResponse()->headers->get('location'));
|
||
|
}
|
||
|
|
||
|
public function testLoginFail()
|
||
|
{
|
||
|
$client = $this->getClient();
|
||
|
|
||
|
$crawler = $client->request('GET', '/login');
|
||
|
|
||
|
$form = $crawler->filter('button[type=submit]')->form();
|
||
|
$data = array(
|
||
|
'_username' => 'admin',
|
||
|
'_password' => 'admin',
|
||
|
);
|
||
|
|
||
|
$client->submit($form, $data);
|
||
|
|
||
|
$this->assertEquals(302, $client->getResponse()->getStatusCode());
|
||
|
$this->assertContains('login', $client->getResponse()->headers->get('location'));
|
||
|
|
||
|
$crawler = $client->followRedirect();
|
||
|
|
||
|
$this->assertContains('Bad credentials', $client->getResponse()->getContent());
|
||
|
}
|
||
|
}
|