コード例 #1
0
 public function test__equals()
 {
     $a = Clock::tick(Clock::system(self::PARIS()), Duration::ofMillis(500));
     $b = Clock::tick(Clock::system(self::PARIS()), Duration::ofMillis(500));
     $this->assertEquals($a->equals($a), true);
     $this->assertEquals($a->equals($b), true);
     $this->assertEquals($b->equals($a), true);
     $this->assertEquals($b->equals($b), true);
     $c = Clock::tick(Clock::system(self::MOSCOW()), Duration::ofMillis(500));
     $this->assertEquals($a->equals($c), false);
     $d = Clock::tick(Clock::system(self::PARIS()), Duration::ofMillis(499));
     $this->assertEquals($a->equals($d), false);
     $this->assertEquals($a->equals(null), false);
     $this->assertEquals($a->equals("other type"), false);
     $this->assertEquals($a->equals(Clock::systemUTC()), false);
 }
コード例 #2
0
 /**
  * @dataProvider provider_factory_millis_long
  */
 public function test_factory_millis_long($millis, $expectedSeconds, $expectedNanoOfSecond)
 {
     $test = Duration::ofMillis($millis);
     $this->assertEquals($test->getSeconds(), $expectedSeconds);
     $this->assertEquals($test->getNano(), $expectedNanoOfSecond);
 }