diff --git a/tests/src/Functional/DynamicEntityReferenceBaseTest.php b/tests/src/Functional/DynamicEntityReferenceBaseTest.php
index b8d63e6..f4e669d 100644
--- a/tests/src/Functional/DynamicEntityReferenceBaseTest.php
+++ b/tests/src/Functional/DynamicEntityReferenceBaseTest.php
@@ -239,7 +239,7 @@ class DynamicEntityReferenceBaseTest extends BrowserTestBase {
       'selection_handler' => $settings['entity_test']['handler'],
       'selection_settings_key' => $selection_settings_key,
     ])->toString();
-    $this->assertContains($input->getAttribute('data-autocomplete-path'), $expected_autocomplete_path);
+    $this->assertStringContainsString($input->getAttribute('data-autocomplete-path'), $expected_autocomplete_path);
 
     // Add some extra dynamic entity reference fields.
     $this->getSession()->getPage()->findButton('Add another item')->click();
diff --git a/tests/src/Functional/DynamicEntityReferenceTest.php b/tests/src/Functional/DynamicEntityReferenceTest.php
index a0325b7..87f0965 100644
--- a/tests/src/Functional/DynamicEntityReferenceTest.php
+++ b/tests/src/Functional/DynamicEntityReferenceTest.php
@@ -260,7 +260,7 @@ class DynamicEntityReferenceTest extends BrowserTestBase {
       'selection_handler' => $settings['entity_test_computed_field']['handler'],
       'selection_settings_key' => $selection_settings_key,
     ])->toString();
-    $this->assertContains($input->getAttribute('data-autocomplete-path'), $expected_autocomplete_path);
+    $this->assertStringContainsString($input->getAttribute('data-autocomplete-path'), $expected_autocomplete_path);
 
     // Add some extra dynamic entity reference fields.
     $this->getSession()->getPage()->findButton('Add another item')->click();
@@ -308,7 +308,7 @@ class DynamicEntityReferenceTest extends BrowserTestBase {
         'selection_handler' => $settings[$expected_entity_type]['handler'],
         'selection_settings_key' => $selection_settings_key,
       ])->toString();
-      $this->assertContains($input->getAttribute('data-autocomplete-path'), $expected_autocomplete_path);
+      $this->assertStringContainsString($input->getAttribute('data-autocomplete-path'), $expected_autocomplete_path);
     }
 
     $edit = [
