Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / core / modules / datetime / tests / src / Functional / DateTestBase.php
index 9127eb25d461a40157a78dc2ec82ca24bc31b42f..21bad50ba02da7b3c114aabb91c78301fbb07b3c 100644 (file)
@@ -183,4 +183,20 @@ abstract class DateTestBase extends BrowserTestBase {
       ->save();
   }
 
+  /**
+   * 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.
+   *
+   * @param \Drupal\Core\Datetime\DrupalDateTime $date
+   *   A date object directly generated by the test.
+   */
+  protected function massageTestDate($date) {
+    if ($this->field->getSetting('datetime_type') === DateTimeItem::DATETIME_TYPE_DATE) {
+      // Set the default time for date-only items.
+      $date->setDefaultDateTime();
+    }
+  }
+
 }