sebastianbergmann / phpunit

The PHP Unit Testing framework.

Home Page:https://phpunit.de/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Calling `method()` on a test stub created using `createStubForIntersectionOfInterfaces()` throws an unexpected exception

hugok96 opened this issue · comments

commented
Q A
PHPUnit version 10.5.18
PHP version 8.1.27
Installation Method Composer

Summary

Calling the method() method on a Stub created through the TestCase::createStubForIntersectionOfInterfaces() method throws an unexpected exception.

Current behavior

When calling the m̀ethod() method on a Stub created through the TestCase::createStubForIntersectionOfInterfaces() method, an exception is thrown: Error: Call to undefined method TestStub_Intersection_AInterface_f00d4e13_af77f05e::expects().

How to reproduce

public function testExample(): void
{
    $stub = self::createStubForIntersectionOfInterfaces([FirstInterface::class, SecondaryInterface::class]);
    $stub->method('method');
}

Expected behavior

Calling method() on a Stub should not throw an exception.

Thank you for patience and effort to open this new issue. It is now much clearer to me.

According to git-bisect, this is broken since 073671d which was first released in PHPUnit 10.4.0.

The problem does not exist in PHPUnit 11.1.