Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
hugok96 opened this issue Apr 17, 2024 · 3 comments
Assignees
Labels
feature/test-doubles Stubs and Mock Objects type/bug Something is broken version/10 Something affects PHPUnit 10

Comments

@hugok96
Copy link

hugok96 commented Apr 17, 2024

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.

@hugok96 hugok96 added the type/bug Something is broken label Apr 17, 2024
@sebastianbergmann sebastianbergmann added the feature/test-doubles Stubs and Mock Objects label Apr 17, 2024
@sebastianbergmann sebastianbergmann changed the title Calling method() on a Stub created by TestCase::createStubForIntersectionOfInterfaces throws an unexpected exception Calling method() on a test stub created using createStubForIntersectionOfInterfaces() throws an unexpected exception Apr 17, 2024
@sebastianbergmann
Copy link
Owner

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

@sebastianbergmann
Copy link
Owner

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

@sebastianbergmann sebastianbergmann self-assigned this Apr 17, 2024
@sebastianbergmann
Copy link
Owner

The problem does not exist in PHPUnit 11.1.

@sebastianbergmann sebastianbergmann added the version/10 Something affects PHPUnit 10 label Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/test-doubles Stubs and Mock Objects type/bug Something is broken version/10 Something affects PHPUnit 10
Projects
None yet
Development

No branches or pull requests

2 participants