File tree Expand file tree Collapse file tree 3 files changed +154
-0
lines changed Expand file tree Collapse file tree 3 files changed +154
-0
lines changed Original file line number Diff line number Diff line change @@ -181,4 +181,23 @@ public function testDateFormatDifferentYear(): void
181
181
$ formatted = formatDate ("2000-04-12 " , "M j[, Y] " );
182
182
$ this ->assertEquals ("Apr 12, 2000 " , $ formatted );
183
183
}
184
+
185
+ /**
186
+ * Test date formatter no brackets different year
187
+ */
188
+ public function testDateFormatNoBracketsDiffYear (): void
189
+ {
190
+ $ formatted = formatDate ("2000-04-12 " , "Y/m/d " );
191
+ $ this ->assertEquals ("2000/04/12 " , $ formatted );
192
+ }
193
+
194
+ /**
195
+ * Test date formatter no brackets same year
196
+ */
197
+ public function testDateFormatNoBracketsSameYear (): void
198
+ {
199
+ $ year = date ("Y " );
200
+ $ formatted = formatDate ("$ year-04-12 " , "Y/m/d " );
201
+ $ this ->assertEquals ("$ year/04/12 " , $ formatted );
202
+ }
184
203
}
Original file line number Diff line number Diff line change @@ -56,6 +56,20 @@ public function testErrorCardRender(): void
56
56
$ this ->assertEquals ($ expected , $ render );
57
57
}
58
58
59
+ /**
60
+ * Test date_format parameter in render
61
+ */
62
+ public function testDateFormatRender (): void
63
+ {
64
+ $ year = date ("Y " );
65
+ $ this ->testStats ["currentStreak " ]["end " ] = "$ year-04-12 " ;
66
+ $ this ->testParams ["date_format " ] = "[Y-]m-d " ;
67
+ // Check that the card is rendered as expected
68
+ $ render = generateCard ($ this ->testStats , $ this ->testParams );
69
+ $ expected = file_get_contents ("tests/expected/test_date_card.svg " );
70
+ $ this ->assertEquals ($ expected , $ render );
71
+ }
72
+
59
73
/**
60
74
* Test JSON render
61
75
*/
You can’t perform that action at this time.
0 commit comments