diff --git a/core/modules/link/tests/src/Kernel/Plugin/migrate/cckfield/d7/LinkCckTest.php b/core/modules/link/tests/src/Kernel/Plugin/migrate/cckfield/d7/LinkCckTest.php
index 896c15c9fc..14345a60ef 100644
--- a/core/modules/link/tests/src/Kernel/Plugin/migrate/cckfield/d7/LinkCckTest.php
+++ b/core/modules/link/tests/src/Kernel/Plugin/migrate/cckfield/d7/LinkCckTest.php
@@ -53,6 +53,8 @@ protected function setUp() {
/**
* @covers ::processCckFieldValues
+ * @expectedDeprecation CckFieldPluginBase is deprecated in Drupal 8.3.x and will be be removed before Drupal 9.0.x. Use \Drupal\migrate_drupal\Plugin\migrate\field\FieldPluginBase instead.
+ * @expectedDeprecation MigrateCckFieldInterface is deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.x. Use \Drupal\migrate_drupal\Annotation\MigrateField instead.
*/
public function testProcessCckFieldValues() {
$this->plugin->processFieldInstance($this->migration);
diff --git a/core/phpunit.xml.dist b/core/phpunit.xml.dist
index 750c6e2b50..ed3216d369 100644
--- a/core/phpunit.xml.dist
+++ b/core/phpunit.xml.dist
@@ -30,7 +30,7 @@
-
+
diff --git a/core/scripts/run-tests.sh b/core/scripts/run-tests.sh
index 5ebf9f0c9f..e545318b87 100755
--- a/core/scripts/run-tests.sh
+++ b/core/scripts/run-tests.sh
@@ -793,7 +793,11 @@ function simpletest_script_run_one_test($test_id, $test_class) {
putenv('SYMFONY_DEPRECATIONS_HELPER=disabled');
}
else {
- putenv('SYMFONY_DEPRECATIONS_HELPER=strict');
+ // Prevent deprecations caused by vendor code calling deprecated code.
+ // This also prevents PHPUnit 6's mock code that triggers silenced
+ // deprecations from breaking the test suite. We should consider changing
+ // this to 'strict' once we are no longer use PHPUnit 4.
+ putenv('SYMFONY_DEPRECATIONS_HELPER=weak_vendors');
}
if (is_subclass_of($test_class, TestCase::class)) {
$status = simpletest_script_run_phpunit($test_id, $test_class);
diff --git a/core/tests/Drupal/Tests/Component/Plugin/Discovery/StaticDiscoveryDecoratorTest.php b/core/tests/Drupal/Tests/Component/Plugin/Discovery/StaticDiscoveryDecoratorTest.php
index a44721bd9b..5b01093092 100644
--- a/core/tests/Drupal/Tests/Component/Plugin/Discovery/StaticDiscoveryDecoratorTest.php
+++ b/core/tests/Drupal/Tests/Component/Plugin/Discovery/StaticDiscoveryDecoratorTest.php
@@ -100,7 +100,12 @@ public function testGetDefinition($expected, $has_register_definitions, $excepti
$ref_decorated->setValue($mock_decorator, $mock_decorated);
if ($exception_on_invalid) {
- $this->setExpectedException('Drupal\Component\Plugin\Exception\PluginNotFoundException');
+ if (method_exists($this, 'expectException')) {
+ $this->expectException('Drupal\Component\Plugin\Exception\PluginNotFoundException');
+ }
+ else {
+ $this->setExpectedException('Drupal\Component\Plugin\Exception\PluginNotFoundException');
+ }
}
// Exercise getDefinition(). It calls parent::getDefinition().
diff --git a/core/tests/TestSuites/TestSuiteBase.php b/core/tests/TestSuites/TestSuiteBase.php
index 5deeb8a612..3f4dc32933 100644
--- a/core/tests/TestSuites/TestSuiteBase.php
+++ b/core/tests/TestSuites/TestSuiteBase.php
@@ -41,7 +41,12 @@ protected function addTestsBySuiteNamespace($root, $suite_namespace) {
// always inside of core/tests/Drupal/${suite_namespace}Tests. The exception
// to this is Unit tests for historical reasons.
if ($suite_namespace == 'Unit') {
- $this->addTestFiles(TestDiscovery::scanDirectory("Drupal\\Tests\\", "$root/core/tests/Drupal/Tests"));
+ $tests = TestDiscovery::scanDirectory("Drupal\\Tests\\", "$root/core/tests/Drupal/Tests");
+ $tests = array_filter($tests, function ($test) use ($root) {
+ // The Listeners directory does not contain tests.
+ return !preg_match("@^$root/core/tests/Drupal/Tests/Listeners/@", dirname($test));
+ });
+ $this->addTestFiles($tests);
}
else {
$this->addTestFiles(TestDiscovery::scanDirectory("Drupal\\${suite_namespace}Tests\\", "$root/core/tests/Drupal/${suite_namespace}Tests"));