public function testFromNativeDateTime() { $nativeDateTime = new \DateTime(); $nativeDateTime->setTimeZone(new \DateTimeZone('Europe/Madrid'))->setDate(2013, 12, 6)->setTime(20, 50, 10); $dateTimeWithTzFromNative = DateTimeWithTimeZone::fromNativeDateTime($nativeDateTime); $date = new Date(new Year(2013), Month::DECEMBER(), new MonthDay(6)); $time = new Time(new Hour(20), new Minute(50), new Second(10)); $timezone = new TimeZone(new StringLiteral('Europe/Madrid')); $constructedDateTimeWithTz = new DateTimeWithTimeZone(new DateTime($date, $time), $timezone); $this->assertTrue($dateTimeWithTzFromNative->sameValueAs($constructedDateTimeWithTz)); }