Hello, prophecy has problem with cloned double object.
Here is example:
class Foo
{
private $object;
public function __construct($object)
{
$this->object = clone $object;
}
public function getObject()
{
return $this->object;
}
}
And spec tests:
class FooSpec extends ObjectBehavior
{
public function it_compares_cloned_object()
{
$object = new \stdClass();
$this->beConstructedWith($object);
$this->getObject()->shouldBeLike($object);
}
public function it_compares_cloned_double_object(\stdClass $object)
{
$this->beConstructedWith($object);
$this->getObject()->shouldBeLike($object);
}
}
I expect the same behavior for two tests but first passed and second failed with error:
Hello, prophecy has problem with cloned double object. Here is example:
And spec tests:
I expect the same behavior for two tests but first passed and second failed with error:
Also I found the solution and I would like to shere with you.