Andree Surya
unread,Jun 29, 2010, 8:37:12 AM6/29/10Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to phpmo...@googlegroups.com
Hi there,
I have been using Mockery for a while. Great job, I would say. Very intuitive interface, and the readme file pretty much explains everything.
However, I'm currently having a problem constructing a mock object of a Zend component.
When I do this ..
\Mockery::mock('Zend_Db_Table_Rowset_Abstract');
.. I always got the following error:
BadMethodCallException: Method ::__wakeup() does not exist on this mock object
D:\programs\xampplite\php\PEAR\Mockery\Container.php:246
D:\programs\xampplite\php\PEAR\Mockery\Container.php:96
D:\programs\xampplite\php\PEAR\Mockery.php:49
D:\documents\eclipse_workspace\project_name\tests\application\module_name\models\SampleTest.php:24
Looking at the source code, I found the following method at \Mockery\Container.php line 246:
protected function _getInstance($mockName)
{
if (!method_exists($mockName, '__construct')) {
$return = new $mockName;
return $return;
}
$return = unserialize(sprintf('O:%d:"%s":0:{}', strlen($mockName), $mockName));
return $return;
}
Well, I do actually have several questions in my mind, like why the constructor is not found, why do mockery have to perform serialization/unserialization. But basically what I want to do is to make a mock object of Zend_Db_Table_Rowset_Abstract. Can anyone help me?