$this->assertSame('\\l, 25-Mar-07 17:00:00 PDT',$formatter->format($timestamp,'custom','\\\\\\l, d-M-y H:i:s T','America/Los_Angeles',self::LANGCODE),'Test format containing backslash followed by escaped format string.');
$this->assertSame('Monday, 26-Mar-07 01:00:00 BST',$formatter->format($timestamp,'custom','l, d-M-y H:i:s T','Europe/London','en'),'Test a different time zone.');
$this->assertSame('Thu, 01/01/1970 - 00:00',$formatter->format(0,'custom','','UTC','en'),'Test custom format with empty string.');
// Make sure we didn't change the configuration override language.
$this->assertSame('en',$language_manager->getConfigOverrideLanguage()->getId(),'Configuration override language not disturbed,');
// Test bad format string will use the fallback format.
$this->assertSame('en',$language_manager->getConfigOverrideLanguage()->getId(),'Configuration override language not disturbed,');
$this->assertSame('Sunday, 25-Mar-07 17:00:00 PDT',$formatter->format($timestamp,'custom','l, d-M-y H:i:s T','America/Los_Angeles','en'),'Test a different language.');
$this->assertSame('Monday, 26-Mar-07 01:00:00 BST',$formatter->format($timestamp,'custom','l, d-M-y H:i:s T','Europe/London'),'Test a different time zone.');
...
...
@@ -84,6 +95,13 @@ public function testFormatDate() {
$this->assertSame('2007-03',$formatter->format($timestamp,'html_month'),'Test html_month date format.');
$this->assertSame('2007',$formatter->format($timestamp,'html_year'),'Test html_year date format.');
// Make sure we didn't change the configuration override language.
$this->assertSame('en',$language_manager->getConfigOverrideLanguage()->getId(),'Configuration override language not disturbed,');
// Test bad format string will use the fallback format.
$this->assertSame('en',$language_manager->getConfigOverrideLanguage()->getId(),'Configuration override language not disturbed,');
// HTML is not escaped by the date formatter, it must be escaped later.
$this->assertSame("<script>alert('2007');</script>",$formatter->format($timestamp,'custom','\<\s\c\r\i\p\t\>\a\l\e\r\t\(\'Y\'\)\;\<\/\s\c\r\i\p\t\>'),'Script tags not removed from dates.');
$this->assertSame('<em>2007</em>',$formatter->format($timestamp,'custom','\<\e\m\>Y\<\/\e\m\>'),'Em tags are not removed from dates.');