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

@@ -13,17 +13,14 @@ namespace Chill\ReportBundle\Tests\Controller;
use Chill\CustomFieldsBundle\Entity\CustomFieldsGroup;
use Chill\PersonBundle\Entity\Person;
use DateTime;
use RuntimeException;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\BrowserKit\Client;
use function in_array;
/**
* This class is much well writtend than ReportControllerTest class, and will
* replace ReportControllerTest in the future.
*
* @internal
*
* @coversNothing
*/
final class ReportControllerNextTest extends WebTestCase
@@ -55,9 +52,7 @@ final class ReportControllerNextTest extends WebTestCase
);
if (null === $this->person) {
throw new RuntimeException('The expected person is not present in the database. '
. 'Did you run `php app/console doctrine:fixture:load` before launching tests ? '
. "(expecting person is 'Charline Depardieu'");
throw new \RuntimeException('The expected person is not present in the database. Did you run `php app/console doctrine:fixture:load` before launching tests ? '."(expecting person is 'Charline Depardieu'");
}
// get custom fields group from fixture
@@ -65,10 +60,10 @@ final class ReportControllerNextTest extends WebTestCase
->get('doctrine.orm.entity_manager')
->getRepository(\Chill\CustomFieldsBundle\Entity\CustomFieldsGroup::class)
->findBy(['entity' => \Chill\ReportBundle\Entity\Report::class]);
//filter customFieldsGroup to get only "situation de logement"
// filter customFieldsGroup to get only "situation de logement"
$filteredCustomFieldsGroupHouse = array_filter(
$customFieldsGroups,
static fn (CustomFieldsGroup $group) => in_array('Situation de logement', $group->getName(), true)
static fn (CustomFieldsGroup $group) => \in_array('Situation de logement', $group->getName(), true)
);
$this->group = $filteredCustomFieldsGroupHouse[0];
}
@@ -85,7 +80,7 @@ final class ReportControllerNextTest extends WebTestCase
403,
$client->getResponse()->getStatusCode(),
'assert that user for center b has a 403 status code when listing'
. 'reports on person from center a'
.'reports on person from center a'
);
}
@@ -107,7 +102,7 @@ final class ReportControllerNextTest extends WebTestCase
403,
$client->getResponse()->getStatusCode(),
'assert that user for center b has a 403 status code when '
. 'trying to watch a report from person from center a'
.'trying to watch a report from person from center a'
);
}
@@ -124,7 +119,7 @@ final class ReportControllerNextTest extends WebTestCase
403,
$clientCenterB->getResponse()->getStatusCode(),
'assert that user is denied on trying to show a form "new" for'
. ' a person on another center'
.' a person on another center'
);
}
@@ -142,7 +137,7 @@ final class ReportControllerNextTest extends WebTestCase
403,
$client->getResponse()->getStatusCode(),
'assert that user is denied on trying to show a form "new" for'
. ' a person on another center'
.' a person on another center'
);
}
@@ -152,7 +147,7 @@ final class ReportControllerNextTest extends WebTestCase
$form = $this->getReportForm($this->person, $this->group, $client);
$form->get('chill_reportbundle_report[date]')->setValue(
(new DateTime())->format('d-m-Y')
(new \DateTime())->format('d-m-Y')
);
$client->submit($form);