Sulu\Bundle\ContactBundle\Entity\ContactTitle::getId PHP Method

getId() public method

Get id.
public getId ( ) : integer
return integer
    public function getId()
    {
        return $this->id;
    }

Usage Example

Ejemplo n.º 1
0
 public function testPrimaryAddressHandlingPut()
 {
     $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' => [['id' => $this->email->getId(), 'email' => '*****@*****.**', 'emailType' => ['id' => $this->emailType->getId(), 'name' => 'Private']]], 'addresses' => [['id' => $this->address->getId(), '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'], ['street' => 'Street 1', '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'], ['street' => 'Street 2', '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']], 'salutation' => 'Sehr geehrter John', 'formOfAddress' => ['id' => 0]]);
     $response = json_decode($client->getResponse()->getContent());
     usort($response->addresses, $this->sortAddressesPrimaryLast());
     $this->assertEquals(false, $response->addresses[0]->primaryAddress);
     $this->assertEquals(false, $response->addresses[1]->primaryAddress);
     $this->assertEquals(true, $response->addresses[2]->primaryAddress);
     $client->request('GET', '/api/contacts/' . $response->id);
     $response = json_decode($client->getResponse()->getContent());
     usort($response->addresses, $this->sortAddressesPrimaryLast());
     $this->assertEquals(false, $response->addresses[0]->primaryAddress);
     $this->assertEquals(false, $response->addresses[1]->primaryAddress);
     $this->assertEquals(true, $response->addresses[2]->primaryAddress);
 }