mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-07 23:34:58 +00:00
fix cs
This commit is contained in:
@@ -137,6 +137,64 @@ class ActivityACLAwareRepositoryTest extends KernelTestCase
|
||||
self::assertIsArray($actual);
|
||||
}
|
||||
|
||||
public function provideDataFindByAccompanyingPeriod(): iterable
|
||||
{
|
||||
$this->setUp();
|
||||
|
||||
if (null === $period = $this->entityManager
|
||||
->createQueryBuilder()
|
||||
->select('a')
|
||||
->from(AccompanyingPeriod::class, 'a')
|
||||
->setMaxResults(1)
|
||||
->getQuery()
|
||||
->getSingleResult()) {
|
||||
throw new \RuntimeException('no period found');
|
||||
}
|
||||
|
||||
if ([] === $types = $this->entityManager
|
||||
->createQueryBuilder()
|
||||
->select('t')
|
||||
->from(ActivityType::class, 't')
|
||||
->setMaxResults(2)
|
||||
->getQuery()
|
||||
->getResult()) {
|
||||
throw new \RuntimeException('no types');
|
||||
}
|
||||
|
||||
if ([] === $jobs = $this->entityManager
|
||||
->createQueryBuilder()
|
||||
->select('j')
|
||||
->from(UserJob::class, 'j')
|
||||
->setMaxResults(2)
|
||||
->getQuery()
|
||||
->getResult()
|
||||
) {
|
||||
$job = new UserJob();
|
||||
$job->setLabel(['fr' => 'test']);
|
||||
$this->entityManager->persist($job);
|
||||
$this->entityManager->flush();
|
||||
}
|
||||
|
||||
if (null === $user = $this->entityManager
|
||||
->createQueryBuilder()
|
||||
->select('u')
|
||||
->from(User::class, 'u')
|
||||
->setMaxResults(1)
|
||||
->getQuery()
|
||||
->getSingleResult()
|
||||
) {
|
||||
throw new \RuntimeException('no user found');
|
||||
}
|
||||
|
||||
yield [$period, $user, ActivityVoter::SEE, 0, 10, ['date' => 'DESC'], []];
|
||||
yield [$period, $user, ActivityVoter::SEE, 0, 10, ['date' => 'DESC'], ['my_activities' => true]];
|
||||
yield [$period, $user, ActivityVoter::SEE, 0, 10, ['date' => 'DESC'], ['types' => $types]];
|
||||
yield [$period, $user, ActivityVoter::SEE, 0, 10, ['date' => 'DESC'], ['jobs' => $jobs]];
|
||||
yield [$period, $user, ActivityVoter::SEE, 0, 10, ['date' => 'DESC'], ['after' => new \DateTimeImmutable('1 year ago')]];
|
||||
yield [$period, $user, ActivityVoter::SEE, 0, 10, ['date' => 'DESC'], ['before' => new \DateTimeImmutable('1 year ago')]];
|
||||
yield [$period, $user, ActivityVoter::SEE, 0, 10, ['date' => 'DESC'], ['after' => new \DateTimeImmutable('1 year ago'), 'before' => new \DateTimeImmutable('1 month ago')]];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideDataFindByPerson
|
||||
*/
|
||||
@@ -291,62 +349,4 @@ class ActivityACLAwareRepositoryTest extends KernelTestCase
|
||||
yield [$person, $user, $centers, $scopes, ActivityVoter::SEE, 0, 5, ['date' => 'DESC'], ['before' => new \DateTimeImmutable('1 year ago')]];
|
||||
yield [$person, $user, $centers, $scopes, ActivityVoter::SEE, 0, 5, ['date' => 'DESC'], ['after' => new \DateTimeImmutable('1 year ago'), 'before' => new \DateTimeImmutable('1 month ago')]];
|
||||
}
|
||||
|
||||
public function provideDataFindByAccompanyingPeriod(): iterable
|
||||
{
|
||||
$this->setUp();
|
||||
|
||||
if (null === $period = $this->entityManager
|
||||
->createQueryBuilder()
|
||||
->select('a')
|
||||
->from(AccompanyingPeriod::class, 'a')
|
||||
->setMaxResults(1)
|
||||
->getQuery()
|
||||
->getSingleResult()) {
|
||||
throw new \RuntimeException('no period found');
|
||||
}
|
||||
|
||||
if ([] === $types = $this->entityManager
|
||||
->createQueryBuilder()
|
||||
->select('t')
|
||||
->from(ActivityType::class, 't')
|
||||
->setMaxResults(2)
|
||||
->getQuery()
|
||||
->getResult()) {
|
||||
throw new \RuntimeException('no types');
|
||||
}
|
||||
|
||||
if ([] === $jobs = $this->entityManager
|
||||
->createQueryBuilder()
|
||||
->select('j')
|
||||
->from(UserJob::class, 'j')
|
||||
->setMaxResults(2)
|
||||
->getQuery()
|
||||
->getResult()
|
||||
) {
|
||||
$job = new UserJob();
|
||||
$job->setLabel(['fr' => 'test']);
|
||||
$this->entityManager->persist($job);
|
||||
$this->entityManager->flush();
|
||||
}
|
||||
|
||||
if (null === $user = $this->entityManager
|
||||
->createQueryBuilder()
|
||||
->select('u')
|
||||
->from(User::class, 'u')
|
||||
->setMaxResults(1)
|
||||
->getQuery()
|
||||
->getSingleResult()
|
||||
) {
|
||||
throw new \RuntimeException('no user found');
|
||||
}
|
||||
|
||||
yield [$period, $user, ActivityVoter::SEE, 0, 10, ['date' => 'DESC'], []];
|
||||
yield [$period, $user, ActivityVoter::SEE, 0, 10, ['date' => 'DESC'], ['my_activities' => true]];
|
||||
yield [$period, $user, ActivityVoter::SEE, 0, 10, ['date' => 'DESC'], ['types' => $types]];
|
||||
yield [$period, $user, ActivityVoter::SEE, 0, 10, ['date' => 'DESC'], ['jobs' => $jobs]];
|
||||
yield [$period, $user, ActivityVoter::SEE, 0, 10, ['date' => 'DESC'], ['after' => new \DateTimeImmutable('1 year ago')]];
|
||||
yield [$period, $user, ActivityVoter::SEE, 0, 10, ['date' => 'DESC'], ['before' => new \DateTimeImmutable('1 year ago')]];
|
||||
yield [$period, $user, ActivityVoter::SEE, 0, 10, ['date' => 'DESC'], ['after' => new \DateTimeImmutable('1 year ago'), 'before' => new \DateTimeImmutable('1 month ago')]];
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user