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

Simple mock object not passing 'instanceof' test #24

Closed
markushausammann opened this issue Apr 28, 2011 · 2 comments
Closed

Simple mock object not passing 'instanceof' test #24

markushausammann opened this issue Apr 28, 2011 · 2 comments

Comments

@markushausammann
Copy link

When I use a phpUnit mock:

$mock = $this->getMock('Lib_Some_Class_Name');

the following:

($mock instanceof Lib_Some_Class_Name)

will be true. If I do the same with a Mockery mock

 $mock = m::mock('Lib_Some_Class_Name');

it doesn't. What am I doing/understanding wrong?

@markushausammann
Copy link
Author

While debugging I see that the phpUnit mock is an Object of: Mock_Lib_Some_Class_Name_xyzsomething while the Mockery mock is Object of: Mockery\Mock. So I assume that's what makes the difference for the test. Now I assume I would need to create an Alias Mock... but what if the class I want to mock is not in a namespace?

I'll just keep on trying.

@markushausammann
Copy link
Author

Allright, the solution: just use:

m::mock('alias:Lib_Some_Class_Name');

Brilliant :)

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

No branches or pull requests

1 participant