aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2020-12-16 16:04:53 +0100
committerGitHub <noreply@github.com>2020-12-16 16:04:53 +0100
commitab4c170672c0679c5b8ebc6065e3ca2b13165f24 (patch)
tree173cd95c3b6d4972dcc8b003a6a225e8eb8d5f4e /tests
parentbd11879018416d2c5d87728bb0be6ee0cf54451a (diff)
parent2883c6d0a71db174ee8df7548178a8fbee486e25 (diff)
downloadShaarli-ab4c170672c0679c5b8ebc6065e3ca2b13165f24.tar.gz
Shaarli-ab4c170672c0679c5b8ebc6065e3ca2b13165f24.tar.zst
Shaarli-ab4c170672c0679c5b8ebc6065e3ca2b13165f24.zip
Merge pull request #1644 from ArthurHoaro/fix/daily-rss
Daily RSS - Remove relative description (today, yesterday)
Diffstat (limited to 'tests')
-rw-r--r--tests/helper/DailyPageHelperTest.php27
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