mlively/Phake — pull request #83 by aenglander (2013-02-06 08:10:52+00:00)
Title: Fix for Mock objects losing properties

Certain mock classes lose the class properties when instantiated.
This can lead to an undefine property error. Initializing the value
in the constructor places the value back in the object and continues
without issue.

The issue can be easily re-created with the following test:

publish('arg1', 'arg2');
}
}

This will result in a similar exception:
Undefined property: AMQPExchange_PHAKE511205dc7a58d::$__PHAKE_isFrozen

/virtualhosts/messaging/vendor/phake/phake/src/Phake/MockReader.php:95
/virtualhosts/messaging/vendor/phake/phake/src/Phake/ClassGenerator/InvocationHandler/FrozenObjectCheck.php:69
/virtualhosts/messaging/vendor/phake/phake/src/Phake/ClassGenerator/InvocationHandler/Composite.php:70
/virtualhosts/messaging/tests/FrozenExceptionTest.php:33

I didn't create any specific tests for the situation because I didn't want to make another requirement in the project. If required, I can do so.

Debugging the issue found the properties being lost in object instantiation even though they were clearly present in the class definition. The other properties in the mocks were being initialized in the constructor. They did not have the same issue. I assume this is an issue with mocking this particular extension.