mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
php cs cleanup
This commit is contained in:
@@ -50,6 +50,32 @@ use Tests\unit\Support\Calendar\Periodicity\YearlyTest;
|
||||
*/
|
||||
final class CalculatorTest extends TestCase
|
||||
{
|
||||
private static function convert(Periodicity $periodicity, array $intervals): array
|
||||
{
|
||||
$periodicityIntervals = [];
|
||||
|
||||
/** @var IntervalProvider $interval */
|
||||
foreach ($intervals as $index => $interval) {
|
||||
$calculator = CalculatorProvider::from($periodicity, $interval);
|
||||
|
||||
$periodicityIntervals["#{$index} {$calculator->label}"] = [$calculator];
|
||||
}
|
||||
|
||||
return $periodicityIntervals;
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideAllPeriodicity
|
||||
*
|
||||
* @throws IntervalException
|
||||
*/
|
||||
public function testGivenADailyPeriodicityWhenCallTheNextDateByIntervalMethodThenReturnsTheExpectedDateSuccessful(CalculatorProvider $provider): void
|
||||
{
|
||||
$calculator = new Calculator();
|
||||
$period = $calculator->nextDateByInterval($provider->epoch(), $provider->periodicity);
|
||||
self::assertSame($provider->expected()->toDateString(), $period->toDateString());
|
||||
}
|
||||
|
||||
public static function provideAllPeriodicity(): iterable
|
||||
{
|
||||
$intervals = [];
|
||||
@@ -68,37 +94,6 @@ final class CalculatorTest extends TestCase
|
||||
}
|
||||
}
|
||||
|
||||
private static function convert(Periodicity $periodicity, array $intervals): array
|
||||
{
|
||||
$periodicityIntervals = [];
|
||||
|
||||
/** @var IntervalProvider $interval */
|
||||
foreach ($intervals as $index => $interval) {
|
||||
$calculator = CalculatorProvider::from($periodicity, $interval);
|
||||
|
||||
$periodicityIntervals["#{$index} {$calculator->label}"] = [$calculator];
|
||||
}
|
||||
|
||||
return $periodicityIntervals;
|
||||
}
|
||||
|
||||
public static function provideSkippedIntervals(): iterable
|
||||
{
|
||||
return CalculatorProvider::providePeriodicityWithSkippedIntervals();
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideAllPeriodicity
|
||||
*
|
||||
* @throws IntervalException
|
||||
*/
|
||||
public function testGivenADailyPeriodicityWhenCallTheNextDateByIntervalMethodThenReturnsTheExpectedDateSuccessful(CalculatorProvider $provider): void
|
||||
{
|
||||
$calculator = new Calculator();
|
||||
$period = $calculator->nextDateByInterval($provider->epoch(), $provider->periodicity);
|
||||
self::assertSame($provider->expected()->toDateString(), $period->toDateString());
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideSkippedIntervals
|
||||
*
|
||||
@@ -110,4 +105,9 @@ final class CalculatorTest extends TestCase
|
||||
$period = $calculator->nextDateByInterval($provider->epoch(), $provider->periodicity, $provider->skip);
|
||||
self::assertSame($provider->expected()->toDateString(), $period->toDateString());
|
||||
}
|
||||
|
||||
public static function provideSkippedIntervals(): iterable
|
||||
{
|
||||
return CalculatorProvider::providePeriodicityWithSkippedIntervals();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user