Skip to content
This repository was archived by the owner on Jul 8, 2023. It is now read-only.
This repository was archived by the owner on Jul 8, 2023. It is now read-only.

Partial mock does not forward to trait implementation if method exists in interface. #112

Description

@jmalloc

When creating a partial mock using an array of types (an interface and trait), a method implementation provided by the trait will not be used if the interface contains a method of the same name.

The order of types in the array does not matter, and the problem does not affect classes, only traits.

interface Interface_
{
    public function method();
}

trait Trait_
{
    public function method()
    {
        return '<result>';
    }
}

$mock = \Eloquent\Phony\Phony::partialMock([Interface_::class, Trait_::class]);

assert('<result>' === $mock->mock()->method());

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions