mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 10:34:09 +00:00
[WIP] first import of automated recipes [WIP] fix configuration file to be able to compile kernel and serve route [WIP] first build of assets [WIP] Continue working on configuration to load a page [WIP] Reset the bin directory [WIP] remove default migrations files [WIP] fix configuration for running tests [WIP] Installation instructions Fix the default firewall in test login [WIP] fix cs [WIP] update gitlab-ci [WIP] update gitlab-ci [WIP] update gitlab ci [WIP] fix config for running tests [WIP] fix gitlab ci [WIP] try tests/bootstrap php file from symfony bridge instead of phpunit recipe remove kernel.php file fix loading of entrypoint.json in test [wip] increase memory limit for phpstan in test/ci [WIP]: set the correct timezone directly within the phpunit.xml.dist file [WIP]: fix security configuration WIP: fix config for testing
67 lines
1.9 KiB
PHP
67 lines
1.9 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
/*
|
|
* Chill is a software for social workers
|
|
*
|
|
* For the full copyright and license information, please view
|
|
* the LICENSE file that was distributed with this source code.
|
|
*/
|
|
|
|
namespace Chill\MainBundle\Tests\Controller;
|
|
|
|
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
|
use Symfony\Component\HttpFoundation\Response;
|
|
|
|
/**
|
|
* @internal
|
|
*
|
|
* @coversNothing
|
|
*/
|
|
final class LoginControllerTest extends WebTestCase
|
|
{
|
|
public function testLogin()
|
|
{
|
|
$client = self::createClient();
|
|
|
|
// load login page and submit form
|
|
$crawler = $client->request('GET', '/login');
|
|
|
|
self::assertResponseIsSuccessful();
|
|
|
|
$buttonCrawlerNode = $crawler->selectButton('login');
|
|
$form = $buttonCrawlerNode->form();
|
|
|
|
$client->submit($form, [
|
|
'_username' => 'center a_social',
|
|
'_password' => 'password',
|
|
]);
|
|
|
|
// the response is a redirection
|
|
$this->assertTrue($client->getResponse()->isRedirect());
|
|
|
|
// the response is not a login page, but on a new page
|
|
$this->assertDoesNotMatchRegularExpression('/\/login$/', $client->getResponse()
|
|
->headers
|
|
->get('location'));
|
|
|
|
// on the home page, there must be a logout link
|
|
$client->followRedirects(true);
|
|
$crawler = $client->request('GET', '/');
|
|
|
|
$this->assertMatchesRegularExpression('/center a_social/', $client->getResponse()
|
|
->getContent());
|
|
$logoutLinkFilter = $crawler->filter('a:contains("Se déconnecter")');
|
|
|
|
// check there is > 0 logout link
|
|
$this->assertGreaterThan(0, $logoutLinkFilter->count(), 'check that a logout link is present');
|
|
|
|
// click on logout link
|
|
$client->followRedirects(false);
|
|
$client->click($crawler->selectLink('Se déconnecter')->link());
|
|
|
|
self::assertResponseRedirects('http://localhost/');
|
|
}
|
|
}
|