public function testMonths() { $ci = new Interval(0, 1); $this->assertInstanceOfInterval($ci); $this->assertInterval($ci, 0, 1, 0, 0, 0, 0); $ci = Interval::months(2); $this->assertInstanceOfInterval($ci); $this->assertInterval($ci, 0, 2, 0, 0, 0, 0); $ci = Interval::month(); $this->assertInstanceOfInterval($ci); $this->assertInterval($ci, 0, 1, 0, 0, 0, 0); $ci = Interval::month(3); $this->assertInstanceOfInterval($ci); $this->assertInterval($ci, 0, 3, 0, 0, 0, 0); }
public function testDiffFilteredNegativeWithSignWithSecondObject() { $dt1 = Date::createFromDate(2001, 1, 31); $dt2 = Date::createFromDate(1999, 1, 1); $this->assertSame(-12, $dt1->diffFiltered(Interval::month(), function (Date $date) { return $date->getYear() === 2000; }, $dt2, false)); }