apply more cs rules for php-cs

This commit is contained in:
2023-10-17 13:27:03 +02:00
parent 0b0cbed9db
commit bc2041cbdd
1485 changed files with 8169 additions and 9620 deletions

View File

@@ -18,6 +18,7 @@ use Symfony\Bundle\FrameworkBundle\KernelBrowser;
/**
* @internal
*
* @coversNothing
*/
final class AddressControllerTest extends \Symfony\Bundle\FrameworkBundle\Test\WebTestCase

View File

@@ -18,6 +18,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
/**
* @internal
*
* @coversNothing
*/
final class AddressReferenceApiControllerTest extends WebTestCase

View File

@@ -21,6 +21,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
/**
* @internal
*
* @coversNothing
*/
class AddressToReferenceMatcherControllerTest extends WebTestCase

View File

@@ -16,6 +16,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
/**
* @internal
*
* @coversNothing
*/
final class CenterControllerTest extends WebTestCase
@@ -23,18 +24,18 @@ final class CenterControllerTest extends WebTestCase
use PrepareClientTrait;
/**
* This is a smoke test that ensure that the list page does show
* This is a smoke test that ensure that the list page does show.
*/
public function testCenterAdminSmokeTest(): void
{
$client = $this->getClientAuthenticated('admin', 'password');
$crawler = $client->request('GET', '/fr/admin/center');
self::assertResponseIsSuccessful("Test that /fr/admin/center does show");
self::assertResponseIsSuccessful('Test that /fr/admin/center does show');
$btnEdit = $crawler->filter('.btn-edit')?->first();
self::assertNotNull($btnEdit, "check that there is at least one btn-edit on center page");
self::assertNotNull($btnEdit, 'check that there is at least one btn-edit on center page');
$client->click($btnEdit->link());

View File

@@ -17,6 +17,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
* Test the export.
*
* @internal
*
* @coversNothing
*/
final class ExportControllerTest extends WebTestCase

View File

@@ -18,6 +18,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
/**
* @internal
*
* @coversNothing
*/
class GeographicalUnitByAddressApiControllerTest extends WebTestCase

View File

@@ -16,6 +16,7 @@ use Symfony\Component\HttpFoundation\Response;
/**
* @internal
*
* @coversNothing
*/
final class LoginControllerTest extends WebTestCase
@@ -24,7 +25,7 @@ final class LoginControllerTest extends WebTestCase
{
$client = self::createClient();
//load login page and submit form
// load login page and submit form
$crawler = $client->request('GET', '/login');
$this->assertTrue($client->getResponse()->isSuccessful());
@@ -36,15 +37,15 @@ final class LoginControllerTest extends WebTestCase
'_password' => 'password',
]);
//the response is a redirection
// the response is a redirection
$this->assertTrue($client->getResponse()->isRedirect());
//the response is not a login page, but on a new page
// 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
// on the home page, there must be a logout link
$client->followRedirects(true);
$crawler = $client->request('GET', '/');
@@ -52,17 +53,17 @@ final class LoginControllerTest extends WebTestCase
->getContent());
$logoutLinkFilter = $crawler->filter('a:contains("Se déconnecter")');
//check there is > 0 logout link
// check there is > 0 logout link
$this->assertGreaterThan(0, $logoutLinkFilter->count(), 'check that a logout link is present');
//click on logout link
// 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
// check we are back on login page
$this->assertMatchesRegularExpression('/\/login$/', $client->getResponse()
->headers
->get('location'));

View File

@@ -16,12 +16,12 @@ use Chill\MainBundle\Entity\User;
use Chill\MainBundle\Repository\UserRepository;
use Chill\MainBundle\Test\PrepareClientTrait;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use DateTimeImmutable;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
/**
* @internal
*
* @coversNothing
*/
final class NotificationApiControllerTest extends WebTestCase
@@ -57,7 +57,7 @@ final class NotificationApiControllerTest extends WebTestCase
->setRelatedEntityId(0)
->setSender($userB)
->addAddressee($userA)
->setUpdatedAt(new DateTimeImmutable());
->setUpdatedAt(new \DateTimeImmutable());
$em->persist($notification);
$em->refresh($notification);
$em->flush();

View File

@@ -12,11 +12,11 @@ declare(strict_types=1);
namespace Controller;
use Chill\MainBundle\Test\PrepareClientTrait;
use DateTime;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
/**
* @internal
*
* @coversNothing
*/
final class PermissionApiControllerTest extends WebTestCase
@@ -44,7 +44,7 @@ final class PermissionApiControllerTest extends WebTestCase
'object' => [
'datetime' => '1969-07-09T00:00:00+0100',
],
'class' => DateTime::class,
'class' => \DateTime::class,
'roles' => ['FOO_ROLE'],
])
);

View File

@@ -15,6 +15,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
/**
* @internal
*
* @coversNothing
*/
final class PermissionsGroupControllerTest extends WebTestCase

View File

@@ -13,10 +13,10 @@ namespace Controller;
use Chill\MainBundle\Test\PrepareClientTrait;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use function json_decode;
/**
* @internal
*
* @coversNothing
*/
final class PostalCodeApiControllerTest extends WebTestCase
@@ -35,7 +35,7 @@ final class PostalCodeApiControllerTest extends WebTestCase
$this->assertResponseIsSuccessful();
$data = json_decode($client->getResponse()->getContent(), true, 512, JSON_THROW_ON_ERROR);
$data = \json_decode($client->getResponse()->getContent(), true, 512, JSON_THROW_ON_ERROR);
$this->assertEquals('Fontenay Le Comte', $data['results'][0]['name']);

View File

@@ -15,6 +15,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
/**
* @internal
*
* @coversNothing
*/
final class ScopeControllerTest extends WebTestCase

View File

@@ -17,6 +17,7 @@ use Symfony\Component\HttpFoundation\Request;
/**
* @internal
*
* @coversNothing
*/
final class SearchApiControllerTest extends WebTestCase

View File

@@ -17,6 +17,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
* Test the search controller.
*
* @internal
*
* @coversNothing
*/
final class SearchControllerTest extends WebTestCase

View File

@@ -14,11 +14,10 @@ namespace Chill\MainBundle\Tests\Controller;
use Chill\MainBundle\Test\PrepareClientTrait;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\HttpFoundation\Request;
use function array_key_exists;
use function json_decode;
/**
* @internal
*
* @coversNothing
*/
final class UserApiControllerTest extends WebTestCase
@@ -32,7 +31,7 @@ final class UserApiControllerTest extends WebTestCase
{
$client = $this->getClientAuthenticated();
$client->request(Request::METHOD_GET, '/api/1.0/main/user/' . $existingUser['id'] . '.json');
$client->request(Request::METHOD_GET, '/api/1.0/main/user/'.$existingUser['id'].'.json');
$this->assertResponseIsSuccessful();
}
@@ -45,10 +44,10 @@ final class UserApiControllerTest extends WebTestCase
$this->assertResponseIsSuccessful();
$data = json_decode($client->getResponse()->getContent(), true, 512, JSON_THROW_ON_ERROR);
$this->assertTrue(array_key_exists('count', $data));
$data = \json_decode($client->getResponse()->getContent(), true, 512, JSON_THROW_ON_ERROR);
$this->assertTrue(\array_key_exists('count', $data));
$this->assertGreaterThan(0, $data['count']);
$this->assertTrue(array_key_exists('results', $data));
$this->assertTrue(\array_key_exists('results', $data));
return $data['results'][0];
}

View File

@@ -19,6 +19,7 @@ use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;
/**
* @internal
*
* @coversNothing
*/
final class UserControllerTest extends WebTestCase
@@ -56,7 +57,7 @@ final class UserControllerTest extends WebTestCase
$em = self::$container->get(EntityManagerInterface::class);
$user = new User();
$user->setUsername('Test_user ' . uniqid());
$user->setUsername('Test_user '.uniqid());
$user->setPassword(self::$container->get(UserPasswordEncoderInterface::class)->encodePassword(
$user,
'password'
@@ -87,7 +88,7 @@ final class UserControllerTest extends WebTestCase
{
$crawler = $this->client->request('GET', '/fr/admin/main/user/new');
$username = 'Test_user' . uniqid();
$username = 'Test_user'.uniqid();
$password = 'Password1234!';
// Fill in the form and submit it
@@ -95,7 +96,7 @@ final class UserControllerTest extends WebTestCase
'chill_mainbundle_user[username]' => $username,
'chill_mainbundle_user[plainPassword][first]' => $password,
'chill_mainbundle_user[plainPassword][second]' => $password,
'chill_mainbundle_user[email]' => $username . '@gmail.com',
'chill_mainbundle_user[email]' => $username.'@gmail.com',
'chill_mainbundle_user[label]' => $username,
]);
@@ -109,7 +110,7 @@ final class UserControllerTest extends WebTestCase
'page contains the name of the user'
);
//test the auth of the new client
// test the auth of the new client
$this->isPasswordValid($username, $password);
}
@@ -120,7 +121,7 @@ final class UserControllerTest extends WebTestCase
{
$crawler = $this->client->request('GET', "/fr/admin/main/user/{$userId}/edit");
$username = 'Foo bar ' . uniqid();
$username = 'Foo bar '.uniqid();
$form = $crawler->selectButton('Enregistrer & fermer')->form([
'chill_mainbundle_user[username]' => $username,
]);