From 87a1fe1b751391d051d277a1895932f3c2f8a656 Mon Sep 17 00:00:00 2001 From: Sebastian Bergmann Date: Tue, 14 Nov 2023 14:38:21 +0100 Subject: [PATCH] Closes #5563 --- ChangeLog-10.4.md | 7 +++++++ src/Framework/TestCase.php | 6 ++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ChangeLog-10.4.md b/ChangeLog-10.4.md index b9f1a045f56..f2f93cb67ae 100644 --- a/ChangeLog-10.4.md +++ b/ChangeLog-10.4.md @@ -2,6 +2,12 @@ All notable changes of the PHPUnit 10.4 release series are documented in this file using the [Keep a CHANGELOG](https://keepachangelog.com/) principles. +## [10.4.3] - 2023-MM-DD + +### Fixed + +* [#5563](https://github.com/sebastianbergmann/phpunit/issues/5563): `createMockForIntersectionOfInterfaces()` does not automatically register mock object for expectation verification + ## [10.4.2] - 2023-10-26 ### Fixed @@ -47,6 +53,7 @@ All notable changes of the PHPUnit 10.4 release series are documented in this fi * `PHPUnit\TextUI\Configuration\Configuration::cliArgument()` and `PHPUnit\TextUI\Configuration\Configuration::hasCliArgument()` * `PHPUnit\Framework\Constraint\Constraint::exporter()` +[10.4.3]: https://github.com/sebastianbergmann/phpunit/compare/10.4.2...10.4 [10.4.2]: https://github.com/sebastianbergmann/phpunit/compare/10.4.1...10.4.2 [10.4.1]: https://github.com/sebastianbergmann/phpunit/compare/10.4.0...10.4.1 [10.4.0]: https://github.com/sebastianbergmann/phpunit/compare/10.3.5...10.4.0 diff --git a/src/Framework/TestCase.php b/src/Framework/TestCase.php index c03ae295630..92c67bb60f4 100644 --- a/src/Framework/TestCase.php +++ b/src/Framework/TestCase.php @@ -1233,10 +1233,12 @@ protected function createMockForIntersectionOfInterfaces(array $interfaces): Moc { $mock = (new MockGenerator)->testDoubleForInterfaceIntersection($interfaces, true); - Event\Facade::emitter()->testCreatedMockObjectForIntersectionOfInterfaces($interfaces); - assert($mock instanceof MockObject); + $this->registerMockObject($mock); + + Event\Facade::emitter()->testCreatedMockObjectForIntersectionOfInterfaces($interfaces); + return $mock; }