From cc8ddbe513adf9c360c203bf769fc9700289c5ae Mon Sep 17 00:00:00 2001 From: Sebastian Bergmann Date: Sun, 24 Nov 2019 10:29:40 +0100 Subject: [PATCH] Closes #3955 --- ChangeLog-8.5.md | 1 + src/Framework/TestCase.php | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/ChangeLog-8.5.md b/ChangeLog-8.5.md index ae482ad5d7b..00d5bafacb9 100644 --- a/ChangeLog-8.5.md +++ b/ChangeLog-8.5.md @@ -12,6 +12,7 @@ All notable changes of the PHPUnit 8.5 release series are documented in this fil ### Changed * Implemented [#3950](https://github.com/sebastianbergmann/phpunit/issues/3950): Deprecate optional parameters of `assertFileEquals()` etc. +* Implemented [#3955](https://github.com/sebastianbergmann/phpunit/issues/3955): Deprecate support for doubling multiple interfaces [8.5.0]: https://github.com/sebastianbergmann/phpunit/compare/8.4...master diff --git a/src/Framework/TestCase.php b/src/Framework/TestCase.php index 9ecda527901..d1aaeb2814d 100644 --- a/src/Framework/TestCase.php +++ b/src/Framework/TestCase.php @@ -772,6 +772,10 @@ public function run(TestResult $result = null): TestResult */ public function getMockBuilder($className): MockBuilder { + if (!\is_string($className)) { + $this->addWarning('Passing an array of interface names to getMockBuilder() for creating a test double that implements multiple interfaces is deprecated and will no longer be supported in PHPUnit 9.'); + } + $this->recordDoubledType($className); return new MockBuilder($this, $className); @@ -1571,6 +1575,10 @@ protected function createStub(string $originalClassName): Stub */ protected function createMock($originalClassName): MockObject { + if (!\is_string($originalClassName)) { + $this->addWarning('Passing an array of interface names to createMock() for creating a test double that implements multiple interfaces is deprecated and will no longer be supported in PHPUnit 9.'); + } + return $this->getMockBuilder($originalClassName) ->disableOriginalConstructor() ->disableOriginalClone() @@ -1611,6 +1619,10 @@ protected function createConfiguredMock($originalClassName, array $configuration */ protected function createPartialMock($originalClassName, array $methods): MockObject { + if (!\is_string($originalClassName)) { + $this->addWarning('Passing an array of interface names to createPartialMock() for creating a test double that implements multiple interfaces is deprecated and will no longer be supported in PHPUnit 9.'); + } + $class_names = \is_array($originalClassName) ? $originalClassName : [$originalClassName]; foreach ($class_names as $class_name) {