/**
  * @param stdClass $response
  *
  * @return Contact
  */
 private function createContactFromResponse(stdClass $response)
 {
     $contact = new Contact();
     $contact->setLoginId($response->login_id)->setYourReference($response->your_reference)->setFirstName($response->first_name)->setLastName($response->last_name)->setEmailAddress($response->email_address)->setAccountId($response->account_id)->setAccountName($response->account_name)->setStatus($response->status)->setPhoneNumber($response->phone_number)->setMobilePhoneNumber($response->mobile_phone_number)->setLocale($response->locale)->setTimezone($response->timezone)->setDateOfBirth(new DateTime($response->date_of_birth))->setCreatedAt(new DateTime($response->created_at))->setUpdatedAt(new DateTime($response->updated_at));
     $this->setIdProperty($contact, $response->id);
     return $contact;
 }
 /**
  * @test
  */
 public function canUpdateWhenEverythingIsSet()
 {
     $data = '{"login_id":"john.smith","id":"543477161-91de-012f-e284-1e0030c7f352","your_reference":"ACME12345","first_name":"John","last_name":"Smith","account_id":"87077161-91de-012f-e284-1e0030c7f352","account_name":"Company PLC","status":"enabled","phone_number":"06554 87845","mobile_phone_number":"07564 534 54","locale":"en-US","timezone":"Europe/London","email_address":"*****@*****.**","date_of_birth":"1980-01-22","created_at":"2014-01-12T00:00:00+00:00","updated_at":"2014-01-12T00:00:00+00:00"}';
     $date = new DateTime();
     $contact = Contact::create('A', 'B', 'C', 'D', 'E')->setAccountName('F')->setYourReference('G')->setMobilePhoneNumber('H')->setLoginId('I')->setStatus('J')->setTimezone('K')->setLocale('L')->setMobilePhoneNumber('H')->setDateOfBirth($date);
     $this->setIdProperty($contact, 'hi');
     $manager = $this->getMockedEntityManager($contact, clone $contact);
     $entryPoint = new ContactsEntryPoint($manager, $this->getMockedClient(json_decode($data), 'POST', 'contacts/hi', [], ['account_id' => 'A', 'first_name' => 'B', 'last_name' => 'C', 'email_address' => 'D', 'phone_number' => 'E', 'account_name' => 'F', 'your_reference' => 'G', 'mobile_phone_number' => 'H', 'login_id' => 'I', 'status' => 'J', 'timezone' => 'K', 'locale' => 'L', 'date_of_birth' => $date->format('Y-m-d')]));
     $item = $entryPoint->update($contact);
     $this->validateObjectStrictName($item, json_decode($data, true));
 }