PHPSpec:通过引用返回的函数

PHPSpec:通过引用返回的函数,php,doctrine-orm,phpspec,Php,Doctrine Orm,Phpspec,我在我的项目中将条令2.5更新为2.6,phpspec被破坏 函数getEntityChangeSet()现在通过引用返回。它似乎不受phpspec的支持 $unitOfWork ->getEntityChangeSet($site) ->willReturn(['_dataParent' => [0 => 2, 1 => 3]]); 答案是 不支持通过引用返回 底层函数()是 你知道有没有可能绕过这个测试或者改变测试来让它工作吗?答案已经在Tw

我在我的项目中将条令2.5更新为2.6,phpspec被破坏

函数
getEntityChangeSet()
现在通过引用返回。它似乎不受phpspec的支持

$unitOfWork
    ->getEntityChangeSet($site)
    ->willReturn(['_dataParent' => [0 => 2, 1 => 3]]);
答案是
不支持通过引用返回

底层函数()是


你知道有没有可能绕过这个测试或者改变测试来让它工作吗?

答案已经在Twitter上给出了

你必须用嘲弄来嘲弄工作单位。例如:


为什么通过引用?@SenseeException:提到的函数是供应商代码:
public function & getEntityChangeSet($entity)
{
    $oid  = spl_object_hash($entity);
    $data = [];

    if (!isset($this->entityChangeSets[$oid])) {
        return $data;
    }

    return $this->entityChangeSets[$oid];
}
    /** @var UnitOfWork|MockInterface $unitOfWork */
    $unitOfWork = Mockery::mock(UnitOfWork::class);
    $unitOfWork->shouldReceive('getEntityChangeSet')->withArgs([$productAttribute->getWrappedObject()])->andReturn([
        'configuration' => [
            ['choices' => [
                '8ec40814-adef-4194-af91-5559b5f19236' => 'Banana',
                '1739bc61-9e42-4c80-8b9a-f97f0579cccb' => 'Pineapple',
            ]],
            ['choices' => [
                '8ec40814-adef-4194-af91-5559b5f19236' => 'Banana',
            ]],
        ],
    ]);
    $entityManager->getUnitOfWork()->willReturn($unitOfWork);