Ejemplo n.º 1
0
 public function testSubject()
 {
     $subject = new String2LocalDate(new \DateTimeZone('Europe/Berlin'));
     $expected = new LocalDate('2016-01-01', 'Europe/Berlin');
     /** @noinspection ImplicitMagicMethodCallInspection */
     $this->assertEquals($expected->getTimestamp(), $subject->__invoke('2016-01-01')->getTimestamp());
     /** @noinspection ImplicitMagicMethodCallInspection */
     $this->assertEquals($expected->getTimezone(), $subject->__invoke('2016-01-01')->getTimezone());
 }
Ejemplo n.º 2
0
 public function testIsAfterOrEqual()
 {
     $subject = new LocalDate('2016-02-08T00:00:00', 'Europe/Berlin');
     $compare = new LocalDate('2016-02-08T01:30:00', 'Europe/Berlin');
     $this->assertFalse($subject->isAfterOrEqual($compare));
     $subject = new LocalDate('2016-02-08T01:30:00', 'Europe/Berlin');
     $compare = new LocalDate('2016-02-08T01:30:00', 'Europe/Berlin');
     $this->assertTrue($subject->isAfterOrEqual($compare));
     $subject = new LocalDate('2016-02-08T01:30:00', 'Europe/Berlin');
     $compare = new LocalDate('2016-02-08T01:29:59', 'Europe/Berlin');
     $this->assertTrue($subject->isAfterOrEqual($compare));
     // also test across time zones
     $subject = new LocalDate('2016-02-08T01:30:00', 'Europe/Berlin');
     $compare = new LocalDate('2016-02-08T00:30:00', 'Europe/London');
     $this->assertTrue($subject->isAfterOrEqual($compare));
     // also test across time zones
     $subject = new LocalDate('2016-02-08T01:30:00', 'Europe/Berlin');
     $compare = new LocalDate('2016-02-08T00:29:59', 'Europe/London');
     $this->assertTrue($subject->isAfterOrEqual($compare));
     // also test across time zones
     $subject = new LocalDate('2016-02-08T01:30:00', 'Europe/Berlin');
     $compare = new LocalDate('2016-02-08T00:30:01', 'Europe/London');
     $this->assertFalse($subject->isAfterOrEqual($compare));
 }