diff --git a/core/phpunit.xml.dist b/core/phpunit.xml.dist
index bd9c833809..42f4419115 100644
--- a/core/phpunit.xml.dist
+++ b/core/phpunit.xml.dist
@@ -9,6 +9,7 @@
          beStrictAboutTestsThatDoNotTestAnything="true"
          beStrictAboutOutputDuringTests="true"
          beStrictAboutChangesToGlobalState="true"
+         failOnWarning="true"
          printerClass="\Drupal\Tests\Listeners\HtmlOutputPrinter"
          cacheResult="false">
   <php>
diff --git a/core/tests/Drupal/BuildTests/Framework/BuildTestBase.php b/core/tests/Drupal/BuildTests/Framework/BuildTestBase.php
index 47a086064f..984c363c9f 100644
--- a/core/tests/Drupal/BuildTests/Framework/BuildTestBase.php
+++ b/core/tests/Drupal/BuildTests/Framework/BuildTestBase.php
@@ -7,6 +7,7 @@
 use Behat\Mink\Mink;
 use Behat\Mink\Session;
 use Drupal\Component\FileSystem\FileSystem as DrupalFilesystem;
+use Drupal\Tests\Traits\PHPUnit8Warnings;
 use PHPUnit\Framework\TestCase;
 use Symfony\Component\BrowserKit\Client as SymfonyClient;
 use Symfony\Component\Filesystem\Filesystem as SymfonyFilesystem;
@@ -52,6 +53,7 @@
 abstract class BuildTestBase extends TestCase {
 
   use ExternalCommandRequirementsTrait;
+  use PHPUnit8Warnings;
 
   /**
    * The working directory where this test will manipulate files.
diff --git a/core/tests/Drupal/KernelTests/KernelTestBase.php b/core/tests/Drupal/KernelTests/KernelTestBase.php
index a74c1cbbd0..4539ed4850 100644
--- a/core/tests/Drupal/KernelTests/KernelTestBase.php
+++ b/core/tests/Drupal/KernelTests/KernelTestBase.php
@@ -21,6 +21,7 @@
 use Drupal\Tests\ConfigTestTrait;
 use Drupal\Tests\RandomGeneratorTrait;
 use Drupal\Tests\TestRequirementsTrait;
+use Drupal\Tests\Traits\PHPUnit8Warnings;
 use Drupal\TestTools\Comparator\MarkupInterfaceComparator;
 use PHPUnit\Framework\Exception;
 use PHPUnit\Framework\TestCase;
@@ -80,6 +81,7 @@ abstract class KernelTestBase extends TestCase implements ServiceProviderInterfa
   use RandomGeneratorTrait;
   use ConfigTestTrait;
   use TestRequirementsTrait;
+  use PHPUnit8Warnings;
 
   /**
    * {@inheritdoc}
diff --git a/core/tests/Drupal/Tests/BrowserTestBase.php b/core/tests/Drupal/Tests/BrowserTestBase.php
index e3028748bf..7226e9a4a6 100644
--- a/core/tests/Drupal/Tests/BrowserTestBase.php
+++ b/core/tests/Drupal/Tests/BrowserTestBase.php
@@ -16,6 +16,7 @@
 use Drupal\Tests\block\Traits\BlockCreationTrait;
 use Drupal\Tests\node\Traits\ContentTypeCreationTrait;
 use Drupal\Tests\node\Traits\NodeCreationTrait;
+use Drupal\Tests\Traits\PHPUnit8Warnings;
 use Drupal\Tests\user\Traits\UserCreationTrait;
 use Drupal\TestTools\Comparator\MarkupInterfaceComparator;
 use GuzzleHttp\Cookie\CookieJar;
@@ -63,6 +64,7 @@ abstract class BrowserTestBase extends TestCase {
     createUser as drupalCreateUser;
   }
   use XdebugRequestTrait;
+  use PHPUnit8Warnings;
 
   /**
    * The database prefix of this test run.
diff --git a/core/tests/Drupal/Tests/Component/Annotation/Doctrine/DocParserTest.php b/core/tests/Drupal/Tests/Component/Annotation/Doctrine/DocParserTest.php
index 1e2eec14f9..d894ddccbd 100644
--- a/core/tests/Drupal/Tests/Component/Annotation/Doctrine/DocParserTest.php
+++ b/core/tests/Drupal/Tests/Component/Annotation/Doctrine/DocParserTest.php
@@ -561,7 +561,7 @@ public function testAnnotationWithVarTypeError($attribute,$type,$value,$given)
             $parser->parse($docblock, $context);
             $this->fail();
         } catch (\Doctrine\Common\Annotations\AnnotationException $exc) {
-            $this->assertContains("[Type Error] Attribute \"$attribute\" of @Drupal\Tests\Component\Annotation\Doctrine\Fixtures\AnnotationWithVarType declared on property SomeClassName::invalidProperty. expects a(n) $type, but got $given.", $exc->getMessage());
+            $this->assertStringContainsString("[Type Error] Attribute \"$attribute\" of @Drupal\Tests\Component\Annotation\Doctrine\Fixtures\AnnotationWithVarType declared on property SomeClassName::invalidProperty. expects a(n) $type, but got $given.", $exc->getMessage());
         }
     }
 
@@ -580,7 +580,7 @@ public function testAnnotationWithVarTypeArrayError($attribute,$type,$value,$giv
             $parser->parse($docblock, $context);
             $this->fail();
         } catch (\Doctrine\Common\Annotations\AnnotationException $exc) {
-            $this->assertContains("[Type Error] Attribute \"$attribute\" of @Drupal\Tests\Component\Annotation\Doctrine\Fixtures\AnnotationWithVarType declared on property SomeClassName::invalidProperty. expects either a(n) $type, or an array of {$type}s, but got $given.", $exc->getMessage());
+            $this->assertStringContainsString("[Type Error] Attribute \"$attribute\" of @Drupal\Tests\Component\Annotation\Doctrine\Fixtures\AnnotationWithVarType declared on property SomeClassName::invalidProperty. expects either a(n) $type, or an array of {$type}s, but got $given.", $exc->getMessage());
         }
     }
 
@@ -616,7 +616,7 @@ public function testAnnotationWithAttributesError($attribute,$type,$value,$given
             $parser->parse($docblock, $context);
             $this->fail();
         } catch (\Doctrine\Common\Annotations\AnnotationException $exc) {
-            $this->assertContains("[Type Error] Attribute \"$attribute\" of @Drupal\Tests\Component\Annotation\Doctrine\Fixtures\AnnotationWithAttributes declared on property SomeClassName::invalidProperty. expects a(n) $type, but got $given.", $exc->getMessage());
+            $this->assertStringContainsString("[Type Error] Attribute \"$attribute\" of @Drupal\Tests\Component\Annotation\Doctrine\Fixtures\AnnotationWithAttributes declared on property SomeClassName::invalidProperty. expects a(n) $type, but got $given.", $exc->getMessage());
         }
     }
 
@@ -635,7 +635,7 @@ public function testAnnotationWithAttributesWithVarTypeArrayError($attribute,$ty
             $parser->parse($docblock, $context);
             $this->fail();
         } catch (\Doctrine\Common\Annotations\AnnotationException $exc) {
-            $this->assertContains("[Type Error] Attribute \"$attribute\" of @Drupal\Tests\Component\Annotation\Doctrine\Fixtures\AnnotationWithAttributes declared on property SomeClassName::invalidProperty. expects either a(n) $type, or an array of {$type}s, but got $given.", $exc->getMessage());
+            $this->assertStringContainsString("[Type Error] Attribute \"$attribute\" of @Drupal\Tests\Component\Annotation\Doctrine\Fixtures\AnnotationWithAttributes declared on property SomeClassName::invalidProperty. expects either a(n) $type, or an array of {$type}s, but got $given.", $exc->getMessage());
         }
     }
 
@@ -660,7 +660,7 @@ public function testAnnotationWithRequiredAttributes()
             $result = $parser->parse($docblock,$context);
             $this->fail();
         } catch (\Doctrine\Common\Annotations\AnnotationException $exc) {
-            $this->assertContains('Attribute "annot" of @Drupal\Tests\Component\Annotation\Doctrine\Fixtures\AnnotationWithRequiredAttributes declared on property SomeClassName::invalidProperty. expects a(n) Drupal\Tests\Component\Annotation\Doctrine\Fixtures\AnnotationTargetAnnotation. This value should not be null.', $exc->getMessage());
+            $this->assertStringContainsString('Attribute "annot" of @Drupal\Tests\Component\Annotation\Doctrine\Fixtures\AnnotationWithRequiredAttributes declared on property SomeClassName::invalidProperty. expects a(n) Drupal\Tests\Component\Annotation\Doctrine\Fixtures\AnnotationTargetAnnotation. This value should not be null.', $exc->getMessage());
         }
 
         $docblock   = '@Drupal\Tests\Component\Annotation\Doctrine\Fixtures\AnnotationWithRequiredAttributes(annot = @Drupal\Tests\Component\Annotation\Doctrine\Fixtures\AnnotationTargetAnnotation)';
@@ -668,7 +668,7 @@ public function testAnnotationWithRequiredAttributes()
             $result = $parser->parse($docblock,$context);
             $this->fail();
         } catch (\Doctrine\Common\Annotations\AnnotationException $exc) {
-            $this->assertContains('Attribute "value" of @Drupal\Tests\Component\Annotation\Doctrine\Fixtures\AnnotationWithRequiredAttributes declared on property SomeClassName::invalidProperty. expects a(n) string. This value should not be null.', $exc->getMessage());
+            $this->assertStringContainsString('Attribute "value" of @Drupal\Tests\Component\Annotation\Doctrine\Fixtures\AnnotationWithRequiredAttributes declared on property SomeClassName::invalidProperty. expects a(n) string. This value should not be null.', $exc->getMessage());
         }
 
     }
@@ -694,7 +694,7 @@ public function testAnnotationWithRequiredAttributesWithoutContructor()
             $result = $parser->parse($docblock,$context);
             $this->fail();
         } catch (\Doctrine\Common\Annotations\AnnotationException $exc) {
-            $this->assertContains('Attribute "annot" of @Drupal\Tests\Component\Annotation\Doctrine\Fixtures\AnnotationWithRequiredAttributesWithoutContructor declared on property SomeClassName::invalidProperty. expects a(n) Drupal\Tests\Component\Annotation\Doctrine\Fixtures\AnnotationTargetAnnotation. This value should not be null.', $exc->getMessage());
+            $this->assertStringContainsString('Attribute "annot" of @Drupal\Tests\Component\Annotation\Doctrine\Fixtures\AnnotationWithRequiredAttributesWithoutContructor declared on property SomeClassName::invalidProperty. expects a(n) Drupal\Tests\Component\Annotation\Doctrine\Fixtures\AnnotationTargetAnnotation. This value should not be null.', $exc->getMessage());
         }
 
         $docblock   = '@Drupal\Tests\Component\Annotation\Doctrine\Fixtures\AnnotationWithRequiredAttributesWithoutContructor(annot = @Drupal\Tests\Component\Annotation\Doctrine\Fixtures\AnnotationTargetAnnotation)';
@@ -702,7 +702,7 @@ public function testAnnotationWithRequiredAttributesWithoutContructor()
             $result = $parser->parse($docblock,$context);
             $this->fail();
         } catch (\Doctrine\Common\Annotations\AnnotationException $exc) {
-            $this->assertContains('Attribute "value" of @Drupal\Tests\Component\Annotation\Doctrine\Fixtures\AnnotationWithRequiredAttributesWithoutContructor declared on property SomeClassName::invalidProperty. expects a(n) string. This value should not be null.', $exc->getMessage());
+            $this->assertStringContainsString('Attribute "value" of @Drupal\Tests\Component\Annotation\Doctrine\Fixtures\AnnotationWithRequiredAttributesWithoutContructor declared on property SomeClassName::invalidProperty. expects a(n) string. This value should not be null.', $exc->getMessage());
         }
 
     }
@@ -1145,7 +1145,7 @@ public function testCastInt()
 
         $result = $parser->parse("@Name(foo=1234)");
         $annot = $result[0];
-        $this->assertInternalType('int', $annot->foo);
+        $this->assertIsInt($annot->foo);
     }
 
     /**
@@ -1157,7 +1157,7 @@ public function testCastNegativeInt()
 
         $result = $parser->parse("@Name(foo=-1234)");
         $annot = $result[0];
-        $this->assertInternalType('int', $annot->foo);
+        $this->assertIsInt($annot->foo);
     }
 
     /**
@@ -1169,7 +1169,7 @@ public function testCastFloat()
 
         $result = $parser->parse("@Name(foo=1234.345)");
         $annot = $result[0];
-        $this->assertInternalType('float', $annot->foo);
+        $this->assertIsFloat($annot->foo);
     }
 
     /**
@@ -1181,11 +1181,11 @@ public function testCastNegativeFloat()
 
         $result = $parser->parse("@Name(foo=-1234.345)");
         $annot = $result[0];
-        $this->assertInternalType('float', $annot->foo);
+        $this->assertIsFloat($annot->foo);
 
         $result = $parser->parse("@Marker(-1234.345)");
         $annot = $result[0];
-        $this->assertInternalType('float', $annot->value);
+        $this->assertIsFloat($annot->value);
     }
 
     public function testReservedKeywordsInAnnotations()
diff --git a/core/tests/Drupal/Tests/Component/FileSecurity/FileSecurityTest.php b/core/tests/Drupal/Tests/Component/FileSecurity/FileSecurityTest.php
index 0066f53d7c..4e4182bae6 100644
--- a/core/tests/Drupal/Tests/Component/FileSecurity/FileSecurityTest.php
+++ b/core/tests/Drupal/Tests/Component/FileSecurity/FileSecurityTest.php
@@ -24,7 +24,7 @@ public function testWriteHtaccessPrivate() {
     $this->assertFileExists($htaccess_file);
     $this->assertEquals('0444', substr(sprintf('%o', fileperms($htaccess_file)), -4));
     $htaccess_contents = file_get_contents($htaccess_file);
-    $this->assertContains("Require all denied", $htaccess_contents);
+    $this->assertStringContainsString("Require all denied", $htaccess_contents);
   }
 
   /**
@@ -37,7 +37,7 @@ public function testWriteHtaccessPublic() {
     $this->assertFileExists($htaccess_file);
     $this->assertEquals('0444', substr(sprintf('%o', fileperms($htaccess_file)), -4));
     $htaccess_contents = file_get_contents($htaccess_file);
-    $this->assertNotContains("Require all denied", $htaccess_contents);
+    $this->assertStringNotContainsString("Require all denied", $htaccess_contents);
   }
 
   /**
@@ -49,8 +49,8 @@ public function testWriteHtaccessForceOverwrite() {
     file_put_contents($htaccess_file, "foo");
     $this->assertTrue(FileSecurity::writeHtaccess(vfsStream::url('root'), TRUE, TRUE));
     $htaccess_contents = file_get_contents($htaccess_file);
-    $this->assertContains("Require all denied", $htaccess_contents);
-    $this->assertNotContains("foo", $htaccess_contents);
+    $this->assertStringContainsString("Require all denied", $htaccess_contents);
+    $this->assertStringNotContainsString("foo", $htaccess_contents);
   }
 
   /**
@@ -82,7 +82,7 @@ public function testWriteWebConfigForceOverwrite() {
     $this->assertTrue(FileSecurity::writeWebConfig(vfsStream::url('root'), TRUE));
     $this->assertFileExists($web_config_file);
     $this->assertEquals('0444', substr(sprintf('%o', fileperms($web_config_file)), -4));
-    $this->assertNotContains("foo", $web_config_file);
+    $this->assertStringNotContainsString("foo", $web_config_file);
   }
 
   /**
diff --git a/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/AssertUtilsTrait.php b/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/AssertUtilsTrait.php
index 2f39d832ec..f4164c7aed 100644
--- a/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/AssertUtilsTrait.php
+++ b/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/AssertUtilsTrait.php
@@ -2,10 +2,13 @@
 
 namespace Drupal\Tests\Composer\Plugin\Scaffold;
 
+use Drupal\Tests\Traits\PHPUnit8Warnings;
+
 /**
  * Convenience class for creating fixtures.
  */
 trait AssertUtilsTrait {
+  use PHPUnit8Warnings;
 
   /**
    * Asserts that a given file exists and is/is not a symlink.
diff --git a/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Integration/AppendOpTest.php b/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Integration/AppendOpTest.php
index d5fadedec1..706ca67415 100644
--- a/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Integration/AppendOpTest.php
+++ b/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Integration/AppendOpTest.php
@@ -5,6 +5,7 @@
 use Drupal\Composer\Plugin\Scaffold\Operations\AppendOp;
 use Drupal\Composer\Plugin\Scaffold\ScaffoldOptions;
 use Drupal\Tests\Composer\Plugin\Scaffold\Fixtures;
+use Drupal\Tests\Traits\PHPUnit8Warnings;
 use PHPUnit\Framework\TestCase;
 
 /**
@@ -13,6 +14,7 @@
  * @group Scaffold
  */
 class AppendOpTest extends TestCase {
+  use PHPUnit8Warnings;
 
   /**
    * @covers ::process
diff --git a/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Integration/ReplaceOpTest.php b/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Integration/ReplaceOpTest.php
index ee6bb73a8d..0f3d6934f5 100644
--- a/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Integration/ReplaceOpTest.php
+++ b/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Integration/ReplaceOpTest.php
@@ -5,6 +5,7 @@
 use Drupal\Composer\Plugin\Scaffold\Operations\ReplaceOp;
 use Drupal\Composer\Plugin\Scaffold\ScaffoldOptions;
 use Drupal\Tests\Composer\Plugin\Scaffold\Fixtures;
+use Drupal\Tests\Traits\PHPUnit8Warnings;
 use PHPUnit\Framework\TestCase;
 
 /**
@@ -13,6 +14,7 @@
  * @group Scaffold
  */
 class ReplaceOpTest extends TestCase {
+  use PHPUnit8Warnings;
 
   /**
    * @covers ::process
diff --git a/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Integration/SkipOpTest.php b/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Integration/SkipOpTest.php
index 75c07a1f6e..77ece82c83 100644
--- a/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Integration/SkipOpTest.php
+++ b/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Integration/SkipOpTest.php
@@ -5,6 +5,7 @@
 use Drupal\Composer\Plugin\Scaffold\Operations\SkipOp;
 use Drupal\Composer\Plugin\Scaffold\ScaffoldOptions;
 use Drupal\Tests\Composer\Plugin\Scaffold\Fixtures;
+use Drupal\Tests\Traits\PHPUnit8Warnings;
 use PHPUnit\Framework\TestCase;
 
 /**
@@ -13,6 +14,7 @@
  * @group Scaffold
  */
 class SkipOpTest extends TestCase {
+  use PHPUnit8Warnings;
 
   /**
    * @covers ::process
diff --git a/core/tests/Drupal/Tests/Composer/Plugin/VendorHardening/ConfigTest.php b/core/tests/Drupal/Tests/Composer/Plugin/VendorHardening/ConfigTest.php
index 71b1c0ae10..9755278b51 100644
--- a/core/tests/Drupal/Tests/Composer/Plugin/VendorHardening/ConfigTest.php
+++ b/core/tests/Drupal/Tests/Composer/Plugin/VendorHardening/ConfigTest.php
@@ -77,10 +77,8 @@ public function testRootMergeConfig() {
 
     $plugin_config = $ref_plugin_config->invoke($config);
 
-    $this->assertArraySubset([
-      'isa/string' => ['test_dir'],
-      'an/array' => ['test_dir', 'doc_dir'],
-    ], $plugin_config);
+    $this->assertSame(['test_dir'], $plugin_config['isa/string']);
+    $this->assertSame(['test_dir', 'doc_dir'], $plugin_config['an/array']);
   }
 
   /**
diff --git a/core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php b/core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php
index 69672dd41d..04cc946524 100644
--- a/core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php
+++ b/core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php
@@ -118,6 +118,7 @@ public static function isDeprecationSkipped($message) {
       '%Non-object services are deprecated since Symfony 4\.4, setting the ".*" service to a value of type ".*" should be avoided\.%',
       '%The ".*" service relies on the deprecated "Symfony\\\\Component\\\\Debug\\\\BufferingLogger" class\. It should either be deprecated or its implementation upgraded\.%',
       '%Method ".*::.*\(\)" will return ".*" as of its next major version\. Doing the same in child class ".*" will be required when upgrading\.%',
+      '%The "PHPUnit\\\\Framework\\\\TestCase::addWarning\(\)" method is considered internal%',
     ];
     return (bool) preg_filter($dynamic_skipped_deprecations, '$0', $message);
   }
diff --git a/core/tests/Drupal/Tests/Traits/PHPUnit8Warnings.php b/core/tests/Drupal/Tests/Traits/PHPUnit8Warnings.php
new file mode 100644
index 0000000000..4f15e7e662
--- /dev/null
+++ b/core/tests/Drupal/Tests/Traits/PHPUnit8Warnings.php
@@ -0,0 +1,50 @@
+<?php
+
+namespace Drupal\Tests\Traits;
+
+/**
+ * Used to ignore warnings being added by PHPUnit 8.
+ *
+ * This trait exists to allow Drupal 8 tests using PHPUnit 7 and Drupal 9 tests
+ * using PHPUnit 8 to happily co-exist. Once Drupal 8 and Drupal 9 are not so
+ * closely aligned these will be fixed in core and the warnings will be emitted
+ * from the test runner.
+ *
+ * @internal
+ */
+trait PHPUnit8Warnings {
+
+  /**
+   * The list of warnings to ignore.
+   *
+   * @var string[]
+   */
+  private static $ignoredWarnings = [
+    'Using assertContains() with string haystacks is deprecated and will not be supported in PHPUnit 9. Refactor your test to use assertStringContainsString() or assertStringContainsStringIgnoringCase() instead.',
+    'Using assertNotContains() with string haystacks is deprecated and will not be supported in PHPUnit 9. Refactor your test to use assertStringNotContainsString() or assertStringNotContainsStringIgnoringCase() instead.',
+    'assertArraySubset() is deprecated and will be removed in PHPUnit 9.',
+    'assertInternalType() is deprecated and will be removed in PHPUnit 9. Refactor your test to use assertIsArray(), assertIsBool(), assertIsFloat(), assertIsInt(), assertIsNumeric(), assertIsObject(), assertIsResource(), assertIsString(), assertIsScalar(), assertIsCallable(), or assertIsIterable() instead.',
+    'readAttribute() is deprecated and will be removed in PHPUnit 9.',
+    'getObjectAttribute() is deprecated and will be removed in PHPUnit 9.',
+    'The optional $canonicalize parameter of assertEquals() is deprecated and will be removed in PHPUnit 9. Refactor your test to use assertEqualsCanonicalizing() instead.',
+    'assertAttributeEquals() is deprecated and will be removed in PHPUnit 9.',
+    'assertAttributeSame() is deprecated and will be removed in PHPUnit 9.',
+    'assertAttributeInstanceOf() is deprecated and will be removed in PHPUnit 9.',
+    'assertAttributeEmpty() is deprecated and will be removed in PHPUnit 9.',
+  ];
+
+  /**
+   * Ignores specific PHPUNit 8 warnings.
+   *
+   * @see \PHPUnit\Framework\TestCase::addWarning()
+   *
+   * @internal
+   */
+  public function addWarning(string $warning): void {
+    if (in_array($warning, self::$ignoredWarnings, TRUE)) {
+      return;
+    }
+    parent::addWarning($warning);
+  }
+
+}
diff --git a/core/tests/Drupal/Tests/UnitTestCase.php b/core/tests/Drupal/Tests/UnitTestCase.php
index f6cfaf4cbe..8f5b856402 100644
--- a/core/tests/Drupal/Tests/UnitTestCase.php
+++ b/core/tests/Drupal/Tests/UnitTestCase.php
@@ -9,6 +9,7 @@
 use Drupal\Core\DependencyInjection\ContainerBuilder;
 use Drupal\Core\StringTranslation\TranslatableMarkup;
 use Drupal\Core\StringTranslation\PluralTranslatableMarkup;
+use Drupal\Tests\Traits\PHPUnit8Warnings;
 use PHPUnit\Framework\TestCase;
 
 /**
@@ -17,6 +18,7 @@
  * @ingroup testing
  */
 abstract class UnitTestCase extends TestCase {
+  use PHPUnit8Warnings;
 
   /**
    * The random generator.
