mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-28 02:23:51 +00:00
apply more cs rules for php-cs
This commit is contained in:
@@ -17,13 +17,9 @@ use Chill\DocStoreBundle\Security\Authorization\PersonDocumentVoter;
|
||||
use Chill\MainBundle\Entity\Center;
|
||||
use Chill\MainBundle\Repository\ScopeRepositoryInterface;
|
||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelperForCurrentUserInterface;
|
||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelperInterface;
|
||||
use Chill\MainBundle\Security\Resolver\CenterResolverDispatcher;
|
||||
use Chill\MainBundle\Security\Resolver\CenterResolverDispatcherInterface;
|
||||
use Chill\MainBundle\Security\Resolver\CenterResolverManagerInterface;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use DateTimeImmutable;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Prophecy\Argument;
|
||||
use Prophecy\PhpUnit\ProphecyTrait;
|
||||
@@ -32,6 +28,7 @@ use Symfony\Component\Security\Core\Security;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
class PersonDocumentACLAwareRepositoryTest extends KernelTestCase
|
||||
@@ -51,11 +48,12 @@ class PersonDocumentACLAwareRepositoryTest extends KernelTestCase
|
||||
|
||||
/**
|
||||
* @dataProvider provideDataBuildFetchQueryForPerson
|
||||
*
|
||||
* @throws \Doctrine\DBAL\Exception
|
||||
* @throws \Doctrine\ORM\NoResultException
|
||||
* @throws \Doctrine\ORM\NonUniqueResultException
|
||||
*/
|
||||
public function testBuildFetchQueryForPerson(?DateTimeImmutable $startDate = null, ?DateTimeImmutable $endDate = null, ?string $content = null): void
|
||||
public function testBuildFetchQueryForPerson(\DateTimeImmutable $startDate = null, \DateTimeImmutable $endDate = null, string $content = null): void
|
||||
{
|
||||
$centerManager = $this->prophesize(CenterResolverManagerInterface::class);
|
||||
$centerManager->resolveCenters(Argument::type(Person::class))
|
||||
@@ -72,12 +70,12 @@ class PersonDocumentACLAwareRepositoryTest extends KernelTestCase
|
||||
$this->prophesize(Security::class)->reveal()
|
||||
);
|
||||
|
||||
$person = $this->entityManager->createQuery("SELECT p FROM " . Person::class . " p")
|
||||
$person = $this->entityManager->createQuery('SELECT p FROM '.Person::class.' p')
|
||||
->setMaxResults(1)
|
||||
->getSingleResult();
|
||||
|
||||
if (null === $person) {
|
||||
throw new \RuntimeException("person not exists in database");
|
||||
throw new \RuntimeException('person not exists in database');
|
||||
}
|
||||
|
||||
$query = $repository->buildFetchQueryForPerson($person, $startDate, $endDate, $content);
|
||||
@@ -86,7 +84,7 @@ class PersonDocumentACLAwareRepositoryTest extends KernelTestCase
|
||||
$nb = $this->entityManager->getConnection()
|
||||
->fetchOne("SELECT COUNT(*) FROM ({$sql}) AS sq", $params, $types);
|
||||
|
||||
self::assertIsInt($nb, "test that the query could be executed");
|
||||
self::assertIsInt($nb, 'test that the query could be executed');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -94,9 +92,9 @@ class PersonDocumentACLAwareRepositoryTest extends KernelTestCase
|
||||
*/
|
||||
public function testBuildFetchQueryForAccompanyingPeriod(
|
||||
AccompanyingPeriod $period,
|
||||
?\DateTimeImmutable $startDate = null,
|
||||
?\DateTimeImmutable $endDate = null,
|
||||
?string $content = null
|
||||
\DateTimeImmutable $startDate = null,
|
||||
\DateTimeImmutable $endDate = null,
|
||||
string $content = null
|
||||
): void {
|
||||
$centerManager = $this->prophesize(CenterResolverManagerInterface::class);
|
||||
$centerManager->resolveCenters(Argument::type(Person::class))
|
||||
@@ -122,7 +120,7 @@ class PersonDocumentACLAwareRepositoryTest extends KernelTestCase
|
||||
$nb = $this->entityManager->getConnection()
|
||||
->fetchOne("SELECT COUNT(*) FROM ({$sql}) AS sq", $params, $types);
|
||||
|
||||
self::assertIsInt($nb, "test that the query could be executed");
|
||||
self::assertIsInt($nb, 'test that the query could be executed');
|
||||
}
|
||||
|
||||
public function provideDateForFetchQueryForAccompanyingPeriod(): iterable
|
||||
@@ -130,27 +128,27 @@ class PersonDocumentACLAwareRepositoryTest extends KernelTestCase
|
||||
$this->setUp();
|
||||
|
||||
if (null === $period = $this->entityManager->createQuery(
|
||||
"SELECT p FROM " . AccompanyingPeriod::class . " p WHERE SIZE(p.participations) > 0"
|
||||
'SELECT p FROM '.AccompanyingPeriod::class.' p WHERE SIZE(p.participations) > 0'
|
||||
)
|
||||
->setMaxResults(1)->getSingleResult()) {
|
||||
throw new \RuntimeException("no course found");
|
||||
throw new \RuntimeException('no course found');
|
||||
}
|
||||
|
||||
yield [$period, null, null, null];
|
||||
yield [$period, new DateTimeImmutable('1 year ago'), null, null];
|
||||
yield [$period, null, new DateTimeImmutable('1 year ago'), null];
|
||||
yield [$period, new DateTimeImmutable('2 years ago'), new DateTimeImmutable('1 year ago'), null];
|
||||
yield [$period, new \DateTimeImmutable('1 year ago'), null, null];
|
||||
yield [$period, null, new \DateTimeImmutable('1 year ago'), null];
|
||||
yield [$period, new \DateTimeImmutable('2 years ago'), new \DateTimeImmutable('1 year ago'), null];
|
||||
yield [$period, null, null, 'test'];
|
||||
yield [$period, new DateTimeImmutable('2 years ago'), new DateTimeImmutable('1 year ago'), 'test'];
|
||||
yield [$period, new \DateTimeImmutable('2 years ago'), new \DateTimeImmutable('1 year ago'), 'test'];
|
||||
}
|
||||
|
||||
public function provideDataBuildFetchQueryForPerson(): iterable
|
||||
{
|
||||
yield [null, null, null];
|
||||
yield [new DateTimeImmutable('1 year ago'), null, null];
|
||||
yield [null, new DateTimeImmutable('1 year ago'), null];
|
||||
yield [new DateTimeImmutable('2 years ago'), new DateTimeImmutable('1 year ago'), null];
|
||||
yield [new \DateTimeImmutable('1 year ago'), null, null];
|
||||
yield [null, new \DateTimeImmutable('1 year ago'), null];
|
||||
yield [new \DateTimeImmutable('2 years ago'), new \DateTimeImmutable('1 year ago'), null];
|
||||
yield [null, null, 'test'];
|
||||
yield [new DateTimeImmutable('2 years ago'), new DateTimeImmutable('1 year ago'), 'test'];
|
||||
yield [new \DateTimeImmutable('2 years ago'), new \DateTimeImmutable('1 year ago'), 'test'];
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user