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

Mock methods with mixed return type #1156

Merged
merged 3 commits into from Jan 11, 2022
Merged

Mock methods with mixed return type #1156

merged 3 commits into from Jan 11, 2022

Conversation

ghostwriter
Copy link
Member

This patch resolves #1149, via the following changes:

  • Add tests and fixtures
  • Mock methods with mixed return type.
class MockingMethodsWithMixedReturnTypeTest extends MockeryTestCase
{
    public function testMockingMixedReturnType()
    {
        $mock = \Mockery::mock(MyInterface::class);
        $mock->shouldReceive("foo->bar")->andReturn("bar");
        $this->assertSame('bar', $mock->foo()->bar());
    }
}

interface MyInterface {
    public function getFoo(): mixed;
}

Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
@davedevelopment davedevelopment merged commit 0ca8e28 into mockery:master Jan 11, 2022
@davedevelopment
Copy link
Collaborator

Thank you!

@ghostwriter ghostwriter deleted the bugfix/mock-mixed-return-types branch January 11, 2022 15:29
@ghostwriter ghostwriter self-assigned this May 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot use "mixed" as class name
2 participants