You are here

public function InlineTest::testParseNestedTimestampListAsDateTimeObject in Lockr 7.3

@dataProvider getTimestampTests

File

vendor/symfony/yaml/Tests/InlineTest.php, line 639

Class

InlineTest

Namespace

Symfony\Component\Yaml\Tests

Code

public function testParseNestedTimestampListAsDateTimeObject($yaml, $year, $month, $day, $hour, $minute, $second) {
  $expected = new \DateTime($yaml);
  $expected
    ->setTimeZone(new \DateTimeZone('UTC'));
  $expected
    ->setDate($year, $month, $day);
  if (\PHP_VERSION_ID >= 70100) {
    $expected
      ->setTime($hour, $minute, $second, 1000000 * ($second - (int) $second));
  }
  else {
    $expected
      ->setTime($hour, $minute, $second);
  }
  $expectedNested = [
    'nested' => [
      $expected,
    ],
  ];
  $yamlNested = "{nested: [{$yaml}]}";
  $this
    ->assertEquals($expectedNested, Inline::parse($yamlNested, Yaml::PARSE_DATETIME));
}