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

Problem mocking abstract class with __wakeup and __construct #14

Closed
bolton opened this issue Nov 28, 2010 · 3 comments
Closed

Problem mocking abstract class with __wakeup and __construct #14

bolton opened this issue Nov 28, 2010 · 3 comments

Comments

@bolton
Copy link

bolton commented Nov 28, 2010

I'm trying to mock Zend_Db_Adapter_Abstract, and get an exception thrown "BadMethodCallException: Method :: _ _wakeup() does not exist on this mock object". Looking at the method mock in Container.php, it calls _getInstance which unserializes the mocked object if it has a constructor. This appears to happen before the $quickdefs are applied, so I'm not sure how you can mock an abstract object that has _ _wakeup and __construct defined?

Thanks for the work on this - it's made my testing much easier!

@padraic
Copy link
Member

padraic commented Feb 21, 2011

Patched in master - you can mock classes with a __wakeup (that's not final) though you cannot set expectations of any calls it might make. It's error avoidance - let me know if it works (will be testing more scenarios in time).

@bolton
Copy link
Author

bolton commented Feb 28, 2011

I was able to mock Zend_Db_Adapter_Abstract without any errors with the current master. Thanks!

@padraic
Copy link
Member

padraic commented Feb 28, 2011

You're welcome :). Thanks for reporting it!

This issue was closed.
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

2 participants