diff --git a/core/modules/datetime_range/tests/src/Functional/DateRangeFieldTest.php b/core/modules/datetime_range/tests/src/Functional/DateRangeFieldTest.php index 685da99387..e7f0fbbd47 100644 --- a/core/modules/datetime_range/tests/src/Functional/DateRangeFieldTest.php +++ b/core/modules/datetime_range/tests/src/Functional/DateRangeFieldTest.php @@ -1125,6 +1125,7 @@ public function testInvalidField() { $this->fieldStorage->setSetting('datetime_type', DateRangeItem::DATETIME_TYPE_DATETIME); $this->fieldStorage->save(); $field_name = $this->fieldStorage->getName(); + $field_label = $this->field->label(); $this->drupalGet('entity_test/add'); $this->assertFieldByName("{$field_name}[0][value][date]", '', 'Start date element found.'); @@ -1303,7 +1304,7 @@ public function testInvalidField() { "{$field_name}[0][end_value][time]" => '12:00:00', ]; $this->drupalPostForm(NULL, $edit, t('Save')); - $this->assertText(new FormattableMarkup('The @title end date cannot be before the start date', ['@title' => $field_name]), 'End date before start date has been caught.'); + $this->assertText(new FormattableMarkup('The @title end date cannot be before the start date', ['@title' => $field_label]), 'End date before start date has been caught.'); $edit = [ "{$field_name}[0][value][date]" => '2012-12-01', @@ -1312,7 +1313,7 @@ public function testInvalidField() { "{$field_name}[0][end_value][time]" => '11:00:00', ]; $this->drupalPostForm(NULL, $edit, t('Save')); - $this->assertText(new FormattableMarkup('The @title end date cannot be before the start date', ['@title' => $field_name]), 'End time before start time has been caught.'); + $this->assertText(new FormattableMarkup('The @title end date cannot be before the start date', ['@title' => $field_label]), 'End time before start time has been caught.'); } /**