예제 #1
0
파일: DiffTest.php 프로젝트: hmlb/date
 public function testDiffFilteredNegativeNoSignWithMutated()
 {
     $dt = Date::createFromDate(2000, 1, 31);
     $this->assertSame(2, $dt->diffFiltered(Interval::days(2), function (Date $date) {
         return $date->getDayOfWeek() === Date::SUNDAY;
     }, $dt->copy()->startOfMonth()));
 }
예제 #2
0
파일: SettersTest.php 프로젝트: hmlb/date
 public function testFluentSettersWeeksOverwritesDays()
 {
     $ci = Interval::days(5)->weeks(3);
     $this->assertInterval($ci, 0, 0, 3 * 7, 0, 0, 0);
 }
예제 #3
0
파일: ConstructTest.php 프로젝트: hmlb/date
 public function testDays()
 {
     $ci = new Interval(0, 0, 0, 1);
     $this->assertInstanceOfInterval($ci);
     $this->assertInterval($ci, 0, 0, 1, 0, 0, 0);
     $ci = Interval::days(2);
     $this->assertInstanceOfInterval($ci);
     $this->assertInterval($ci, 0, 0, 2, 0, 0, 0);
     $ci = Interval::dayz(2);
     $this->assertInstanceOfInterval($ci);
     $this->assertInterval($ci, 0, 0, 2, 0, 0, 0);
     $ci = Interval::day();
     $this->assertInstanceOfInterval($ci);
     $this->assertInterval($ci, 0, 0, 1, 0, 0, 0);
     $ci = Interval::day(3);
     $this->assertInstanceOfInterval($ci);
     $this->assertInterval($ci, 0, 0, 3, 0, 0, 0);
 }