Skip to content

Commit

Permalink
remove some assertion that are not working at all with ICU56
Browse files Browse the repository at this point in the history
and allow assertTimeFormat to output an error message to help debugging
  • Loading branch information
antograssiot committed Dec 5, 2015
1 parent a6a1924 commit d2825d6
Showing 1 changed file with 5 additions and 20 deletions.
25 changes: 5 additions & 20 deletions tests/TestCase/I18n/TimeTest.php
Expand Up @@ -543,23 +543,11 @@ public function testI18nFormat()

$result = $time->i18nFormat(\IntlDateFormatter::FULL, null, 'es-ES');
$expected = 'jueves, 14 de enero de 2010, 13:59:28 (GMT)';
$this->assertTimeFormat($expected, $result, 'DEfault locale should not be used');

$result = $time->i18nFormat(\IntlDateFormatter::FULL, null, 'fa-AF');
$expected = 'پنجشنبه ۱۴ جنوری ۲۰۱۰، ساعت ۱۳:۵۹:۲۸ (GMT)';
$this->assertTimeFormat($expected, $result);
$this->assertTimeFormat($expected, $result, 'Default locale should not be used');

$result = $time->i18nFormat(\IntlDateFormatter::FULL, null, 'fa-SA');
$expected = 'پنجشنبه ۱۴ ژانویهٔ ۲۰۱۰، ساعت ۱۳:۵۹:۲۸ (GMT)';
$this->assertTimeFormat($expected, $result);

$result = $time->i18nFormat(\IntlDateFormatter::FULL, null, 'fa-IR');
$expected = 'پنجشنبه ۱۴ ژانویهٔ ۲۰۱۰ م.، ساعت ۱۳:۵۹:۲۸ (GMT)';
$this->assertTimeFormat($expected, $result);

$result = $time->i18nFormat(\IntlDateFormatter::FULL, null, 'fa-IR@calendar=persian');
$expected = 'پنجشنبه ۲۴ دی ۱۳۸۸ ه‍.ش.، ساعت ۱۳:۵۹:۲۸ (GMT)';
$this->assertTimeFormat($expected, $result);
$this->assertTimeFormat($expected, $result, 'fa-SA locale should be used');

$result = $time->i18nFormat(\IntlDateFormatter::FULL, null, 'en-IR@calendar=persian');
$expected = 'Thursday, Dey 24, 1388 at 1:59:28 PM GMT';
Expand All @@ -569,10 +557,6 @@ public function testI18nFormat()
$expected = 'پنجشنبه د ۱۳۸۸ د مرغومی ۲۴ ۱۳:۵۹:۲۸ (GMT)';
$this->assertTimeFormat($expected, $result);

$result = $time->i18nFormat(\IntlDateFormatter::FULL, null, 'fa-KW@calendar=islamic');
$expected = 'پنجشنبه ۲۹ محرم ۱۴۳۱ هجری قمری، ساعت ۱۳:۵۹:۲۸ (GMT)';
$this->assertTimeFormat($expected, $result);

$result = $time->i18nFormat(\IntlDateFormatter::FULL, null, 'en-KW@calendar=islamic');
$expected = 'Thursday, Muharram 29, 1431 at 1:59:28 PM GMT';
$this->assertTimeFormat($expected, $result);
Expand Down Expand Up @@ -867,14 +851,15 @@ public function testFromNow()
* @param string $result
* @return void
*/
public function assertTimeFormat($expected, $result)
public function assertTimeFormat($expected, $result, $message = "")
{
$expected = str_replace([',', '(', ')', ' at', ' م.', ' ه‍.ش.', ' AP', ' AH', ' SAKA', 'à '], '', $expected);
$expected = str_replace([' '], ' ', $expected);

$result = str_replace([',', '(', ')', ' at', ' م.', ' ه‍.ش.', ' AP', ' AH', ' SAKA', 'à '], '', $result);
$result = str_replace(['گرینویچ'], 'GMT', $result);
$result = str_replace([' '], ' ', $result);

return $this->assertEquals($expected, $result);
return $this->assertSame($expected, $result, $message);
}
}

0 comments on commit d2825d6

Please sign in to comment.