public function DrupalDateTimeTest::testDateDiff in Drupal 8
Same name and namespace in other branches
- 9 core/tests/Drupal/Tests/Core/Datetime/DrupalDateTimeTest.php \Drupal\Tests\Core\Datetime\DrupalDateTimeTest::testDateDiff()
Test date diffs.
@dataProvider providerTestDateDiff
Parameters
mixed $input1: A DrupalDateTime object.
mixed $input2: Date argument for DrupalDateTime::diff method.
bool $absolute: Absolute flag for DrupalDateTime::diff method.
\DateInterval $expected: The expected result of the DrupalDateTime::diff operation.
File
- core/
tests/ Drupal/ Tests/ Core/ Datetime/ DrupalDateTimeTest.php, line 28
Class
- DrupalDateTimeTest
- @coversDefaultClass \Drupal\Core\Datetime\DrupalDateTime @group Datetime
Namespace
Drupal\Tests\Core\DatetimeCode
public function testDateDiff($input1, $input2, $absolute, \DateInterval $expected) {
$interval = $input1
->diff($input2, $absolute);
$this
->assertEquals($interval, $expected);
}