public function testFluentSettersWeeksAndDaysIsCumulative() { $ci = Interval::year(5)->weeksAndDays(2, 6); $this->assertInterval($ci, 5, 0, 20, 0, 0, 0); $this->assertSame(20, $ci->dayz); $this->assertSame(2, $ci->weeks); $this->assertSame(6, $ci->dayzExcludeWeeks); }
public function testYears() { $ci = new Interval(1); $this->assertInstanceOfInterval($ci); $this->assertInterval($ci, 1, 0, 0, 0, 0, 0); $ci = Interval::years(2); $this->assertInstanceOfInterval($ci); $this->assertInterval($ci, 2, 0, 0, 0, 0, 0); $ci = Interval::year(); $this->assertInstanceOfInterval($ci); $this->assertInterval($ci, 1, 0, 0, 0, 0, 0); $ci = Interval::year(3); $this->assertInstanceOfInterval($ci); $this->assertInterval($ci, 3, 0, 0, 0, 0, 0); }
public function testYearToString() { Interval::setLocale('en'); $this->assertSame('1 year:abc', Interval::year() . ':abc'); }
public function testDiffFilteredNegativeNoSignWithSecondObject() { $dt1 = Date::createFromDate(2006, 1, 31); $dt2 = Date::createFromDate(2000, 1, 1); $this->assertSame(7, $dt1->diffFiltered(Interval::year(), function (Date $date) { return $date->getMonth() === 1; }, $dt2)); }
/** * @expectedException \InvalidArgumentException */ public function testGettersThrowExceptionOnUnknownGetter() { Interval::year()->sdfsdfss; }