public function testGetCustomer() { $phoneNumber = new PhoneNumber(); $phoneNumber->setType('Home')->setCountryCode('1')->setNumber('12345678'); $user = new User(); $user->setId(1)->setName('John Doe')->setEmail('*****@*****.**'); $customer = new Customer(); $customer->setId(1)->setAddress('Some rd. 1')->setCity('Some City')->setPostalCode('1234')->setCountry('Some Country')->setPhoneNumbers([$phoneNumber])->setUser($user); $customerArray = ['id' => 1, 'address' => 'Some rd. 1', 'city' => 'Some City', 'postalCode' => '1234', 'country' => 'Some Country', 'phoneNumbers' => [['type' => 'Home', 'countryCode' => '1', 'number' => '12345678']]]; $client = $this->createMock(Client::class); $client->expects($this->once())->method('get')->with($this->equalTo(['/customers/{id}', ['id' => $customer->getId()]]))->will($this->returnValue($customerArray)); $hydrator = $this->getMockBuilder(APIHydrator::class)->disableOriginalConstructor()->getMock(); $hydrator->expects($this->once())->method('hydrate')->with($this->equalTo($customerArray), $this->equalTo(null))->will($this->returnValue($customer)); $service = new CustomerService($client, $hydrator, new Collection()); $this->assertSame($customer, $service->getCustomer($customer->getId())); }