Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alphp committed Jan 26, 2024
1 parent 335e777 commit 6c127a7
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion tests/LocaleTests/Locale_en_EN_TestTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function testLocale_en_EN () {
$this->assertEquals('Mar', $result, '%h: Abbreviated month name, based on the locale (an alias of %b)');

$result = strftime('%X', '20220306 13:02:03', $locale);
$this->assertEquals('13:02:03', $result, '%X: Preferred time representation based on locale, without the date');
$this->assertMatchesRegularExpression('~1:02:03 PM|13:02:03~', $result, '%X: Preferred time representation based on locale, without the date');

$result = strftime('%c', '20220306 13:02:03', $locale);
$this->assertEquals('March 6, 2022 at 13:02', $result, '%c: Preferred date and time stamp based on locale');
Expand Down
2 changes: 1 addition & 1 deletion tests/LocaleTests/Locale_es_ES_TestTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public function testLocale_es_ES () {
$locale = 'es-ES';

$result = strftime('%a', '20220306 13:02:03', $locale);
$this->assertEquals('dom', $result, '%a: An abbreviated textual representation of the day');
$this->assertMatchesRegularExpression('~dom\.?~', $result, '%a: An abbreviated textual representation of the day');

$result = strftime('%A', '20220306 13:02:03', $locale);
$this->assertEquals('domingo', $result, '%A: A full textual representation of the day');
Expand Down
4 changes: 2 additions & 2 deletions tests/LocaleTests/Locale_eu_TestTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function testLocale_eu () {
$this->assertEquals('mar.', $result, '%b: Abbreviated month name, based on the locale');

$result = strftime('%B', '20220306 13:02:03', $locale);
$this->assertMatchesRegularExpression('|martxoak?|', $result, '%B: Full month name, based on the locale');
$this->assertMatchesRegularExpression('~martxoak?~', $result, '%B: Full month name, based on the locale');

$result = strftime('%h', '20220306 13:02:03', $locale);
$this->assertEquals('mar.', $result, '%h: Abbreviated month name, based on the locale (an alias of %b)');
Expand All @@ -29,7 +29,7 @@ public function testLocale_eu () {
$this->assertEquals('13:02:03', $result, '%X: Preferred time representation based on locale, without the date');

$result = strftime('%c', '20220306 13:02:03', $locale);
$this->assertMatchesRegularExpression('|2022\(e\)ko martxoak?ren 6\(a\) \(?13:02\)?|', $result, '%c: Preferred date and time stamp based on locale');
$this->assertMatchesRegularExpression('~2022\(e\)ko martxoak?ren 6\(a\) \(?13:02\)?~', $result, '%c: Preferred date and time stamp based on locale');

$result = strftime('%x', '20220306 13:02:03', $locale);
$this->assertEquals('22/3/6', $result, '%x: Preferred date representation based on locale, without the time');
Expand Down
2 changes: 1 addition & 1 deletion tests/LocaleTests/Locale_it_CH_TestTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function testLocale_it_CH () {
$this->assertEquals('13:02:03', $result, '%X: Preferred time representation based on locale, without the date');

$result = strftime('%c', '20220306 13:02:03', $locale);
$this->assertMatchesRegularExpression('|6 marzo 2022 (alle ore )?13:02|', $result, '%c: Preferred date and time stamp based on locale');
$this->assertMatchesRegularExpression('~6 marzo 2022 (alle ore )?13:02~', $result, '%c: Preferred date and time stamp based on locale');

$result = strftime('%x', '20220306 13:02:03', $locale);
$this->assertEquals('06.03.22', $result, '%x: Preferred date representation based on locale, without the time');
Expand Down
2 changes: 1 addition & 1 deletion tests/LocaleTests/Locale_it_IT_TestTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function testLocale_it_IT () {
$this->assertEquals('13:02:03', $result, '%X: Preferred time representation based on locale, without the date');

$result = strftime('%c', '20220306 13:02:03', $locale);
$this->assertMatchesRegularExpression('|6 marzo 2022 (alle ore )?13:02|', $result, '%c: Preferred date and time stamp based on locale');
$this->assertMatchesRegularExpression('~6 marzo 2022 (alle ore )?13:02~', $result, '%c: Preferred date and time stamp based on locale');

$result = strftime('%x', '20220306 13:02:03', $locale);
$this->assertEquals('06/03/22', $result, '%x: Preferred date representation based on locale, without the time');
Expand Down
4 changes: 2 additions & 2 deletions tests/strftimeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public function testTimeFormats () {
$this->assertEquals('13:02:03', $result, '%T: Same as "%H:%M:%S"');

$result = strftime('%X', '20220306 13:02:03', 'en-EN');
$this->assertEquals('13:02:03', $result, '%X: Preferred time representation based on locale, without the date');
$this->assertMatchesRegularExpression('~1:02:03 PM|13:02:03~', $result, '%X: Preferred time representation based on locale, without the date');

$result = strftime('%z', '20220306 13:02:03');
$this->assertEquals('+0100', $result, '%z: The time zone offset');
Expand All @@ -146,7 +146,7 @@ public function testTimeFormats () {

public function testStampsFormats () {
$result = strftime('%c', '20220306 13:02:03', 'en-EN');
$this->assertEquals('March 6, 2022 at 13:02', $result, '%c: Preferred date and time stamp based on locale');
$this->assertMatchesRegularExpression('~March 6, 2022 at (1:02 PM|13:02)~', $result, '%c: Preferred date and time stamp based on locale');

$result = strftime('%D', '20220306 13:02:03');
$this->assertEquals('03/06/2022', $result, '%D: Same as "%m/%d/%y"');
Expand Down

0 comments on commit 6c127a7

Please sign in to comment.