diff --git a/core/tests/Drupal/FunctionalTests/AssertLegacyTrait.php b/core/tests/Drupal/FunctionalTests/AssertLegacyTrait.php index be1538785f..ed25123bf6 100644 --- a/core/tests/Drupal/FunctionalTests/AssertLegacyTrait.php +++ b/core/tests/Drupal/FunctionalTests/AssertLegacyTrait.php @@ -302,13 +302,16 @@ protected function assertNoField($field) { * * Raw text refers to the raw HTML that the page generated. * - * @param string $raw + * @param string|object $raw * Raw (HTML) string to look for. * * @deprecated Scheduled for removal in Drupal 9.0.0. * Use $this->assertSession()->responseContains() instead. */ protected function assertRaw($raw) { + if (is_object($raw)) { + $raw = (string) $raw; + } $this->assertSession()->responseContains($raw); }