| @@ 269-282 (lines=14) @@ | ||
| 266 | ); |
|
| 267 | } |
|
| 268 | ||
| 269 | public function testDiffFilteredUsingMinutesPositiveWithMutated() |
|
| 270 | { |
|
| 271 | $dt = Date::createFromDate(2000, 1, 1)->startOfDay(); |
|
| 272 | $this->assertSame( |
|
| 273 | 60, |
|
| 274 | $dt->diffFiltered( |
|
| 275 | Interval::minute(), |
|
| 276 | function (Date $date) { |
|
| 277 | return $date->getHour() === 12; |
|
| 278 | }, |
|
| 279 | Date::createFromDate(2000, 1, 1)->endOfDay() |
|
| 280 | ) |
|
| 281 | ); |
|
| 282 | } |
|
| 283 | ||
| 284 | public function testDiffFilteredPositiveWithSecondObject() |
|
| 285 | { |
|
| @@ 301-315 (lines=15) @@ | ||
| 298 | ); |
|
| 299 | } |
|
| 300 | ||
| 301 | public function testDiffFilteredNegativeNoSignWithMutated() |
|
| 302 | { |
|
| 303 | $dt = Date::createFromDate(2000, 1, 31); |
|
| 304 | ||
| 305 | $this->assertSame( |
|
| 306 | 2, |
|
| 307 | $dt->diffFiltered( |
|
| 308 | Interval::days(2), |
|
| 309 | function (Date $date) { |
|
| 310 | return $date->getDayOfWeek() === Date::SUNDAY; |
|
| 311 | }, |
|
| 312 | $dt->copy()->startOfMonth() |
|
| 313 | ) |
|
| 314 | ); |
|
| 315 | } |
|
| 316 | ||
| 317 | public function testDiffFilteredNegativeNoSignWithSecondObject() |
|
| 318 | { |
|
| @@ 334-348 (lines=15) @@ | ||
| 331 | ); |
|
| 332 | } |
|
| 333 | ||
| 334 | public function testDiffFilteredNegativeWithSignWithMutated() |
|
| 335 | { |
|
| 336 | $dt = Date::createFromDate(2000, 1, 31); |
|
| 337 | $this->assertSame( |
|
| 338 | -4, |
|
| 339 | $dt->diffFiltered( |
|
| 340 | Interval::week(), |
|
| 341 | function (Date $date) { |
|
| 342 | return $date->getMonth() === 12; |
|
| 343 | }, |
|
| 344 | $dt->copy()->subMonths(3), |
|
| 345 | false |
|
| 346 | ) |
|
| 347 | ); |
|
| 348 | } |
|
| 349 | ||
| 350 | public function testDiffFilteredNegativeWithSignWithSecondObject() |
|
| 351 | { |
|