diff options
Diffstat (limited to 'tests/helper/DailyPageHelperTest.php')
-rw-r--r-- | tests/helper/DailyPageHelperTest.php | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/helper/DailyPageHelperTest.php b/tests/helper/DailyPageHelperTest.php index 5255b7b1..6238e648 100644 --- a/tests/helper/DailyPageHelperTest.php +++ b/tests/helper/DailyPageHelperTest.php | |||
@@ -121,6 +121,19 @@ class DailyPageHelperTest extends TestCase | |||
121 | static::assertEquals($expectedDescription, $description); | 121 | static::assertEquals($expectedDescription, $description); |
122 | } | 122 | } |
123 | 123 | ||
124 | /** | ||
125 | * @dataProvider getDescriptionsByTypeNotIncludeRelative | ||
126 | */ | ||
127 | public function testGeDescriptionsByTypeNotIncludeRelative( | ||
128 | string $type, | ||
129 | \DateTimeImmutable $dateTime, | ||
130 | string $expectedDescription | ||
131 | ): void { | ||
132 | $description = DailyPageHelper::getDescriptionByType($type, $dateTime, false); | ||
133 | |||
134 | static::assertEquals($expectedDescription, $description); | ||
135 | } | ||
136 | |||
124 | public function getDescriptionByTypeExceptionUnknownType(): void | 137 | public function getDescriptionByTypeExceptionUnknownType(): void |
125 | { | 138 | { |
126 | $this->expectException(\Exception::class); | 139 | $this->expectException(\Exception::class); |
@@ -249,6 +262,20 @@ class DailyPageHelperTest extends TestCase | |||
249 | } | 262 | } |
250 | 263 | ||
251 | /** | 264 | /** |
265 | * Data provider for testGeDescriptionsByTypeNotIncludeRelative() test method. | ||
266 | */ | ||
267 | public function getDescriptionsByTypeNotIncludeRelative(): array | ||
268 | { | ||
269 | return [ | ||
270 | [DailyPageHelper::DAY, $date = new \DateTimeImmutable(), $date->format('F j, Y')], | ||
271 | [DailyPageHelper::DAY, $date = new \DateTimeImmutable('-1 day'), $date->format('F j, Y')], | ||
272 | [DailyPageHelper::DAY, new \DateTimeImmutable('2020-10-09 04:05:06'), 'October 9, 2020'], | ||
273 | [DailyPageHelper::WEEK, new \DateTimeImmutable('2020-10-09 04:05:06'), 'Week 41 (October 5, 2020)'], | ||
274 | [DailyPageHelper::MONTH, new \DateTimeImmutable('2020-10-09 04:05:06'), 'October, 2020'], | ||
275 | ]; | ||
276 | } | ||
277 | |||
278 | /** | ||
252 | * Data provider for testGetDescriptionsByType() test method. | 279 | * Data provider for testGetDescriptionsByType() test method. |
253 | */ | 280 | */ |
254 | public function getRssLengthsByType(): array | 281 | public function getRssLengthsByType(): array |