mirror of
https://github.com/wiosna-dev/common-library.git
synced 2026-03-12 09:31:51 +01:00
Increase Mutation Score Indicator (MSI) by removing "src/Type/DatePeriod.php:120 [M] TrueValue" mutant
This commit is contained in:
@@ -77,6 +77,18 @@ class DatePeriodTest extends BaseTypeTestCase
|
||||
self::assertEquals('', $period->getFormattedDate($format));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param DatePeriod $period The date period to verify
|
||||
* @param string $format Format used to format the date
|
||||
* @param string $expected Expected, formatted date
|
||||
*
|
||||
* @dataProvider provideDatePeriodAndDateFormatUsingStartDateOnly
|
||||
*/
|
||||
public function testGetFormattedDateUsingStartDateOnly(DatePeriod $period, $format, $expected): void
|
||||
{
|
||||
self::assertEquals($expected, $period->getFormattedDate($format));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param DatePeriod $period The date period to verify
|
||||
* @param string $format Format used to format the date
|
||||
@@ -144,6 +156,41 @@ class DatePeriodTest extends BaseTypeTestCase
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides period and format of date to verify using the start date
|
||||
*
|
||||
* @return Generator
|
||||
*/
|
||||
public function provideDatePeriodAndDateFormatUsingStartDateOnly(): Generator
|
||||
{
|
||||
$startDate = new DateTime('2001-01-01');
|
||||
$endDate = new DateTime('2002-02-02');
|
||||
|
||||
yield[
|
||||
new DatePeriod($startDate, $endDate),
|
||||
'Y',
|
||||
'2001',
|
||||
];
|
||||
|
||||
yield[
|
||||
new DatePeriod($startDate, $endDate),
|
||||
'D',
|
||||
'Mon',
|
||||
];
|
||||
|
||||
yield[
|
||||
new DatePeriod($startDate, $endDate),
|
||||
'Y-m-d',
|
||||
'2001-01-01',
|
||||
];
|
||||
|
||||
yield[
|
||||
new DatePeriod($startDate, $endDate),
|
||||
'Y-m-d H:i',
|
||||
'2001-01-01 00:00',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides period and format of date to verify
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user