mirror of
https://github.com/wallabag/wallabag.git
synced 2024-06-12 02:09:32 +00:00
3b815d2de5
Improve test, so user can login Fix some leftJoin Cleanup EntryController
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());
|
|
}
|
|
}
|