mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-30 02:25:00 +00:00
fix cs
This commit is contained in:
@@ -45,6 +45,14 @@ class CollateAddressWithReferenceOrPostalCodeCronJobTest extends TestCase
|
||||
self::assertEquals($expected, $job->canRun($execution));
|
||||
}
|
||||
|
||||
public static function provideDataCanRun(): iterable
|
||||
{
|
||||
yield [new \DateTimeImmutable('2023-07-10T12:00:00'), new \DateTimeImmutable('2023-07-10T11:00:00'), false];
|
||||
yield [new \DateTimeImmutable('2023-07-10T12:00:00'), new \DateTimeImmutable('2023-07-10T05:00:00'), true];
|
||||
yield [new \DateTimeImmutable('2023-07-10T12:00:00'), new \DateTimeImmutable('2023-07-01T12:00:00'), true];
|
||||
yield [new \DateTimeImmutable('2023-07-10T12:00:00'), null, true];
|
||||
}
|
||||
|
||||
public function testRun(): void
|
||||
{
|
||||
$clock = new MockClock();
|
||||
@@ -57,12 +65,4 @@ class CollateAddressWithReferenceOrPostalCodeCronJobTest extends TestCase
|
||||
$actual = $job->run(['last-max-id' => 0]);
|
||||
self::assertEquals(['last-max-id' => 1], $actual);
|
||||
}
|
||||
|
||||
public static function provideDataCanRun(): iterable
|
||||
{
|
||||
yield [new \DateTimeImmutable('2023-07-10T12:00:00'), new \DateTimeImmutable('2023-07-10T11:00:00'), false];
|
||||
yield [new \DateTimeImmutable('2023-07-10T12:00:00'), new \DateTimeImmutable('2023-07-10T05:00:00'), true];
|
||||
yield [new \DateTimeImmutable('2023-07-10T12:00:00'), new \DateTimeImmutable('2023-07-01T12:00:00'), true];
|
||||
yield [new \DateTimeImmutable('2023-07-10T12:00:00'), null, true];
|
||||
}
|
||||
}
|
||||
|
@@ -29,37 +29,6 @@ final class RollingDateConverterTest extends TestCase
|
||||
$this->converter = new RollingDateConverter();
|
||||
}
|
||||
|
||||
public static function generateDataConversionDate(): iterable
|
||||
{
|
||||
$format = 'Y-m-d His';
|
||||
|
||||
yield [RollingDate::T_MONTH_CURRENT_START, '2022-11-01 000000', $format];
|
||||
|
||||
yield [RollingDate::T_MONTH_NEXT_START, '2022-12-01 000000', $format];
|
||||
|
||||
yield [RollingDate::T_MONTH_PREVIOUS_START, '2022-10-01 000000', $format];
|
||||
|
||||
yield [RollingDate::T_QUARTER_CURRENT_START, '2022-10-01 000000', $format];
|
||||
|
||||
yield [RollingDate::T_QUARTER_NEXT_START, '2023-01-01 000000', $format];
|
||||
|
||||
yield [RollingDate::T_QUARTER_PREVIOUS_START, '2022-07-01 000000', $format];
|
||||
|
||||
yield [RollingDate::T_TODAY, '2022-11-07 000000', $format];
|
||||
|
||||
yield [RollingDate::T_WEEK_CURRENT_START, '2022-11-07 000000', $format];
|
||||
|
||||
yield [RollingDate::T_WEEK_NEXT_START, '2022-11-14 000000', $format];
|
||||
|
||||
yield [RollingDate::T_WEEK_PREVIOUS_START, '2022-10-31 000000', $format];
|
||||
|
||||
yield [RollingDate::T_YEAR_CURRENT_START, '2022-01-01 000000', $format];
|
||||
|
||||
yield [RollingDate::T_YEAR_NEXT_START, '2023-01-01 000000', $format];
|
||||
|
||||
yield [RollingDate::T_YEAR_PREVIOUS_START, '2021-01-01 000000', $format];
|
||||
}
|
||||
|
||||
public function testConversionFixedDate()
|
||||
{
|
||||
$rollingDate = new RollingDate(RollingDate::T_FIXED_DATE, new \DateTimeImmutable('2022-01-01'));
|
||||
@@ -97,4 +66,35 @@ final class RollingDateConverterTest extends TestCase
|
||||
$this->converter->convert($rollingDate)
|
||||
);
|
||||
}
|
||||
|
||||
public static function generateDataConversionDate(): iterable
|
||||
{
|
||||
$format = 'Y-m-d His';
|
||||
|
||||
yield [RollingDate::T_MONTH_CURRENT_START, '2022-11-01 000000', $format];
|
||||
|
||||
yield [RollingDate::T_MONTH_NEXT_START, '2022-12-01 000000', $format];
|
||||
|
||||
yield [RollingDate::T_MONTH_PREVIOUS_START, '2022-10-01 000000', $format];
|
||||
|
||||
yield [RollingDate::T_QUARTER_CURRENT_START, '2022-10-01 000000', $format];
|
||||
|
||||
yield [RollingDate::T_QUARTER_NEXT_START, '2023-01-01 000000', $format];
|
||||
|
||||
yield [RollingDate::T_QUARTER_PREVIOUS_START, '2022-07-01 000000', $format];
|
||||
|
||||
yield [RollingDate::T_TODAY, '2022-11-07 000000', $format];
|
||||
|
||||
yield [RollingDate::T_WEEK_CURRENT_START, '2022-11-07 000000', $format];
|
||||
|
||||
yield [RollingDate::T_WEEK_NEXT_START, '2022-11-14 000000', $format];
|
||||
|
||||
yield [RollingDate::T_WEEK_PREVIOUS_START, '2022-10-31 000000', $format];
|
||||
|
||||
yield [RollingDate::T_YEAR_CURRENT_START, '2022-01-01 000000', $format];
|
||||
|
||||
yield [RollingDate::T_YEAR_NEXT_START, '2023-01-01 000000', $format];
|
||||
|
||||
yield [RollingDate::T_YEAR_PREVIOUS_START, '2021-01-01 000000', $format];
|
||||
}
|
||||
}
|
||||
|
@@ -48,6 +48,32 @@ class CancelStaleWorkflowCronJobTest extends TestCase
|
||||
self::assertEquals($expected, $cronJob->canRun($cronJobExecution));
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function buildTestCanRunData(): iterable
|
||||
{
|
||||
yield [
|
||||
(new CronJobExecution('last-canceled-workflow-id'))->setLastEnd(new \DateTimeImmutable('2023-12-31 00:00:00', new \DateTimeZone('+00:00'))),
|
||||
true,
|
||||
];
|
||||
|
||||
yield [
|
||||
(new CronJobExecution('last-canceled-workflow-id'))->setLastEnd(new \DateTimeImmutable('2023-12-30 23:59:59', new \DateTimeZone('+00:00'))),
|
||||
true,
|
||||
];
|
||||
|
||||
yield [
|
||||
(new CronJobExecution('last-canceled-workflow-id'))->setLastEnd(new \DateTimeImmutable('2023-12-31 00:00:01', new \DateTimeZone('+00:00'))),
|
||||
false,
|
||||
];
|
||||
|
||||
yield [
|
||||
null,
|
||||
true,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \DateMalformedStringException
|
||||
* @throws \DateInvalidTimeZoneException
|
||||
@@ -85,32 +111,6 @@ class CancelStaleWorkflowCronJobTest extends TestCase
|
||||
return $entityWorkflow;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function buildTestCanRunData(): iterable
|
||||
{
|
||||
yield [
|
||||
(new CronJobExecution('last-canceled-workflow-id'))->setLastEnd(new \DateTimeImmutable('2023-12-31 00:00:00', new \DateTimeZone('+00:00'))),
|
||||
true,
|
||||
];
|
||||
|
||||
yield [
|
||||
(new CronJobExecution('last-canceled-workflow-id'))->setLastEnd(new \DateTimeImmutable('2023-12-30 23:59:59', new \DateTimeZone('+00:00'))),
|
||||
true,
|
||||
];
|
||||
|
||||
yield [
|
||||
(new CronJobExecution('last-canceled-workflow-id'))->setLastEnd(new \DateTimeImmutable('2023-12-31 00:00:01', new \DateTimeZone('+00:00'))),
|
||||
false,
|
||||
];
|
||||
|
||||
yield [
|
||||
null,
|
||||
true,
|
||||
];
|
||||
}
|
||||
|
||||
private function buildMessageBus(bool $expectDispatchAtLeastOnce = false): MessageBusInterface
|
||||
{
|
||||
$messageBus = $this->createMock(MessageBusInterface::class);
|
||||
|
Reference in New Issue
Block a user