diff --git a/src/DataPersister/ChainDataPersister.php b/src/DataPersister/ChainDataPersister.php index 6abf03987a6..2883aa1d63b 100644 --- a/src/DataPersister/ChainDataPersister.php +++ b/src/DataPersister/ChainDataPersister.php @@ -63,7 +63,7 @@ public function remove($data) { foreach ($this->persisters as $persister) { if ($persister->supports($data)) { - $persister->remove($data); + return $persister->remove($data); } } } diff --git a/tests/DataPersister/ChainDataPersisterTest.php b/tests/DataPersister/ChainDataPersisterTest.php index 82d82631bed..c68b8e8b47f 100644 --- a/tests/DataPersister/ChainDataPersisterTest.php +++ b/tests/DataPersister/ChainDataPersisterTest.php @@ -60,7 +60,11 @@ public function testPersist() $barPersisterProphecy->supports($dummy)->willReturn(true)->shouldBeCalled(); $barPersisterProphecy->persist($dummy)->shouldBeCalled(); - (new ChainDataPersister([$fooPersisterProphecy->reveal(), $barPersisterProphecy->reveal()]))->persist($dummy); + $foobarPersisterProphecy = $this->prophesize(DataPersisterInterface::class); + $foobarPersisterProphecy->supports($dummy)->shouldNotBeCalled(); + $foobarPersisterProphecy->persist($dummy)->shouldNotBeCalled(); + + (new ChainDataPersister([$fooPersisterProphecy->reveal(), $barPersisterProphecy->reveal(), $foobarPersisterProphecy->reveal()]))->persist($dummy); } public function testRemove() @@ -75,6 +79,10 @@ public function testRemove() $barPersisterProphecy->supports($dummy)->willReturn(true)->shouldBeCalled(); $barPersisterProphecy->remove($dummy)->shouldBeCalled(); - (new ChainDataPersister([$fooPersisterProphecy->reveal(), $barPersisterProphecy->reveal()]))->remove($dummy); + $foobarPersisterProphecy = $this->prophesize(DataPersisterInterface::class); + $foobarPersisterProphecy->supports($dummy)->shouldNotBeCalled(); + $foobarPersisterProphecy->remove($dummy)->shouldNotBeCalled(); + + (new ChainDataPersister([$fooPersisterProphecy->reveal(), $barPersisterProphecy->reveal(), $foobarPersisterProphecy->reveal()]))->remove($dummy); } }