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

registerFake support for Mockery instances #15

Open
daanklijn opened this issue Jul 16, 2019 · 1 comment
Open

registerFake support for Mockery instances #15

daanklijn opened this issue Jul 16, 2019 · 1 comment
Labels
enhancement New feature or request

Comments

@daanklijn
Copy link

Would it be an idea to let the registerFake method support Mockery instances?

Right now this code:

$browser->registerFake(myClass::class, Mockery::mock(myClass::class));
$mock = $browser->mock(myClass::class);

results in a case where the mock for myClass can't be found.

@NoelDeMartin
Copy link
Owner

I don't think that's possible because the registerFake method expects a class name, not an instance. If you want to fake a class MyClass, you could tell it to fake it with another class, for example MyClassFake. But Mockery::mock returns a mocked instance of MyClass, so that's probably why it doesn't work.

I'll check out if I can do something with mockery before closing this issue, but I'm skeptic about it because it probably cannot be serialized.

If you're not sure why it needs to be serialized read the How does it work? section on the readme.

@NoelDeMartin NoelDeMartin added the enhancement New feature or request label Nov 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants