You are here

public function InlineTest::testParseTimestampAsDateTimeObject in Lockr 7.3

@dataProvider getTimestampTests

File

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

Class

InlineTest

Namespace

Symfony\Component\Yaml\Tests

Code

public function testParseTimestampAsDateTimeObject($yaml, $year, $month, $day, $hour, $minute, $second, $timezone) {
  $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);
  }
  $date = Inline::parse($yaml, Yaml::PARSE_DATETIME);
  $this
    ->assertEquals($expected, $date);
  $this
    ->assertSame($timezone, $date
    ->format('O'));
}