Skip to content

Mock methods with mixed return type#1156

Merged
davedevelopment merged 3 commits intomockery:masterfrom
ghostwriter:bugfix/mock-mixed-return-types
Jan 11, 2022
Merged

Mock methods with mixed return type#1156
davedevelopment merged 3 commits intomockery:masterfrom
ghostwriter:bugfix/mock-mixed-return-types

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

Comments