public function getValidInputs() { $obj = new EntranceFee(); $obj->setAmount(9.99); $obj->setCurrency('USD'); $obj->setDurationValue(12); return [[['amount' => 9.99, 'currency' => 'USD', 'durationValue' => 12], $obj]]; }
protected function addUserFixture($nickname, $uid = '123456789') { $user = $this->getService('security.netizen.factory')->create($nickname, 'dummy', $uid); $fee = new EntranceFee(); $fee->setDurationValue(12); $user->addTicket(new Ticket($fee)); $prof = $user->getProfile(); $prof->fullName = ucfirst($nickname); $prof->gender = 'xy'; $prof->dateOfBirth = DateTime::createFromFormat(DateTime::ISO8601, '1918-10-11T00:00:00Z'); $prof->email = $nickname . '@server.tld'; $this->getService('social.netizen.repository')->persist($user); }
/** * Persists the unique fee * * @param EntranceFee $fee */ public function persistEntranceFee(EntranceFee $fee) { $dbFee = $this->findEntranceFee(); if (is_null($dbFee) || $dbFee->getId() === $fee->getId()) { $this->repository->persist($fee); } else { throw new \DomainException('Only one unique Fee must be configured'); } }
public function testPersistExistingFee() { $fee = new EntranceFee(); $fee->setId(new \MongoId()); $this->repository->expects($this->once())->method('findOne')->with(['-class' => 'fee'])->willReturn($fee); $this->repository->expects($this->once())->method('persist')->with($fee); $this->sut->persistEntranceFee($fee); }
public function testTitle() { $this->assertStringStartsWith('payment', $this->sut->getTitle()); }