mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-28 10:33:49 +00:00
fix cs
This commit is contained in:
@@ -42,6 +42,32 @@ final class CalendarControllerTest extends WebTestCase
|
||||
self::ensureKernelShutdown();
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideAccompanyingPeriod
|
||||
*/
|
||||
public function testList(int $accompanyingPeriodId)
|
||||
{
|
||||
$this->client->request(
|
||||
Request::METHOD_GET,
|
||||
sprintf('/fr/calendar/calendar/by-period/%d', $accompanyingPeriodId)
|
||||
);
|
||||
|
||||
$this->assertEquals(200, $this->client->getResponse()->getStatusCode());
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideAccompanyingPeriod
|
||||
*/
|
||||
public function testNew(int $accompanyingPeriodId)
|
||||
{
|
||||
$this->client->request(
|
||||
Request::METHOD_GET,
|
||||
sprintf('/fr/calendar/calendar/new?accompanying_period_id=%d', $accompanyingPeriodId)
|
||||
);
|
||||
|
||||
$this->assertEquals(200, $this->client->getResponse()->getStatusCode());
|
||||
}
|
||||
|
||||
public static function provideAccompanyingPeriod(): iterable
|
||||
{
|
||||
self::bootKernel();
|
||||
@@ -82,30 +108,4 @@ final class CalendarControllerTest extends WebTestCase
|
||||
|
||||
self::ensureKernelShutdown();
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideAccompanyingPeriod
|
||||
*/
|
||||
public function testList(int $accompanyingPeriodId)
|
||||
{
|
||||
$this->client->request(
|
||||
Request::METHOD_GET,
|
||||
sprintf('/fr/calendar/calendar/by-period/%d', $accompanyingPeriodId)
|
||||
);
|
||||
|
||||
$this->assertEquals(200, $this->client->getResponse()->getStatusCode());
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideAccompanyingPeriod
|
||||
*/
|
||||
public function testNew(int $accompanyingPeriodId)
|
||||
{
|
||||
$this->client->request(
|
||||
Request::METHOD_GET,
|
||||
sprintf('/fr/calendar/calendar/new?accompanying_period_id=%d', $accompanyingPeriodId)
|
||||
);
|
||||
|
||||
$this->assertEquals(200, $this->client->getResponse()->getStatusCode());
|
||||
}
|
||||
}
|
||||
|
@@ -45,20 +45,6 @@ class MSUserAbsenceReaderTest extends TestCase
|
||||
self::assertEquals($expected, $absenceReader->isUserAbsent($user), $message);
|
||||
}
|
||||
|
||||
public function testIsUserAbsentWithoutRemoteId(): void
|
||||
{
|
||||
$user = new User();
|
||||
$client = new MockHttpClient();
|
||||
|
||||
$mapUser = $this->prophesize(MapCalendarToUser::class);
|
||||
$mapUser->getUserId($user)->willReturn(null);
|
||||
$clock = new MockClock(new \DateTimeImmutable('2023-07-07T12:00:00'));
|
||||
|
||||
$absenceReader = new MSUserAbsenceReader($client, $mapUser->reveal(), $clock);
|
||||
|
||||
self::assertNull($absenceReader->isUserAbsent($user), 'when no user found, absence should be null');
|
||||
}
|
||||
|
||||
public static function provideDataTestUserAbsence(): iterable
|
||||
{
|
||||
// contains data that was retrieved from microsoft graph api on 2023-07-06
|
||||
@@ -173,4 +159,18 @@ class MSUserAbsenceReaderTest extends TestCase
|
||||
'User is absent: absence is always enabled',
|
||||
];
|
||||
}
|
||||
|
||||
public function testIsUserAbsentWithoutRemoteId(): void
|
||||
{
|
||||
$user = new User();
|
||||
$client = new MockHttpClient();
|
||||
|
||||
$mapUser = $this->prophesize(MapCalendarToUser::class);
|
||||
$mapUser->getUserId($user)->willReturn(null);
|
||||
$clock = new MockClock(new \DateTimeImmutable('2023-07-07T12:00:00'));
|
||||
|
||||
$absenceReader = new MSUserAbsenceReader($client, $mapUser->reveal(), $clock);
|
||||
|
||||
self::assertNull($absenceReader->isUserAbsent($user), 'when no user found, absence should be null');
|
||||
}
|
||||
}
|
||||
|
@@ -28,6 +28,24 @@ use PHPUnit\Framework\TestCase;
|
||||
*/
|
||||
final class DefaultRangeGeneratorTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider generateData
|
||||
*/
|
||||
public function testGenerateRange(\DateTimeImmutable $date, ?\DateTimeImmutable $startDate, ?\DateTimeImmutable $endDate)
|
||||
{
|
||||
$generator = new DefaultRangeGenerator();
|
||||
|
||||
['startDate' => $actualStartDate, 'endDate' => $actualEndDate] = $generator->generateRange($date);
|
||||
|
||||
if (null === $startDate) {
|
||||
$this->assertNull($actualStartDate);
|
||||
$this->assertNull($actualEndDate);
|
||||
} else {
|
||||
$this->assertEquals($startDate->format(\DateTimeImmutable::ATOM), $actualStartDate->format(\DateTimeImmutable::ATOM));
|
||||
$this->assertEquals($endDate->format(\DateTimeImmutable::ATOM), $actualEndDate->format(\DateTimeImmutable::ATOM));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* * Lundi => Envoi des rdv du mardi et mercredi.
|
||||
* * Mardi => Envoi des rdv du jeudi.
|
||||
@@ -79,22 +97,4 @@ final class DefaultRangeGeneratorTest extends TestCase
|
||||
null,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider generateData
|
||||
*/
|
||||
public function testGenerateRange(\DateTimeImmutable $date, ?\DateTimeImmutable $startDate, ?\DateTimeImmutable $endDate)
|
||||
{
|
||||
$generator = new DefaultRangeGenerator();
|
||||
|
||||
['startDate' => $actualStartDate, 'endDate' => $actualEndDate] = $generator->generateRange($date);
|
||||
|
||||
if (null === $startDate) {
|
||||
$this->assertNull($actualStartDate);
|
||||
$this->assertNull($actualEndDate);
|
||||
} else {
|
||||
$this->assertEquals($startDate->format(\DateTimeImmutable::ATOM), $actualStartDate->format(\DateTimeImmutable::ATOM));
|
||||
$this->assertEquals($endDate->format(\DateTimeImmutable::ATOM), $actualEndDate->format(\DateTimeImmutable::ATOM));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user