diff --git a/core/modules/datetime/src/Tests/DateTimeFieldTest.php b/core/modules/datetime/src/Tests/DateTimeFieldTest.php index a2cf49b..4add15f 100644 --- a/core/modules/datetime/src/Tests/DateTimeFieldTest.php +++ b/core/modules/datetime/src/Tests/DateTimeFieldTest.php @@ -142,11 +142,11 @@ function testDateField() { // Test that allowed markup in custom format is preserved and XSS is // removed. - $this->displayOptions['settings']['date_format'] = '\\<\\s\\t\\r\\o\\n\\g\\>m/d/Y\\<\\/\\s\\t\\r\\o\\n\\g\\>\\<\\s\\c\\r\\i\\p\\t\\ \\s\\r\\c\\=\\"\\a\\l\\e\\r\\t\\(\\\'\\s\\o\\m\\e\\ \\x\\s\\s\\\'\\)\\;\\" \\/\\>'; + $this->displayOptions['settings']['date_format'] = '\\<\\s\\t\\r\\o\\n\\g\\>m/d/Y\\<\\/\\s\\t\\r\\o\\n\\g\\>\\<\\s\\c\\r\\i\\p\\t\\>\\a\\l\\e\\r\\t\\(\\"\\X\\S\\S\\"\\)\\<\\/\\s\\c\\r\\i\\p\\t\\>'; entity_get_display($this->field->getTargetEntityTypeId(), $this->field->getTargetBundle(), 'full') ->setComponent($field_name, $this->displayOptions) ->save(); - $expected = '' . $date->format('m/d/Y') . ''; + $expected = '' . $date->format('m/d/Y') . 'alert("XSS")'; $this->renderTestEntity($id); $this->assertRaw($expected, new FormattableMarkup('Formatted date field using daterange_custom format displayed as %expected.', array('%expected' => $expected))); diff --git a/core/modules/datetime_range/src/Tests/DateRangeFieldTest.php b/core/modules/datetime_range/src/Tests/DateRangeFieldTest.php index a2d7b19..319fdbd 100644 --- a/core/modules/datetime_range/src/Tests/DateRangeFieldTest.php +++ b/core/modules/datetime_range/src/Tests/DateRangeFieldTest.php @@ -167,11 +167,11 @@ public function testDateRangeField() { // Test that allowed markup in custom format is preserved and XSS is // removed. - $this->displayOptions['settings']['date_format'] = '\\<\\s\\t\\r\\o\\n\\g\\>m/d/Y\\<\\/\\s\\t\\r\\o\\n\\g\\>\\<\\s\\c\\r\\i\\p\\t\\ \\s\\r\\c\\=\\"\\a\\l\\e\\r\\t\\(\\\'\\s\\o\\m\\e\\ \\x\\s\\s\\\'\\)\\;\\" \\/\\>'; + $this->displayOptions['settings']['date_format'] = '\\<\\s\\t\\r\\o\\n\\g\\>m/d/Y\\<\\/\\s\\t\\r\\o\\n\\g\\>\\<\\s\\c\\r\\i\\p\\t\\>\\a\\l\\e\\r\\t\\(\\"\\X\\S\\S\\"\\)\\<\\/\\s\\c\\r\\i\\p\\t\\>'; entity_get_display($this->field->getTargetEntityTypeId(), $this->field->getTargetBundle(), 'full') ->setComponent($field_name, $this->displayOptions) ->save(); - $expected = '' . $start_date->format('m/d/Y') . ' - ' . $end_date->format('m/d/Y') . ''; + $expected = '' . $start_date->format('m/d/Y') . 'alert("XSS") - ' . $end_date->format('m/d/Y') . 'alert("XSS")'; $this->renderTestEntity($id); $this->assertRaw($expected, new FormattableMarkup('Formatted date field using daterange_custom format displayed as %expected.', array('%expected' => $expected)));