function DateTestBase::massageTestDate
Same name in this branch
- 8.9.x core/modules/datetime/tests/src/Functional/DateTestBase.php \Drupal\Tests\datetime\Functional\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.
File
-
core/
modules/ datetime/ src/ Tests/ DateTestBase.php, line 201
Class
- DateTestBase
- Provides a base class for testing Datetime field functionality.
Namespace
Drupal\datetime\TestsCode
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.