Skip to content

Commit

Permalink
Closes #3955
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Nov 24, 2019
1 parent d4ac4ed commit cc8ddbe
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions ChangeLog-8.5.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

12 changes: 12 additions & 0 deletions src/Framework/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit cc8ddbe

Please sign in to comment.