/** * @expectedException \DomainException */ public function testPersistDuplicateFee() { $fee = new EntranceFee(); $db = clone $fee; $db->setId(new \MongoId()); $this->repository->expects($this->once())->method('findOne')->with(['-class' => 'fee'])->willReturn($db); $this->repository->expects($this->never())->method('persist'); $this->sut->persistEntranceFee($fee); }
/** * Gets entrance fee model * * @return EntranceFee * * @throws LogicException */ protected function getEntranceFee() { $fee = $this->repository->findEntranceFee(); if (is_null($fee)) { $this->logger->alert('No fee configured'); throw new PaymentMessage('No fee is configured'); } return $fee; }