/** * @Given I have a customer :name */ public function iHaveACustomer($name) { $customer = new Customer($name . '_' . uniqid() . '@example.com'); $customer->setName($name)->setPasswd('passpass666')->setCompany('company')->setAddress(new Address('addressLine1', 'city', 'state', 'US', '000000'))->setPhone(new Phone('33', '0666666666'))->setLang('en'); $customerManager = new CustomerManager($this->resellerClubClient); $this->customer = $customerManager->register($customer); }
function it_should_register_customer(Customer $customer, Address $addr, Phone $phone) { $customer->getId()->shouldBeCalled(); $customer->getUsername()->willReturn('*****@*****.**'); $customer->getPasswd()->willReturn('secret'); $customer->getName()->willReturn('Superpouetpouet'); $customer->getCompany()->willReturn('PouetCorp'); $customer->getAddress()->willReturn($addr); $customer->getPhone()->willReturn($phone); $customer->getLang()->willReturn('en'); $this->client->post('/customers/signup.json', Argument::type('array'))->willReturn(["123456"]); $customer->setId(123456)->shouldBeCalled(); $this->client->get('/contacts/default.json', Argument::type('array'))->willReturn(['Contact' => ['registrant' => '123456', 'billing' => '123456', 'admin' => '123456', 'tech' => '123456']]); $customer->setContacts(Argument::any())->shouldBeCalled(); $this->register($customer)->shouldReturn($customer); }