Is it possible to set properties on a Mock Object in Simpletest
- by JW
I normally use getter and setter methods on my objects and I am fine with testing them as mock objects in SimpleTest by manipulating them with code like:
Mock::generate('MyObj');
$MockMyObj->setReturnValue('getPropName', 'value')
However, I have recently started to use magic interceptors (__set() __get()) and access properties like so:
$MyObj->propName = 'blah';
But I am having difficulty making a mock object have a particular property accessed by using that technique.
So is there some special way of setting properties on MockObjects.
I have tried doing:
$MockMyObj->propName = 'test Value';
but this does not seem to work. Not sure if it is my test Subject, Mock, magic Interceptors, or SimpleTest that is causing the property to be unaccessable.
Any advice welcome.