Skip to content

Commit 3e2e401

Browse files
committed
test: add test for Time::__toString()
1 parent 471176e commit 3e2e401

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/system/I18n/TimeTest.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Config\App;
1818
use DateTime;
1919
use DateTimeZone;
20+
use Generator;
2021
use IntlDateFormatter;
2122
use Locale;
2223

@@ -1138,4 +1139,25 @@ public function testSetTestNowWithFaLocale()
11381139

11391140
Locale::setDefault($currentLocale);
11401141
}
1142+
1143+
/**
1144+
* @dataProvider provideLocales
1145+
*/
1146+
public function testToStringDoesNotDependOnLocale(string $locale)
1147+
{
1148+
Locale::setDefault($locale);
1149+
1150+
$time = new Time('2017/03/10 12:00');
1151+
1152+
$this->assertSame('2017-03-10 12:00:00', (string) $time);
1153+
}
1154+
1155+
public function provideLocales(): Generator
1156+
{
1157+
yield from [
1158+
['en'],
1159+
['de'],
1160+
['fa'],
1161+
];
1162+
}
11411163
}

0 commit comments

Comments
 (0)