[Yaml] Fix tests

This commit is contained in:
Nicolas Grekas 2016-03-10 15:06:18 +01:00
parent fe012e8abb
commit 25677febe1
2 changed files with 3 additions and 2 deletions

View File

@ -588,7 +588,7 @@ class Inline
return (float) str_replace(',', '', $scalar);
case preg_match(self::getTimestampRegex(), $scalar):
if (Yaml::PARSE_DATETIME & $flags) {
return new \DateTime($scalar,new \DateTimeZone('UTC'));
return new \DateTime($scalar, new \DateTimeZone('UTC'));
}
$timeZone = date_default_timezone_get();

View File

@ -495,7 +495,8 @@ class InlineTest extends \PHPUnit_Framework_TestCase
*/
public function testParseTimestampAsDateTimeObject($yaml, $year, $month, $day, $hour, $minute, $second)
{
$expected = new \DateTime('now', new \DateTimeZone('UTC'));
$expected = new \DateTime($yaml);
$expected->setTimeZone(new \DateTimeZone('UTC'));
$expected->setDate($year, $month, $day);
$expected->setTime($hour, $minute, $second);