function DateTimePlusTest::testDateDiff
Same name in other branches
- 9 core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php \Drupal\Tests\Component\Datetime\DateTimePlusTest::testDateDiff()
- 8.9.x core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php \Drupal\Tests\Component\Datetime\DateTimePlusTest::testDateDiff()
- 10 core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php \Drupal\Tests\Component\Datetime\DateTimePlusTest::testDateDiff()
Tests date diffs.
@dataProvider providerTestDateDiff
Parameters
mixed $input1: A DateTimePlus object.
mixed $input2: Date argument for DateTimePlus::diff method.
bool $absolute: Absolute flag for DateTimePlus::diff method.
\DateInterval $expected: The expected result of the DateTimePlus::diff operation.
File
-
core/
tests/ Drupal/ Tests/ Component/ Datetime/ DateTimePlusTest.php, line 74
Class
- DateTimePlusTest
- @coversDefaultClass \Drupal\Component\Datetime\DateTimePlus @group Datetime
Namespace
Drupal\Tests\Component\DatetimeCode
public function testDateDiff($input1, $input2, $absolute, \DateInterval $expected) : void {
$interval = $input1->diff($input2, $absolute);
$this->assertEquals($interval, $expected);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.