public function testDiffFilteredPositiveWithSecondObject() { $dt1 = Date::create(2000, 1, 1); $dt2 = $dt1->copy()->addSeconds(80); $this->assertSame(40, $dt1->diffFiltered(Interval::second(), function (Date $date) { return $date->getSecond() % 2 === 0; }, $dt2)); }
public function testSeconds() { $ci = new Interval(0, 0, 0, 0, 0, 0, 1); $this->assertInstanceOfInterval($ci); $this->assertInterval($ci, 0, 0, 0, 0, 0, 1); $ci = Interval::seconds(2); $this->assertInstanceOfInterval($ci); $this->assertInterval($ci, 0, 0, 0, 0, 0, 2); $ci = Interval::second(); $this->assertInstanceOfInterval($ci); $this->assertInterval($ci, 0, 0, 0, 0, 0, 1); $ci = Interval::second(3); $this->assertInstanceOfInterval($ci); $this->assertInterval($ci, 0, 0, 0, 0, 0, 3); }