Fix code quality and run.

This commit is contained in:
James Cole
2023-11-04 14:26:35 +01:00
parent bcf1e4dc13
commit 7436f94feb
15 changed files with 96 additions and 95 deletions

View File

@@ -45,7 +45,7 @@ class NavigationAddPeriodTest extends TestCase
$this->navigation = new Navigation();
}
public static function provideFrequencies(): array
public static function provideFrequencies(): iterable
{
return [
Periodicity::Daily->name => ['periodicity' => Periodicity::Daily, 'from' => Carbon::now(), 'expected' => Carbon::tomorrow()],
@@ -73,7 +73,7 @@ class NavigationAddPeriodTest extends TestCase
];
}
public static function provideMonthPeriods(): array
public static function provideMonthPeriods(): iterable
{
return [
'1M' => ['frequency' => '1M', 'from' => Carbon::parse('2023-06-25'), 'expected' => Carbon::parse('2023-06-25')->addMonthsNoOverflow(1)],
@@ -89,7 +89,7 @@ class NavigationAddPeriodTest extends TestCase
];
}
public static function providePeriods(): array
public static function providePeriods(): iterable
{
return [
'1D' => ['frequency' => '1D', 'from' => Carbon::now(), 'expected' => Carbon::tomorrow()],
@@ -115,7 +115,7 @@ class NavigationAddPeriodTest extends TestCase
];
}
public static function providePeriodsWithSkippingParam(): Generator
public static function providePeriodsWithSkippingParam(): iterable
{
$intervals = [
'2019-01-31 to 2019-02-11' => ['skip' => 10, 'frequency' => 'daily', 'from' => Carbon::parse('2019-01-31'), 'expected' => Carbon::parse('2019-02-11')],
@@ -166,7 +166,7 @@ class NavigationAddPeriodTest extends TestCase
public function testGivenAFrequencyAndSkipIntervalWhenCalculateTheDateThenReturnsTheSkippedDateSuccessful(int $skip, string $frequency, Carbon $from, Carbon $expected)
{
$period = $this->navigation->addPeriod($from, $frequency, $skip);
$this->assertEquals($expected->toDateString(), $period->toDateString());
self::assertSame($expected->toDateString(), $period->toDateString());
}
/**
@@ -175,7 +175,7 @@ class NavigationAddPeriodTest extends TestCase
public function testGivenAFrequencyWhenCalculateTheDateThenReturnsTheExpectedDateSuccessful(string $frequency, Carbon $from, Carbon $expected)
{
$period = $this->navigation->addPeriod($from, $frequency, 0);
$this->assertEquals($expected->toDateString(), $period->toDateString());
self::assertSame($expected->toDateString(), $period->toDateString());
}
/**
@@ -184,7 +184,7 @@ class NavigationAddPeriodTest extends TestCase
public function testGivenAIntervalWhenCallTheNextDateByIntervalMethodThenReturnsTheExpectedDateSuccessful(Periodicity $periodicity, Carbon $from, Carbon $expected)
{
$period = $this->navigation->nextDateByInterval($from, $periodicity);
$this->assertEquals($expected->toDateString(), $period->toDateString());
self::assertSame($expected->toDateString(), $period->toDateString());
}
/**
@@ -193,6 +193,6 @@ class NavigationAddPeriodTest extends TestCase
public function testGivenAMonthFrequencyWhenCalculateTheDateThenReturnsTheLastDayOfMonthSuccessful(string $frequency, Carbon $from, Carbon $expected)
{
$period = $this->navigation->addPeriod($from, $frequency, 0);
$this->assertEquals($expected->toDateString(), $period->toDateString());
self::assertSame($expected->toDateString(), $period->toDateString());
}
}