Skip to content
Permalink
Browse files

Add tests related to #9818

While this doesn't cover the magic property being modified, I suspect
that might be related to a PHP issue.
  • Loading branch information...
markstory committed Nov 30, 2016
1 parent 2c0afb5 commit 8b2f80b83f3e2c8dd8099f30dbd0729310edac9d
Showing with 22 additions and 0 deletions.
  1. +22 −0 tests/TestCase/I18n/TimeTest.php
@@ -50,10 +50,13 @@ public function tearDown()
Time::setTestNow($this->now);
Time::setDefaultLocale($this->locale);
Time::resetToStringFormat();
Time::setJsonEncodeFormat("yyyy-MM-dd'T'HH:mm:ssxxx");
FrozenTime::setTestNow($this->frozenNow);
FrozenTime::setDefaultLocale($this->locale);
FrozenTime::resetToStringFormat();
FrozenTime::setJsonEncodeFormat("yyyy-MM-dd'T'HH:mm:ssxxx");
date_default_timezone_set('UTC');
I18n::locale(I18n::DEFAULT_LOCALE);
}
@@ -723,6 +726,25 @@ public function testJsonEncode($class)
$this->assertEquals('1397988610', json_encode($time));
}
/**
* Test jsonSerialize no side-effects
*
* @dataProvider classNameProvider
* @return void
*/
public function testJsonEncodeSideEffectFree($class)
{
if (version_compare(INTL_ICU_VERSION, '50.0', '<')) {
$this->markTestSkipped('ICU 5x is needed');
}
$date = new \Cake\I18n\FrozenTime('2016-11-29 09:00:00');
$this->assertInstanceOf('DateTimeZone', $date->timezone);
$result = json_encode($date);
$this->assertEquals('"2016-11-29T09:00:00+00:00"', $result);
$this->assertInstanceOf('DateTimeZone', $date->getTimezone());
}
/**
* Tests debugInfo
*

0 comments on commit 8b2f80b

Please sign in to comment.
You can’t perform that action at this time.