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

Use native attribute to read mocks #319

Open
wants to merge 2 commits into
base: 4.4
Choose a base branch
from

Conversation

pierredup
Copy link
Contributor

This allows to import mock classes when using the Phake\Mock attribute

use Some\Awesome\CoolInterface;

class Foo
{
    #[\Phake\Mock(CoolInterface::class)]
    private $mockProperty;
}

This builds on top of #318 to have access to the Phake\Mock attribute class.

Copy link
Member

@adoy adoy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks :) Same as your previous PR. Could you please rebase it to 4.4 branch.

@@ -61,8 +62,11 @@ class NativeReaderTest extends TestCase
#[\Phake\Mock(class: self::class)]
private $mockWithNamedType;

#[\Phake\Mock(foo: self::class)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to keep a test where class is null ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these 2 test cases still cover this scenario where class would be null

#[\Phake\Mock]
private $mock;

#[\Phake\Mock()]
private IMock $mockWithNativeType;

@pierredup pierredup changed the base branch from master to 4.4 May 10, 2023 08:30
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.

None yet

2 participants