I'm looking for a way to mock an object and populate its properties. Here's an example of a method who uses a property of another object:
class MyClass {
private $_object;
public function methodUnderTest($object) {
$this->_object = $object;
return $this->_object->property
}
}
To Unit Test this method I should create a mock of $object
with the getMockBuilder()
method from PHPUnit
. But I can't find a way to mock the properties of the $object
, just the methods.
NULL
– Bozovich