function DateTestBase::massageTestDate
Same name in this branch
- 8.9.x core/modules/datetime/src/Tests/DateTestBase.php \Drupal\datetime\Tests\DateTestBase::massageTestDate()
Same name in other branches
- 9 core/modules/datetime/tests/src/Functional/DateTestBase.php \Drupal\Tests\datetime\Functional\DateTestBase::massageTestDate()
- 10 core/modules/datetime/tests/src/Functional/DateTestBase.php \Drupal\Tests\datetime\Functional\DateTestBase::massageTestDate()
- 11.x core/modules/datetime/tests/src/Functional/DateTestBase.php \Drupal\Tests\datetime\Functional\DateTestBase::massageTestDate()
Massages test date values.
If a date object is generated directly by a test, then it needs to be adjusted to behave like the computed date from the item.
Parameters
\Drupal\Core\Datetime\DrupalDateTime $date: A date object directly generated by the test.
2 calls to DateTestBase::massageTestDate()
- DateRangeFieldTest::testDateRangeField in core/
modules/ datetime_range/ tests/ src/ Functional/ DateRangeFieldTest.php - Tests date field functionality.
- DateTimeFieldTest::testDateField in core/
modules/ datetime/ tests/ src/ Functional/ DateTimeFieldTest.php - Tests date field functionality.
File
-
core/
modules/ datetime/ tests/ src/ Functional/ DateTestBase.php, line 200
Class
- DateTestBase
- Provides a base class for testing Datetime field functionality.
Namespace
Drupal\Tests\datetime\FunctionalCode
protected function massageTestDate($date) {
if ($this->field
->getSetting('datetime_type') === DateTimeItem::DATETIME_TYPE_DATE) {
// Set the default time for date-only items.
$date->setDefaultDateTime();
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.