/** * @test */ public function it_should_have_a_name_and_company() { $company = Company::createWithoutServices(new CompanyName('FooBar')); $service = Service::offer(new ProvidedService('Hammers for Rental'), $company); $this->assertSame($company, $service->getCompany()); $this->assertEquals(new ProvidedService('Hammers for Rental'), $service->getProvidedService()); }
/** * {@inheritdoc} */ function load(ObjectManager $manager) { $service = Service::offer(new ProvidedService('100MB Internet'), $this->getReference('company_vm')); $this->setReference('service_internet', $service); $manager->persist($service); $manager->flush(); }
/** * @return Bill */ public function getBill() { $service = Service::fromName(new ProvidedService('foo')); $account = Account::open($service, new AccountNumber('abc123'), Money::fromFloat(20.0), new \DateTime('now'), new BillingPeriod('P30D')); $bill = Bill::create($account, new \DateTime('now')); $this->injectId($bill); return $bill; }
/** * @test */ public function it_should_return_view_service() { $service = Service::fromName(new ProvidedService('Hammer Rentals')); $templating = $this->getTemplatingMock(); $templating->expects($this->once())->method('render')->with('@HCLabsBills/Service/view.html.twig', ['service' => $service]); $controller = new ServiceController($templating); $response = $controller->viewServiceAction($service); $this->assertInstanceOf('\\Symfony\\Component\\HttpFoundation\\Response', $response); }
/** * @test */ public function it_should_be_able_to_offer_services_after_instantiation() { $company = Company::createWithoutServices(new CompanyName('Acme')); $this->assertEquals(new \Doctrine\Common\Collections\ArrayCollection(), $company->getOfferedServices()); $service = Service::offer(new ProvidedService('Hammers for Renting'), $company); $company->offerService($service); $services = new \Doctrine\Common\Collections\ArrayCollection([$service]); $this->assertEquals($services, $company->getOfferedServices()); }
private function getAccount() { return Account::open(Service::fromName(new ProvidedService('foo')), new AccountNumber('abc123'), Money::fromFloat(50.0), new \DateTime('now'), new BillingPeriod('P2Y')); }
/** * @return Service */ private function createServicesAndCompany() { $company = Company::createWithoutServices(new Value\CompanyName('Acme')); return Service::offer(new Value\ProvidedService('Hammers for Rental'), $company); }
/** * @return OpenAccountCommand */ private function configureOpenAccountCommand() { return new OpenAccountCommand(Service::fromName(new ProvidedService('Hammers for Rental')), new AccountNumber('abc123'), Money::fromFloat(25.0), new \DateTime('now'), new BillingPeriod((new Monthly())->getBillingIntervalString())); }
/** * @return Account */ private function getAccount() { $service = Service::fromName(new ProvidedService('FooBar')); return Account::open($service, new AccountNumber('abc123'), Money::fromFloat(50.0), new \DateTime('now'), new BillingPeriod((new Monthly())->getBillingIntervalString()), null, new \DateTime('now +2 months')); }