public function test_equals() { $a = Clock::systemUTC(); $b = Clock::systemUTC(); $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::system(self::PARIS()); $d = Clock::system(self::PARIS()); $this->assertEquals($c->equals($c), true); $this->assertEquals($c->equals($d), true); $this->assertEquals($d->equals($c), true); $this->assertEquals($d->equals($d), true); $this->assertEquals($a->equals($c), false); $this->assertEquals($c->equals($a), false); $this->assertEquals($a->equals(null), false); $this->assertEquals($a->equals("other type"), false); $this->assertEquals($a->equals(Clock::fixed(Instant::now(), ZoneOffset::UTC())), false); }
public function test_equals() { $a = Clock::offset(Clock::system(self::PARIS()), self::OFFSET()); $b = Clock::offset(Clock::system(self::PARIS()), self::OFFSET()); $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::offset(Clock::system(self::MOSCOW()), self::OFFSET()); $this->assertEquals($a->equals($c), false); $d = Clock::offset(Clock::system(self::PARIS()), self::OFFSET()->minusNanos(1)); $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); }
public function test_equals() { $a = Clock::fixed(self::INSTANT(), ZoneOffset::UTC()); $b = Clock::fixed(self::INSTANT(), ZoneOffset::UTC()); $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::fixed(self::INSTANT(), self::PARIS()); $this->assertEquals($a->equals($c), false); $d = Clock::fixed(self::INSTANT()->minusNanos(1), ZoneOffset::UTC()); $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); }