I am writing a PHPspec test where want to test if a method was called with the correct argument (in the case an object).
I am doing something like this (pseudo code), inside my spec:
function it_some_test(MyService $myservice) {
$object = new MyDomainObject();
$object->setPropertyX("some value")
$myservice->getSomething($object)->shouldBeCalled();
}
The object is just a DTO created inside my service. Its created exactly the same way in the original Service. Just the value of some properties change based on same logic. thats what I want to test.
The problem is my test is always failing because it says the $object is different from what it was excepting but they have exactly the same properties values.
How does PHPspec compares objects? If I pass Argument::any() instead it works but I need to test the object passed as a property with a specific value.