コード例 #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());
 }
コード例 #2
0
ファイル: LocalDateTest.php プロジェクト: peekandpoke/psi
 public function testGetClone()
 {
     $subject = new LocalDate('2016-01-01', 'Europe/Berlin');
     $clone = $subject->getClone();
     // the values must be the same
     $this->assertEquals($subject->getTimestamp(), $clone->getTimestamp());
     $this->assertEquals($subject->getTimezone(), $clone->getTimezone());
     // but they must be represented by other objects
     $this->assertNotSame($subject, $clone);
     $this->assertNotSame($subject->getDate(), $clone->getDate());
     $this->assertNotSame($subject->getTimezone(), $clone->getTimezone());
 }