/** * @test */ public function commitDeletesSagaIfItIsInactive() { $storage = $this->createStorage(); $serializer = $this->createSerializer(); $sagaIdentity = Identity::createNew(); $saga = $this->getMockBuilder(Saga::class)->setConstructorArgs([$sagaIdentity, new AssociationValues([])])->getMock(); $saga->expects(self::any())->method('isActive')->willReturn(false); $storage->expects(self::once())->method('delete')->with($saga->getId()->getValue()); $repository = new SagaRepository($storage, $serializer); $repository->commit($saga); }
/** * @param Saga $saga */ protected function commit(Saga $saga) { $this->repository->commit($saga); }