diff options
author | ArthurHoaro <arthur@hoa.ro> | 2020-11-15 12:05:08 +0100 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2020-11-15 12:05:08 +0100 |
commit | 2883c6d0a71db174ee8df7548178a8fbee486e25 (patch) | |
tree | c87ffa62e71463a917fb4c5960f25c84b379a885 /tests/helper | |
parent | 6f9e0609f4c118142504234ebcc7d93456b5e588 (diff) | |
download | Shaarli-2883c6d0a71db174ee8df7548178a8fbee486e25.tar.gz Shaarli-2883c6d0a71db174ee8df7548178a8fbee486e25.tar.zst Shaarli-2883c6d0a71db174ee8df7548178a8fbee486e25.zip |
Daily RSS - Remove relative description (today, yesterday)
It is not useful for the RSS feed, as every new entry will be 'yesterday', and it requires an update the next day.
Diffstat (limited to 'tests/helper')
-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 |