cs: Fix code style (safe rules only).

This commit is contained in:
Pol Dellaiera
2021-11-23 14:06:38 +01:00
parent 149d7ce991
commit 8f96a1121d
1223 changed files with 65199 additions and 64625 deletions

View File

@@ -1,10 +1,21 @@
<?php
/**
* 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
*/
class LoginControllerTest extends WebTestCase
{
public function testLogin()
@@ -14,47 +25,44 @@ class LoginControllerTest extends WebTestCase
//load login page and submit form
$crawler = $client->request('GET', '/login');
$this->assertTrue($client->getResponse()->isSuccessful());
$buttonCrawlerNode = $crawler->selectButton('login');
$form = $buttonCrawlerNode->form();
$client->submit($form, array(
'_username' => 'center a_social',
'_password' => 'password'
));
$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->assertNotRegExp('/\/login$/', $client->getResponse()
->headers
->get('location'));
->headers
->get('location'));
//on the home page, there must be a logout link
$client->followRedirects(true);
$crawler = $client->request('GET', '/');
$this->assertRegExp('/center a_social/', $client->getResponse()
->getContent());
->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());
$this->assertTrue($client->getResponse()->isRedirect());
$client->followRedirect(); #redirect to login page
$client->followRedirect(); //redirect to login page
//check we are back on login page
$this->assertRegExp('/\/login$/', $client->getResponse()
->headers
->get('location'));
->headers
->get('location'));
}
}