Example #1
0
 /**
  * @test
  */
 public function it_should_have_a_name_and_offer_two_services()
 {
     $services = [Service::fromName(new ProvidedService('Hammers for Renting')), Service::fromName(new ProvidedService('Saws for Renting'))];
     $company = Company::createAndOfferServices(new CompanyName('Acme'), $services);
     $this->assertEquals(new CompanyName('Acme'), $company->getName());
     $this->assertEquals($services, $company->getOfferedServices()->toArray());
 }
Example #2
0
 /**
  * @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);
 }
Example #4
0
 /**
  * @test
  */
 public function it_should_have_a_name_and_no_company()
 {
     $service = Service::fromName(new ProvidedService('Hammers for Rental'));
     $this->assertNull($service->getCompany());
     $this->assertEquals(new ProvidedService('Hammers for Rental'), $service->getProvidedService());
 }
Example #5
0
 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 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'));
 }