Example #1
0
 public function testSameValueAs()
 {
     $date = new Date(new Year(2013), Month::DECEMBER(), new MonthDay(3));
     $time = new Time(new Hour(20), new Minute(50), new Second(10));
     $date3 = new Date(new Year(2014), Month::MARCH(), new MonthDay(5));
     $time3 = new Time(new Hour(10), new Minute(52), new Second(40));
     $dateTime1 = new DateTime($date, $time);
     $dateTime2 = new DateTime($date, $time);
     $dateTime3 = new DateTime($date3, $time3);
     $this->assertTrue($dateTime1->sameValueAs($dateTime2));
     $this->assertFalse($dateTime1->sameValueAs($dateTime3));
     $mock = $this->getMock('ValueObjects\\ValueObjectInterface');
     $this->assertFalse($dateTime1->sameValueAs($mock));
 }
 public function testGetDateTime()
 {
     $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($dateTime->sameValueAs($dateTimeWithTz->getDateTime()));
 }