diff --git a/core/modules/media/tests/src/Functional/ProviderRepositoryTest.php b/core/modules/media/tests/src/Functional/ProviderRepositoryTest.php index 2e81efc6b783eb88e32413889447a778cd592a5d..d791a2f90ea771df2dfd890b2a437150566b34c8 100644 --- a/core/modules/media/tests/src/Functional/ProviderRepositoryTest.php +++ b/core/modules/media/tests/src/Functional/ProviderRepositoryTest.php @@ -4,6 +4,7 @@ use Drupal\media\OEmbed\ProviderException; use GuzzleHttp\Psr7\Utils; +use Prophecy\PhpUnit\ProphecyTrait; /** * Tests the oEmbed provider repository. @@ -14,6 +15,8 @@ */ class ProviderRepositoryTest extends MediaFunctionalTestBase { + use ProphecyTrait; + /** * {@inheritdoc} */ diff --git a/core/tests/Drupal/KernelTests/KernelTestBase.php b/core/tests/Drupal/KernelTests/KernelTestBase.php index eab4a431aa08b3a90b6d3c6141e98561ea53db29..47fd9b5862843dc0e5dad8314989fb75fb31a932 100644 --- a/core/tests/Drupal/KernelTests/KernelTestBase.php +++ b/core/tests/Drupal/KernelTests/KernelTestBase.php @@ -26,6 +26,7 @@ use Drupal\TestTools\TestVarDumper; use PHPUnit\Framework\Exception; use PHPUnit\Framework\TestCase; +use Prophecy\PhpUnit\ProphecyTrait; use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\HttpFoundation\Request; @@ -89,6 +90,7 @@ abstract class KernelTestBase extends TestCase implements ServiceProviderInterfa use TestRequirementsTrait; use PhpUnitWarnings; use PhpUnitCompatibilityTrait; + use ProphecyTrait; use ExpectDeprecationTrait; /** diff --git a/core/tests/Drupal/TestTools/PhpUnitCompatibility/PhpUnit9/TestCompatibilityTrait.php b/core/tests/Drupal/TestTools/PhpUnitCompatibility/PhpUnit9/TestCompatibilityTrait.php index 997f5e245f199e8e3301ffc6ff13e2b133c1c932..590fc337be2eb5dd3612389f99f5c8cc4bc06898 100644 --- a/core/tests/Drupal/TestTools/PhpUnitCompatibility/PhpUnit9/TestCompatibilityTrait.php +++ b/core/tests/Drupal/TestTools/PhpUnitCompatibility/PhpUnit9/TestCompatibilityTrait.php @@ -2,19 +2,9 @@ namespace Drupal\TestTools\PhpUnitCompatibility\PhpUnit9; -use Prophecy\PhpUnit\ProphecyTrait; - -// @todo Replace with a proper dependency when we stop supporting PHPUnit 8. -if (!trait_exists(ProphecyTrait::class)) { - print "Drupal requires Prophecy PhpUnit when using PHPUnit 9 or greater. Please use 'composer require --dev phpspec/prophecy-phpunit:^2' to ensure that it is present.\n"; - exit(1); -} - /** * Drupal's forward compatibility layer with multiple versions of PHPUnit. */ trait TestCompatibilityTrait { - use ProphecyTrait; - } diff --git a/core/tests/Drupal/Tests/Component/Annotation/Plugin/Discovery/AnnotationBridgeDecoratorTest.php b/core/tests/Drupal/Tests/Component/Annotation/Plugin/Discovery/AnnotationBridgeDecoratorTest.php index 324eab95b4bd131dbb5f22ad7902b2eef321bfff..848f499ee106b0d039b2ed537dda0622732aa17d 100644 --- a/core/tests/Drupal/Tests/Component/Annotation/Plugin/Discovery/AnnotationBridgeDecoratorTest.php +++ b/core/tests/Drupal/Tests/Component/Annotation/Plugin/Discovery/AnnotationBridgeDecoratorTest.php @@ -6,8 +6,8 @@ use Drupal\Component\Annotation\Plugin\Discovery\AnnotationBridgeDecorator; use Drupal\Component\Plugin\Definition\PluginDefinition; use Drupal\Component\Plugin\Discovery\DiscoveryInterface; -use Drupal\Tests\PhpUnitCompatibilityTrait; use PHPUnit\Framework\TestCase; +use Prophecy\PhpUnit\ProphecyTrait; /** * @coversDefaultClass \Drupal\Component\Annotation\Plugin\Discovery\AnnotationBridgeDecorator @@ -15,7 +15,7 @@ */ class AnnotationBridgeDecoratorTest extends TestCase { - use PhpUnitCompatibilityTrait; + use ProphecyTrait; /** * @covers ::getDefinitions diff --git a/core/tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php b/core/tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php index 1a2e3115d6dda0d8568bc1456108447aa8082600..a4990cc36c3f9eca5b3f08e2f72739760181ff88 100644 --- a/core/tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php +++ b/core/tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php @@ -8,8 +8,8 @@ namespace Drupal\Tests\Component\DependencyInjection; use Drupal\Component\Utility\Crypt; -use Drupal\Tests\PhpUnitCompatibilityTrait; use PHPUnit\Framework\TestCase; +use Prophecy\PhpUnit\ProphecyTrait; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; use Symfony\Component\DependencyInjection\Exception\LogicException; @@ -25,7 +25,7 @@ */ class ContainerTest extends TestCase { - use PhpUnitCompatibilityTrait; + use ProphecyTrait; /** * The tested container. diff --git a/core/tests/Drupal/Tests/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumperTest.php b/core/tests/Drupal/Tests/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumperTest.php index e53b27b6cb83d649fc2d3426580bc8df0a56b5f1..4fc0ec6a3b0050ffdbeef01844d2fb8e993917f3 100644 --- a/core/tests/Drupal/Tests/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumperTest.php +++ b/core/tests/Drupal/Tests/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumperTest.php @@ -8,8 +8,8 @@ namespace Drupal\Tests\Component\DependencyInjection\Dumper { use Drupal\Component\Utility\Crypt; - use Drupal\Tests\PhpUnitCompatibilityTrait; use PHPUnit\Framework\TestCase; + use Prophecy\PhpUnit\ProphecyTrait; use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait; use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Reference; @@ -26,8 +26,8 @@ */ class OptimizedPhpArrayDumperTest extends TestCase { - use PhpUnitCompatibilityTrait; use ExpectDeprecationTrait; + use ProphecyTrait; /** * The container builder instance. diff --git a/core/tests/Drupal/Tests/Component/Gettext/PoStreamWriterTest.php b/core/tests/Drupal/Tests/Component/Gettext/PoStreamWriterTest.php index 361284d3d99563e36834b15756dbd0ae5dc92481..c3994a67cbc4bce3a37ba891673284f34b9019f8 100644 --- a/core/tests/Drupal/Tests/Component/Gettext/PoStreamWriterTest.php +++ b/core/tests/Drupal/Tests/Component/Gettext/PoStreamWriterTest.php @@ -5,10 +5,10 @@ use Drupal\Component\Gettext\PoHeader; use Drupal\Component\Gettext\PoItem; use Drupal\Component\Gettext\PoStreamWriter; -use Drupal\Tests\PhpUnitCompatibilityTrait; use org\bovigo\vfs\vfsStream; use org\bovigo\vfs\vfsStreamFile; use PHPUnit\Framework\TestCase; +use Prophecy\PhpUnit\ProphecyTrait; /** * @coversDefaultClass \Drupal\Component\Gettext\PoStreamWriter @@ -16,7 +16,7 @@ */ class PoStreamWriterTest extends TestCase { - use PhpUnitCompatibilityTrait; + use ProphecyTrait; /** * The PO writer object under test. diff --git a/core/tests/Drupal/Tests/Component/Plugin/PluginManagerBaseTest.php b/core/tests/Drupal/Tests/Component/Plugin/PluginManagerBaseTest.php index 38d47ea3456afd5f8a973b11b99aa5b42608b6c2..36b60b68a55398642a6be4fc7f57c141d8d90a2f 100644 --- a/core/tests/Drupal/Tests/Component/Plugin/PluginManagerBaseTest.php +++ b/core/tests/Drupal/Tests/Component/Plugin/PluginManagerBaseTest.php @@ -5,8 +5,8 @@ use Drupal\Component\Plugin\Exception\PluginNotFoundException; use Drupal\Component\Plugin\Mapper\MapperInterface; use Drupal\Component\Plugin\PluginManagerBase; -use Drupal\Tests\PhpUnitCompatibilityTrait; use PHPUnit\Framework\TestCase; +use Prophecy\PhpUnit\ProphecyTrait; /** * @coversDefaultClass \Drupal\Component\Plugin\PluginManagerBase @@ -14,7 +14,7 @@ */ class PluginManagerBaseTest extends TestCase { - use PhpUnitCompatibilityTrait; + use ProphecyTrait; /** * A callback method for mocking FactoryInterface objects. diff --git a/core/tests/Drupal/Tests/Composer/Plugin/VendorHardening/VendorHardeningPluginTest.php b/core/tests/Drupal/Tests/Composer/Plugin/VendorHardening/VendorHardeningPluginTest.php index 5b43d9a0344e9b820122672c0110a394ee50c16c..81b286b986dee2a1c0d921cb682ec3d58006d2b6 100644 --- a/core/tests/Drupal/Tests/Composer/Plugin/VendorHardening/VendorHardeningPluginTest.php +++ b/core/tests/Drupal/Tests/Composer/Plugin/VendorHardening/VendorHardeningPluginTest.php @@ -8,10 +8,10 @@ use Composer\Package\RootPackageInterface; use Drupal\Composer\Plugin\VendorHardening\Config; use Drupal\Composer\Plugin\VendorHardening\VendorHardeningPlugin; -use Drupal\Tests\PhpUnitCompatibilityTrait; use Drupal\Tests\Traits\PhpUnitWarnings; use org\bovigo\vfs\vfsStream; use PHPUnit\Framework\TestCase; +use Prophecy\PhpUnit\ProphecyTrait; /** * @coversDefaultClass \Drupal\Composer\Plugin\VendorHardening\VendorHardeningPlugin @@ -20,7 +20,7 @@ class VendorHardeningPluginTest extends TestCase { use PhpUnitWarnings; - use PhpUnitCompatibilityTrait; + use ProphecyTrait; /** * {@inheritdoc} diff --git a/core/tests/Drupal/Tests/UnitTestCase.php b/core/tests/Drupal/Tests/UnitTestCase.php index 0b40c075f8e899012867688933e9acff6febcfb4..44f46e6bb825e3b28b5e892e9ce69fcafb558379 100644 --- a/core/tests/Drupal/Tests/UnitTestCase.php +++ b/core/tests/Drupal/Tests/UnitTestCase.php @@ -12,6 +12,7 @@ use Drupal\Tests\Traits\PhpUnitWarnings; use Drupal\TestTools\TestVarDumper; use PHPUnit\Framework\TestCase; +use Prophecy\PhpUnit\ProphecyTrait; use Symfony\Component\VarDumper\VarDumper; use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait; @@ -27,6 +28,7 @@ abstract class UnitTestCase extends TestCase { use PhpUnitWarnings; use PhpUnitCompatibilityTrait; + use ProphecyTrait; use ExpectDeprecationTrait; /**