Ejemplo n.º 1
0
 public function testEarlierThan()
 {
     $object1 = DateTimeOfDay::create(Date::create(2005, 10, 11), TimeOfDay::create(15, 13, 13));
     $object2 = DateTimeOfDay::create(Date::create(2005, 10, 11), TimeOfDay::create(15, 12, 13));
     static::assertFalse($object1->earlierThan($object2));
     $object1 = DateTimeOfDay::create(Date::create(2005, 10, 11), TimeOfDay::create(15, 12, 13));
     $object2 = DateTimeOfDay::create(Date::create(2005, 10, 11), TimeOfDay::create(15, 12, 13));
     static::assertFalse($object1->earlierThan($object2));
     $object1 = DateTimeOfDay::create(Date::create(2005, 10, 11), TimeOfDay::create(15, 11, 13));
     $object2 = DateTimeOfDay::create(Date::create(2005, 10, 11), TimeOfDay::create(15, 12, 13));
     static::assertTrue($object1->earlierThan($object2));
 }
Ejemplo n.º 2
0
 public function testEarlierThan()
 {
     $object1 = TimeOfDay::create(10, 2, 6);
     $object2 = TimeOfDay::createFromDateTime(new DateTime('10:02:05'));
     static::assertFalse($object1->earlierThan($object2));
     $object1 = TimeOfDay::create(10, 2, 5);
     $object2 = TimeOfDay::createFromDateTime(new DateTime('10:02:05'));
     static::assertFalse($object1->earlierThan($object2));
     $object1 = TimeOfDay::create(10, 2, 4);
     $object2 = TimeOfDay::createFromDateTime(new DateTime('10:02:05'));
     static::assertTrue($object1->earlierThan($object2));
 }
Ejemplo n.º 3
0
 /**
  * @param DateTimeInterface $dateTime
  *
  * @return self
  */
 public static function createFromDateTime(DateTimeInterface $dateTime)
 {
     return static::create(Date::createFromDateTime($dateTime), TimeOfDay::createFromDateTime($dateTime));
 }
Ejemplo n.º 4
0
 public function validProvider()
 {
     return [[Date::create(2015, 6, 15), Date::create(2015, 6, 17), Duration::create(0, 0, 2, 0, 0, 0), '2015-06-15T00:00:00/2015-06-17T00:00:00'], [DateTimeOfDay::create(Date::create(2012, 6, 17), TimeOfDay::create(23, 1, 0)), DateTimeOfDay::create(Date::create(2015, 6, 17), TimeOfDay::create(23, 2, 0)), Duration::create(3, 0, 0, 0, 1, 0)], [Date::create(2015, 6, 15), Duration::create(0, 1, 5, 0, 0, 0), Duration::create(0, 1, 5, 0, 0, 0)], [Duration::create(0, 5, 12, 0, 0, 0), Date::create(2015, 6, 17), Duration::create(0, 5, 12, 0, 0, 0), '2015-01-05T00:00:00/2015-06-17T00:00:00']];
 }