public function testPutDeleteAndAddWithoutId()
{
$client = $this->createTestClient();
$client->request('PUT', '/api/contacts/' . $this->contact->getId(), ['firstName' => 'John', 'lastName' => 'Doe', 'title' => $this->contactTitle->getId(), 'position' => ['id' => $this->contactPosition->getId(), 'position' => $this->contactPosition->getPosition()], 'emails' => [['email' => '*****@*****.**', 'emailType' => ['id' => $this->emailType->getId(), 'name' => 'Private']]], 'phones' => [['phone' => '789456123', 'phoneType' => ['id' => $this->phoneType->getId(), 'name' => 'Private']]], 'faxes' => [['fax' => '147258369-1', 'faxType' => ['id' => $this->faxType->getId(), 'name' => 'Private']]], 'addresses' => [['street' => 'Street', 'number' => '2', 'zip' => '9999', 'city' => 'Springfield', 'state' => 'Colorado', 'country' => ['id' => $this->country->getId(), 'name' => 'Musterland', 'code' => 'ML'], 'addressType' => ['id' => $this->addressType->getId(), 'name' => 'Private'], 'billingAddress' => true, 'primaryAddress' => true, 'deliveryAddress' => false, 'postboxCity' => 'Dornbirn', 'postboxPostcode' => '6850', 'postboxNumber' => '4711', 'note' => 'note']], 'notes' => [['value' => 'Note 1_1']], 'salutation' => 'Sehr geehrter John', 'formOfAddress' => ['id' => 0]]);
$response = json_decode($client->getResponse()->getContent());
$this->assertEquals('John', $response->firstName);
$this->assertEquals('Doe', $response->lastName);
$this->assertEquals('MSc', $response->title->title);
$this->assertEquals('*****@*****.**', $response->emails[0]->email);
$this->assertEquals('789456123', $response->phones[0]->phone);
$this->assertEquals('147258369-1', $response->faxes[0]->fax);
$this->assertEquals('Street', $response->addresses[0]->street);
$this->assertEquals('2', $response->addresses[0]->number);
$this->assertEquals('9999', $response->addresses[0]->zip);
$this->assertEquals('Springfield', $response->addresses[0]->city);
$this->assertEquals('Colorado', $response->addresses[0]->state);
$this->assertEquals('Note 1_1', $response->notes[0]->value);
$this->assertEquals('note', $response->addresses[0]->note);
$this->assertEquals(1, count($response->notes));
$this->assertEquals(true, $response->addresses[0]->billingAddress);
$this->assertEquals(true, $response->addresses[0]->primaryAddress);
$this->assertEquals(false, $response->addresses[0]->deliveryAddress);
$this->assertEquals('Dornbirn', $response->addresses[0]->postboxCity);
$this->assertEquals('6850', $response->addresses[0]->postboxPostcode);
$this->assertEquals('4711', $response->addresses[0]->postboxNumber);
$this->assertEquals(0, $response->formOfAddress);
$this->assertEquals('Sehr geehrter John', $response->salutation);
$client->request('GET', '/api/contacts/' . $response->id);
$response = json_decode($client->getResponse()->getContent());
$this->assertEquals('John', $response->firstName);
$this->assertEquals('Doe', $response->lastName);
$this->assertEquals('MSc', $response->title->title);
$this->assertEquals('*****@*****.**', $response->emails[0]->email);
$this->assertEquals('789456123', $response->phones[0]->phone);
$this->assertEquals('147258369-1', $response->faxes[0]->fax);
$this->assertEquals('Street', $response->addresses[0]->street);
$this->assertEquals('2', $response->addresses[0]->number);
$this->assertEquals('note', $response->addresses[0]->note);
$this->assertEquals('9999', $response->addresses[0]->zip);
$this->assertEquals('Springfield', $response->addresses[0]->city);
$this->assertEquals('Colorado', $response->addresses[0]->state);
$this->assertEquals('Note 1_1', $response->notes[0]->value);
$this->assertEquals(1, count($response->notes));
$this->assertEquals(true, $response->addresses[0]->billingAddress);
$this->assertEquals(true, $response->addresses[0]->primaryAddress);
$this->assertEquals(false, $response->addresses[0]->deliveryAddress);
$this->assertEquals('Dornbirn', $response->addresses[0]->postboxCity);
$this->assertEquals('6850', $response->addresses[0]->postboxPostcode);
$this->assertEquals('4711', $response->addresses[0]->postboxNumber);
$this->assertEquals(0, $response->formOfAddress);
$this->assertEquals('Sehr geehrter John', $response->salutation);
}