public function testSameValueAs() { $timeZone1 = new TimeZone(new StringLiteral('Europe/Madrid')); $timeZone2 = new TimeZone(new StringLiteral('Europe/Madrid')); $timeZone3 = new TimeZone(new StringLiteral('Europe/Berlin')); $this->assertTrue($timeZone1->sameValueAs($timeZone2)); $this->assertFalse($timeZone1->sameValueAs($timeZone3)); $mock = $this->getMock('EmbarkNow\\ValueObjects\\ValueObjectInterface'); $this->assertFalse($timeZone1->sameValueAs($mock)); }
public function testGetTimeZone() { $date = new Date(new Year(2013), Month::DECEMBER(), new MonthDay(3)); $time = new Time(new Hour(20), new Minute(50), new Second(10)); $dateTime = new DateTime($date, $time); $timeZone = new TimeZone(new StringLiteral('Europe/Madrid')); $dateTimeWithTz = new DateTimeWithTimeZone($dateTime, $timeZone); $this->assertTrue($timeZone->sameValueAs($dateTimeWithTz->getTimeZone())); }