mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-03 21:34:59 +00:00
apply more cs rules for php-cs
This commit is contained in:
@@ -12,14 +12,12 @@ declare(strict_types=1);
|
||||
namespace Chill\ActivityBundle\Tests\Controller;
|
||||
|
||||
use Chill\ActivityBundle\Entity\ActivityType;
|
||||
use RuntimeException;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
use function count;
|
||||
use function in_array;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class ActivityControllerTest extends WebTestCase
|
||||
@@ -206,19 +204,19 @@ final class ActivityControllerTest extends WebTestCase
|
||||
$container = self::$kernel->getContainer();
|
||||
$em = $container->get('doctrine.orm.entity_manager');
|
||||
|
||||
//get the social PermissionGroup, and remove CHILL_ACTIVITY_*
|
||||
// get the social PermissionGroup, and remove CHILL_ACTIVITY_*
|
||||
$socialPermissionGroup = $em
|
||||
->getRepository(\Chill\MainBundle\Entity\PermissionsGroup::class)
|
||||
->findOneByName('social');
|
||||
$withoutActivityPermissionGroup = (new \Chill\MainBundle\Entity\PermissionsGroup())
|
||||
->setName('social without activity');
|
||||
//copy role scopes where ACTIVITY is not present
|
||||
// copy role scopes where ACTIVITY is not present
|
||||
foreach ($socialPermissionGroup->getRoleScopes() as $roleScope) {
|
||||
if (!strpos((string) $roleScope->getRole(), 'ACTIVITY')) {
|
||||
$withoutActivityPermissionGroup->addRoleScope($roleScope);
|
||||
}
|
||||
}
|
||||
//create groupCenter
|
||||
// create groupCenter
|
||||
$groupCenter = new \Chill\MainBundle\Entity\GroupCenter();
|
||||
$groupCenter->setCenter($em->getRepository(\Chill\MainBundle\Entity\Center::class)
|
||||
->findOneBy(['name' => 'Center A']))
|
||||
@@ -226,7 +224,7 @@ final class ActivityControllerTest extends WebTestCase
|
||||
$em->persist($withoutActivityPermissionGroup);
|
||||
$em->persist($groupCenter);
|
||||
|
||||
//create user
|
||||
// create user
|
||||
$faker = \Faker\Factory::create();
|
||||
$username = $faker->name;
|
||||
$user = new \Chill\MainBundle\Entity\User();
|
||||
@@ -251,9 +249,8 @@ final class ActivityControllerTest extends WebTestCase
|
||||
$activities = $em->getRepository(\Chill\ActivityBundle\Entity\Activity::class)
|
||||
->findBy(['person' => $person]);
|
||||
|
||||
if (count($activities) === 0) {
|
||||
throw new RuntimeException('We need activities associated with this '
|
||||
. 'person. Did you forget to add fixtures ?');
|
||||
if (0 === \count($activities)) {
|
||||
throw new \RuntimeException('We need activities associated with this person. Did you forget to add fixtures ?');
|
||||
}
|
||||
|
||||
return $activities;
|
||||
@@ -285,8 +282,7 @@ final class ActivityControllerTest extends WebTestCase
|
||||
]);
|
||||
|
||||
if (null === $person) {
|
||||
throw new RuntimeException('We need a person with firstname Gérard and'
|
||||
. ' lastname Depardieu. Did you add fixtures ?');
|
||||
throw new \RuntimeException('We need a person with firstname Gérard and lastname Depardieu. Did you add fixtures ?');
|
||||
}
|
||||
|
||||
return $person;
|
||||
@@ -306,7 +302,7 @@ final class ActivityControllerTest extends WebTestCase
|
||||
|
||||
$reason = $reasons[array_rand($reasons)];
|
||||
|
||||
if (in_array($reason->getId(), $excludeIds, true)) {
|
||||
if (\in_array($reason->getId(), $excludeIds, true)) {
|
||||
return $this->getRandomActivityReason($excludeIds);
|
||||
}
|
||||
|
||||
@@ -340,8 +336,7 @@ final class ActivityControllerTest extends WebTestCase
|
||||
->findOneByUsername($username);
|
||||
|
||||
if (null === $user) {
|
||||
throw new RuntimeException("The user with username {$username} "
|
||||
. 'does not exists in database. Did you add fixtures ?');
|
||||
throw new \RuntimeException("The user with username {$username} ".'does not exists in database. Did you add fixtures ?');
|
||||
}
|
||||
|
||||
$center = self::$kernel->getContainer()
|
||||
@@ -369,13 +364,12 @@ final class ActivityControllerTest extends WebTestCase
|
||||
array_map(static fn ($s) => $s->getId(), $reachableScopesUpdate)
|
||||
);
|
||||
|
||||
if (count($reachableScopesId) === 0) {
|
||||
throw new RuntimeException('there are not scope reachable for '
|
||||
. 'both CHILL_ACTIVITY_UPDATE and CHILL_ACTIVITY_DELETE');
|
||||
if (0 === \count($reachableScopesId)) {
|
||||
throw new \RuntimeException('there are not scope reachable for both CHILL_ACTIVITY_UPDATE and CHILL_ACTIVITY_DELETE');
|
||||
}
|
||||
|
||||
foreach ($reachableScopesUpdate as $scope) {
|
||||
if (in_array($scope->getId(), $reachableScopesId, true)) {
|
||||
if (\in_array($scope->getId(), $reachableScopesId, true)) {
|
||||
$reachableScopes[] = $scope;
|
||||
}
|
||||
}
|
||||
|
@@ -15,6 +15,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class ActivityReasonCategoryControllerTest extends WebTestCase
|
||||
|
@@ -15,6 +15,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class ActivityReasonControllerTest extends WebTestCase
|
||||
|
@@ -15,6 +15,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class ActivityTypeControllerTest extends WebTestCase
|
||||
|
@@ -22,6 +22,7 @@ use Prophecy\PhpUnit\ProphecyTrait;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class ActivityTest extends TestCase
|
||||
|
@@ -18,6 +18,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class BySocialActionAggregatorTest extends AbstractAggregatorTest
|
||||
|
@@ -18,6 +18,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class BySocialIssueAggregatorTest extends AbstractAggregatorTest
|
||||
|
@@ -12,7 +12,6 @@ declare(strict_types=1);
|
||||
namespace Chill\ActivityBundle\Tests\Export\Aggregator;
|
||||
|
||||
use Chill\ActivityBundle\Entity\Activity;
|
||||
use Chill\ActivityBundle\Entity\ActivityType;
|
||||
use Chill\ActivityBundle\Export\Aggregator\ActivityTypeAggregator;
|
||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
@@ -22,6 +21,7 @@ use Prophecy\PhpUnit\ProphecyTrait;
|
||||
* Add tests for ActivityTypeAggregator.
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class ActivityTypeAggregatorTest extends AbstractAggregatorTest
|
||||
|
@@ -21,6 +21,7 @@ use Prophecy\PhpUnit\ProphecyTrait;
|
||||
* Add tests for ActivityUsernAggregator.
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class ActivityUserAggregatorTest extends AbstractAggregatorTest
|
||||
|
@@ -18,6 +18,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class ByThirdpartyAggregatorTest extends AbstractAggregatorTest
|
||||
|
@@ -18,6 +18,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class ByUserAggregatorTest extends AbstractAggregatorTest
|
||||
|
@@ -18,6 +18,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class CreatorScopeAggregatorTest extends AbstractAggregatorTest
|
||||
|
@@ -18,6 +18,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class DateAggregatorTest extends AbstractAggregatorTest
|
||||
|
@@ -12,18 +12,19 @@ declare(strict_types=1);
|
||||
namespace Chill\ActivityBundle\Tests\Export\Aggregator;
|
||||
|
||||
use Chill\ActivityBundle\Entity\Activity;
|
||||
use Chill\ActivityBundle\Export\Aggregator\CreatorScopeAggregator;
|
||||
use Chill\ActivityBundle\Export\Aggregator\JobScopeAggregator;
|
||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class JobScopeAggregatorTest extends AbstractAggregatorTest
|
||||
{
|
||||
private JobScopeAggregator $aggregator;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
@@ -18,6 +18,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class LocationTypeAggregatorTest extends AbstractAggregatorTest
|
||||
|
@@ -19,6 +19,7 @@ use Prophecy\PhpUnit\ProphecyTrait;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class ActivityReasonAggregatorTest extends AbstractAggregatorTest
|
||||
|
@@ -16,6 +16,7 @@ use Chill\MainBundle\Test\Export\AbstractExportTest;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class AvgActivityDurationTest extends AbstractExportTest
|
||||
|
@@ -16,6 +16,7 @@ use Chill\MainBundle\Test\Export\AbstractExportTest;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class AvgActivityVisitDurationTest extends AbstractExportTest
|
||||
|
@@ -16,6 +16,7 @@ use Chill\MainBundle\Test\Export\AbstractExportTest;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class CountActivityTest extends AbstractExportTest
|
||||
|
@@ -16,6 +16,7 @@ use Chill\MainBundle\Test\Export\AbstractExportTest;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class SumActivityDurationTest extends AbstractExportTest
|
||||
|
@@ -16,6 +16,7 @@ use Chill\MainBundle\Test\Export\AbstractExportTest;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class SumActivityVisitDurationTest extends AbstractExportTest
|
||||
|
@@ -16,6 +16,7 @@ use Chill\MainBundle\Test\Export\AbstractExportTest;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class CountActivityTest extends AbstractExportTest
|
||||
|
@@ -17,6 +17,7 @@ use Prophecy\PhpUnit\ProphecyTrait;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class ListActivityTest extends AbstractExportTest
|
||||
|
@@ -18,6 +18,7 @@ use Chill\MainBundle\Test\Export\AbstractExportTest;
|
||||
* Test the "sum" part of StatActivityDuration.
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class StatActivityDurationTest extends AbstractExportTest
|
||||
|
@@ -13,7 +13,6 @@ namespace Chill\ActivityBundle\Tests\Export\Filter\ACPFilters;
|
||||
|
||||
use Chill\ActivityBundle\Entity\Activity;
|
||||
use Chill\ActivityBundle\Entity\ActivityType;
|
||||
use Chill\ActivityBundle\Export\Filter\ActivityTypeFilter;
|
||||
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
@@ -22,6 +21,7 @@ use Doctrine\ORM\Query\Expr;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class ActivityTypeFilterTest extends AbstractFilterTest
|
||||
|
@@ -19,6 +19,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class ByCreatorFilterTest extends AbstractFilterTest
|
||||
|
@@ -19,6 +19,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class BySocialActionFilterTest extends AbstractFilterTest
|
||||
|
@@ -20,6 +20,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class BySocialIssueFilterTest extends AbstractFilterTest
|
||||
|
@@ -15,11 +15,11 @@ use Chill\ActivityBundle\Entity\Activity;
|
||||
use Chill\ActivityBundle\Export\Filter\ActivityDateFilter;
|
||||
use Chill\MainBundle\Service\RollingDate\RollingDate;
|
||||
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||
use DateTime;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class ActivityDateFilterTest extends AbstractFilterTest
|
||||
@@ -54,10 +54,9 @@ final class ActivityDateFilterTest extends AbstractFilterTest
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
yield
|
||||
$em->createQueryBuilder()
|
||||
->select('count(activity.id)')
|
||||
->from(Activity::class, 'activity');
|
||||
yield $em->createQueryBuilder()
|
||||
->select('count(activity.id)')
|
||||
->from(Activity::class, 'activity');
|
||||
|
||||
self::ensureKernelShutdown();
|
||||
}
|
||||
|
@@ -20,6 +20,7 @@ use Symfony\Component\HttpFoundation\RequestStack;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class ActivityReasonFilterTest extends AbstractFilterTest
|
||||
@@ -56,7 +57,7 @@ final class ActivityReasonFilterTest extends AbstractFilterTest
|
||||
->get(EntityManagerInterface::class);
|
||||
|
||||
$reasons = $em->createQuery('SELECT reason '
|
||||
. 'FROM ChillActivityBundle:ActivityReason reason')
|
||||
.'FROM ChillActivityBundle:ActivityReason reason')
|
||||
->getResult();
|
||||
|
||||
// generate an array of 5 different combination of results
|
||||
@@ -76,11 +77,11 @@ final class ActivityReasonFilterTest extends AbstractFilterTest
|
||||
yield $em->createQueryBuilder()
|
||||
->select('count(activity.id)')
|
||||
->from('ChillActivityBundle:Activity', 'activity');
|
||||
yield $em->createQueryBuilder()
|
||||
yield $em->createQueryBuilder()
|
||||
->select('count(activity.id)')
|
||||
->from('ChillActivityBundle:Activity', 'activity')
|
||||
->join('activity.reasons', 'reasons');
|
||||
yield $em->createQueryBuilder()
|
||||
yield $em->createQueryBuilder()
|
||||
->select('count(activity.id)')
|
||||
->from('ChillActivityBundle:Activity', 'activity')
|
||||
->join('activity.reasons', 'reasons')
|
||||
|
@@ -20,6 +20,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class ActivityTypeFilterTest extends AbstractFilterTest
|
||||
@@ -67,10 +68,9 @@ final class ActivityTypeFilterTest extends AbstractFilterTest
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
yield
|
||||
$em->createQueryBuilder()
|
||||
->select('count(activity.id)')
|
||||
->from(Activity::class, 'activity');
|
||||
yield $em->createQueryBuilder()
|
||||
->select('count(activity.id)')
|
||||
->from(Activity::class, 'activity');
|
||||
|
||||
self::ensureKernelShutdown();
|
||||
}
|
||||
|
@@ -19,6 +19,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class ByCreatorFilterTest extends AbstractFilterTest
|
||||
|
@@ -18,6 +18,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class EmergencyFilterTest extends AbstractFilterTest
|
||||
|
@@ -19,6 +19,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class LocationTypeFilterTest extends AbstractFilterTest
|
||||
|
@@ -20,6 +20,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class ActivityReasonFilterTest extends AbstractFilterTest
|
||||
|
@@ -15,11 +15,11 @@ use Chill\ActivityBundle\Entity\Activity;
|
||||
use Chill\ActivityBundle\Entity\ActivityReason;
|
||||
use Chill\ActivityBundle\Export\Filter\PersonFilters\PersonHavingActivityBetweenDateFilter;
|
||||
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||
use DateTime;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class PersonHavingActivityBetweenDateFilterTest extends AbstractFilterTest
|
||||
@@ -54,8 +54,8 @@ final class PersonHavingActivityBetweenDateFilterTest extends AbstractFilterTest
|
||||
|
||||
foreach ($array as $a) {
|
||||
$data[] = [
|
||||
'date_from' => DateTime::createFromFormat('Y-m-d', '2021-07-01'),
|
||||
'date_to' => DateTime::createFromFormat('Y-m-d', '2022-07-01'),
|
||||
'date_from' => \DateTime::createFromFormat('Y-m-d', '2021-07-01'),
|
||||
'date_to' => \DateTime::createFromFormat('Y-m-d', '2022-07-01'),
|
||||
'reasons' => [$a],
|
||||
];
|
||||
}
|
||||
@@ -75,8 +75,7 @@ final class PersonHavingActivityBetweenDateFilterTest extends AbstractFilterTest
|
||||
$em->createQueryBuilder()
|
||||
->select('count(activity.id)')
|
||||
->from(Activity::class, 'activity')
|
||||
->join('activity.person', 'person')
|
||||
,
|
||||
->join('activity.person', 'person'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@@ -14,15 +14,14 @@ namespace Chill\ActivityBundle\Tests\Export\Filter;
|
||||
use Chill\ActivityBundle\Export\Filter\PersonFilters\PersonHavingActivityBetweenDateFilter;
|
||||
use Chill\ActivityBundle\Repository\ActivityReasonRepository;
|
||||
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||
use DateTime;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
use function array_slice;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class PersonHavingActivityBetweenDateFilterTest extends AbstractFilterTest
|
||||
@@ -51,8 +50,8 @@ final class PersonHavingActivityBetweenDateFilterTest extends AbstractFilterTest
|
||||
|
||||
public function getFormData()
|
||||
{
|
||||
$date_from = DateTime::createFromFormat('Y-m-d', '2015-01-15');
|
||||
$date_to = new DateTime(); // today
|
||||
$date_from = \DateTime::createFromFormat('Y-m-d', '2015-01-15');
|
||||
$date_to = new \DateTime(); // today
|
||||
$reasons = $this->getActivityReasons();
|
||||
|
||||
$data = [];
|
||||
@@ -61,7 +60,7 @@ final class PersonHavingActivityBetweenDateFilterTest extends AbstractFilterTest
|
||||
$data[] = [
|
||||
'date_from' => $date_from,
|
||||
'date_to' => $date_to,
|
||||
'reasons' => array_slice($reasons, 0, 1 + $i),
|
||||
'reasons' => \array_slice($reasons, 0, 1 + $i),
|
||||
];
|
||||
}
|
||||
|
||||
|
@@ -18,6 +18,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class SentReceivedFilterTest extends AbstractFilterTest
|
||||
|
@@ -19,6 +19,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class UserFilterTest extends AbstractFilterTest
|
||||
|
@@ -19,6 +19,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class UserScopeFilterTest extends AbstractFilterTest
|
||||
|
@@ -13,14 +13,13 @@ namespace Chill\ActivityBundle\Tests\Form;
|
||||
|
||||
use Chill\ActivityBundle\Entity\Activity;
|
||||
use Chill\ActivityBundle\Form\ActivityType;
|
||||
use DateTime;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||
use Symfony\Component\Form\Extension\Core\Type\FormType;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\AbstractToken;
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class ActivityTypeTest extends KernelTestCase
|
||||
@@ -140,7 +139,7 @@ final class ActivityTypeTest extends KernelTestCase
|
||||
public function testFormWithActivityHavingDifferentTime()
|
||||
{
|
||||
$activity = new Activity();
|
||||
$activity->setDurationTime(DateTime::createFromFormat('U', 60));
|
||||
$activity->setDurationTime(\DateTime::createFromFormat('U', 60));
|
||||
|
||||
$builder = $this->container
|
||||
->get('form.factory')
|
||||
|
@@ -20,6 +20,7 @@ use Symfony\Component\Form\Test\TypeTestCase;
|
||||
* Test translatableActivityReason.
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class TranslatableActivityReasonTest extends TypeTestCase
|
||||
|
@@ -18,6 +18,7 @@ use Symfony\Component\Form\Extension\Core\Type\FormType;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class TranslatableActivityTypeTest extends KernelTestCase
|
||||
|
@@ -33,6 +33,7 @@ use Symfony\Component\Security\Core\Security;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
class ActivityACLAwareRepositoryTest extends KernelTestCase
|
||||
@@ -182,7 +183,7 @@ class ActivityACLAwareRepositoryTest extends KernelTestCase
|
||||
if (null === $person = $this->entityManager->createQueryBuilder()
|
||||
->select('p')->from(Person::class, 'p')->setMaxResults(1)
|
||||
->getQuery()->getSingleResult()) {
|
||||
throw new \RuntimeException("person not found");
|
||||
throw new \RuntimeException('person not found');
|
||||
}
|
||||
|
||||
/** @var AccompanyingPeriod $period1 */
|
||||
@@ -193,7 +194,7 @@ class ActivityACLAwareRepositoryTest extends KernelTestCase
|
||||
->setMaxResults(1)
|
||||
->getQuery()
|
||||
->getSingleResult()) {
|
||||
throw new \RuntimeException("no period found");
|
||||
throw new \RuntimeException('no period found');
|
||||
}
|
||||
|
||||
/** @var AccompanyingPeriod $period2 */
|
||||
@@ -206,7 +207,7 @@ class ActivityACLAwareRepositoryTest extends KernelTestCase
|
||||
->setMaxResults(1)
|
||||
->getQuery()
|
||||
->getSingleResult()) {
|
||||
throw new \RuntimeException("no second period found");
|
||||
throw new \RuntimeException('no second period found');
|
||||
}
|
||||
// add a period
|
||||
$period1->addPerson($person);
|
||||
@@ -222,7 +223,7 @@ class ActivityACLAwareRepositoryTest extends KernelTestCase
|
||||
->setMaxResults(2)
|
||||
->getQuery()
|
||||
->getResult()) {
|
||||
throw new \RuntimeException("no types");
|
||||
throw new \RuntimeException('no types');
|
||||
}
|
||||
|
||||
if ([] === $jobs = $this->entityManager
|
||||
@@ -233,7 +234,7 @@ class ActivityACLAwareRepositoryTest extends KernelTestCase
|
||||
->getQuery()
|
||||
->getResult()
|
||||
) {
|
||||
throw new \RuntimeException("no jobs found");
|
||||
throw new \RuntimeException('no jobs found');
|
||||
}
|
||||
|
||||
if (null === $user = $this->entityManager
|
||||
@@ -244,19 +245,19 @@ class ActivityACLAwareRepositoryTest extends KernelTestCase
|
||||
->getQuery()
|
||||
->getSingleResult()
|
||||
) {
|
||||
throw new \RuntimeException("no user found");
|
||||
throw new \RuntimeException('no user found');
|
||||
}
|
||||
|
||||
if ([] === $centers = $this->entityManager->createQueryBuilder()
|
||||
->select('c')->from(Center::class, 'c')->setMaxResults(2)->getQuery()
|
||||
->getResult()) {
|
||||
throw new \RuntimeException("no centers found");
|
||||
throw new \RuntimeException('no centers found');
|
||||
}
|
||||
|
||||
if ([] === $scopes = $this->entityManager->createQueryBuilder()
|
||||
->select('s')->from(Scope::class, 's')->setMaxResults(2)->getQuery()
|
||||
->getResult()) {
|
||||
throw new \RuntimeException("no scopes found");
|
||||
throw new \RuntimeException('no scopes found');
|
||||
}
|
||||
|
||||
yield [$person, $user, $centers, $scopes, ActivityVoter::SEE, 0, 5, ['date' => 'DESC'], []];
|
||||
@@ -279,7 +280,7 @@ class ActivityACLAwareRepositoryTest extends KernelTestCase
|
||||
->setMaxResults(1)
|
||||
->getQuery()
|
||||
->getSingleResult()) {
|
||||
throw new \RuntimeException("no period found");
|
||||
throw new \RuntimeException('no period found');
|
||||
}
|
||||
|
||||
if ([] === $types = $this->entityManager
|
||||
@@ -289,7 +290,7 @@ class ActivityACLAwareRepositoryTest extends KernelTestCase
|
||||
->setMaxResults(2)
|
||||
->getQuery()
|
||||
->getResult()) {
|
||||
throw new \RuntimeException("no types");
|
||||
throw new \RuntimeException('no types');
|
||||
}
|
||||
|
||||
if ([] === $jobs = $this->entityManager
|
||||
@@ -300,7 +301,7 @@ class ActivityACLAwareRepositoryTest extends KernelTestCase
|
||||
->getQuery()
|
||||
->getResult()
|
||||
) {
|
||||
throw new \RuntimeException("no jobs found");
|
||||
throw new \RuntimeException('no jobs found');
|
||||
}
|
||||
|
||||
if (null === $user = $this->entityManager
|
||||
@@ -311,7 +312,7 @@ class ActivityACLAwareRepositoryTest extends KernelTestCase
|
||||
->getQuery()
|
||||
->getSingleResult()
|
||||
) {
|
||||
throw new \RuntimeException("no user found");
|
||||
throw new \RuntimeException('no user found');
|
||||
}
|
||||
|
||||
yield [$period, $user, ActivityVoter::SEE, 0, 10, ['date' => 'DESC'], []];
|
||||
|
@@ -20,7 +20,6 @@ use Chill\MainBundle\Security\Resolver\CenterResolverManagerInterface;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use phpseclib3\Math\BinaryField;
|
||||
use Prophecy\Argument;
|
||||
use Prophecy\PhpUnit\ProphecyTrait;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||
@@ -28,6 +27,7 @@ use Symfony\Component\Security\Core\Security;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
class ActivityDocumentACLAwareRepositoryTest extends KernelTestCase
|
||||
@@ -104,22 +104,22 @@ class ActivityDocumentACLAwareRepositoryTest extends KernelTestCase
|
||||
{
|
||||
$this->setUp();
|
||||
|
||||
if (null === $person = $this->entityManager->createQuery("SELECT p FROM " . Person::class . " p WHERE SIZE(p.accompanyingPeriodParticipations) > 0 ")
|
||||
if (null === $person = $this->entityManager->createQuery('SELECT p FROM '.Person::class.' p WHERE SIZE(p.accompanyingPeriodParticipations) > 0 ')
|
||||
->setMaxResults(1)
|
||||
->getSingleResult()) {
|
||||
throw new \RuntimeException("no person in dtabase");
|
||||
throw new \RuntimeException('no person in dtabase');
|
||||
}
|
||||
|
||||
if ([] === $scopes = $this->entityManager->createQuery("SELECT s FROM " . Scope::class . " s ")->setMaxResults(5)->getResult()) {
|
||||
throw new \RuntimeException("no scopes in database");
|
||||
if ([] === $scopes = $this->entityManager->createQuery('SELECT s FROM '.Scope::class.' s ')->setMaxResults(5)->getResult()) {
|
||||
throw new \RuntimeException('no scopes in database');
|
||||
}
|
||||
|
||||
yield [$person, [], true, null, null, null];
|
||||
yield [$person, $scopes, true, null, null, null];
|
||||
yield [$person, $scopes, true, new \DateTimeImmutable("1 month ago"), null, null];
|
||||
yield [$person, $scopes, true, new \DateTimeImmutable("1 month ago"), new \DateTimeImmutable("1 week ago"), null];
|
||||
yield [$person, $scopes, true, new \DateTimeImmutable("1 month ago"), new \DateTimeImmutable("1 week ago"), "content"];
|
||||
yield [$person, $scopes, true, null, new \DateTimeImmutable("1 week ago"), "content"];
|
||||
yield [$person, [], true, new \DateTimeImmutable("1 month ago"), new \DateTimeImmutable("1 week ago"), "content"];
|
||||
yield [$person, $scopes, true, new \DateTimeImmutable('1 month ago'), null, null];
|
||||
yield [$person, $scopes, true, new \DateTimeImmutable('1 month ago'), new \DateTimeImmutable('1 week ago'), null];
|
||||
yield [$person, $scopes, true, new \DateTimeImmutable('1 month ago'), new \DateTimeImmutable('1 week ago'), 'content'];
|
||||
yield [$person, $scopes, true, null, new \DateTimeImmutable('1 week ago'), 'content'];
|
||||
yield [$person, [], true, new \DateTimeImmutable('1 month ago'), new \DateTimeImmutable('1 week ago'), 'content'];
|
||||
}
|
||||
}
|
||||
|
@@ -24,6 +24,7 @@ use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class ActivityVoterTest extends KernelTestCase
|
||||
@@ -127,7 +128,7 @@ final class ActivityVoterTest extends KernelTestCase
|
||||
/**
|
||||
* @dataProvider dataProvider_testVoteAction
|
||||
*
|
||||
* @param type $expectedResult
|
||||
* @param type $expectedResult
|
||||
* @param string $attribute
|
||||
* @param string $message
|
||||
*/
|
||||
@@ -156,11 +157,11 @@ final class ActivityVoterTest extends KernelTestCase
|
||||
*
|
||||
* @return \Symfony\Component\Security\Core\Authentication\Token\TokenInterface
|
||||
*/
|
||||
protected function prepareToken(?User $user = null)
|
||||
protected function prepareToken(User $user = null)
|
||||
{
|
||||
$token = $this->prophet->prophesize();
|
||||
$token
|
||||
->willImplement('\\' . \Symfony\Component\Security\Core\Authentication\Token\TokenInterface::class);
|
||||
->willImplement('\\'.\Symfony\Component\Security\Core\Authentication\Token\TokenInterface::class);
|
||||
|
||||
if (null === $user) {
|
||||
$token->getUser()->willReturn(null);
|
||||
|
@@ -15,6 +15,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class TimelineProviderTest extends WebTestCase
|
||||
|
Reference in New Issue
Block a user