setMiddleName() public method

public setMiddleName ( $middleName )
Exemplo n.º 1
0
 /**
  * Test if deleteinfo returns correct data.
  */
 public function testGetDeleteInfoById()
 {
     // modify test data
     for ($i = 0; $i < 5; ++$i) {
         $contact = new Contact();
         $contact->setFirstName('Vorname ' . $i);
         $contact->setLastName('Nachname ' . $i);
         $contact->setMiddleName('Mittelname ' . $i);
         $contact->setFormOfAddress(0);
         $this->em->persist($contact);
         $accountContact = new AccountContact();
         $accountContact->setContact($contact);
         $accountContact->setAccount($this->account);
         $accountContact->setMain(true);
         $this->em->persist($accountContact);
         $this->account->addAccountContact($accountContact);
     }
     $this->em->flush();
     $numContacts = $this->account->getAccountContacts()->count();
     $client = $this->createAuthenticatedClient();
     $client->request('GET', '/api/accounts/' . $this->account->getId() . '/deleteinfo');
     $this->assertEquals('200', $client->getResponse()->getStatusCode());
     $response = json_decode($client->getResponse()->getContent());
     // number of returned contacts has to be less or equal 3
     $this->assertEquals(3, count($response->contacts));
     // return full number of contacts related to account
     $this->assertEquals($numContacts, $response->numContacts);
     // allowed if no subaccount exists
     $this->assertEquals(0, $response->numChildren);
 }
 private function initOrm()
 {
     $this->account = new Account();
     $this->account->setName('Company');
     $this->account->setDisabled(0);
     $this->account->setPlaceOfJurisdiction('Feldkirch');
     $urlType = new UrlType();
     $urlType->setName('Private');
     $url = new Url();
     $url->setUrl('http://www.company.example');
     $url->setUrlType($urlType);
     $this->account->addUrl($url);
     $emailType = new EmailType();
     $emailType->setName('Private');
     $email = new Email();
     $email->setEmail('*****@*****.**');
     $email->setEmailType($emailType);
     $this->account->addEmail($email);
     $phoneType = new PhoneType();
     $phoneType->setName('Private');
     $phone = new Phone();
     $phone->setPhone('123456789');
     $phone->setPhoneType($phoneType);
     $this->account->addPhone($phone);
     $faxType = new FaxType();
     $faxType->setName('Private');
     $fax = new Fax();
     $fax->setFax('123654789');
     $fax->setFaxType($faxType);
     $this->account->addFax($fax);
     $country = new Country();
     $country->setName('Musterland');
     $country->setCode('ML');
     $addressType = new AddressType();
     $addressType->setName('Private');
     $address = new Address();
     $address->setStreet('Musterstraße');
     $address->setNumber('1');
     $address->setZip('0000');
     $address->setCity('Musterstadt');
     $address->setState('Musterland');
     $address->setCountry($country);
     $address->setAddressType($addressType);
     $address->setBillingAddress(true);
     $address->setPrimaryAddress(true);
     $address->setDeliveryAddress(false);
     $address->setPostboxCity('Dornbirn');
     $address->setPostboxPostcode('6850');
     $address->setPostboxNumber('4711');
     $accountAddress = new AccountAddress();
     $accountAddress->setAddress($address);
     $accountAddress->setAccount($this->account);
     $accountAddress->setMain(true);
     $this->account->addAccountAddress($accountAddress);
     $address->addAccountAddress($accountAddress);
     $contact = new Contact();
     $contact->setFirstName('Vorname');
     $contact->setLastName('Nachname');
     $contact->setMiddleName('Mittelname');
     $contact->setDisabled(0);
     $contact->setFormOfAddress(0);
     $accountContact = new AccountContact();
     $accountContact->setContact($contact);
     $accountContact->setAccount($this->account);
     $accountContact->setMain(true);
     $this->account->addAccountContact($accountContact);
     $note = new Note();
     $note->setValue('Note');
     $this->account->addNote($note);
     $this->setUpMediaEntities();
     $this->em->persist($this->account);
     $this->em->persist($urlType);
     $this->em->persist($url);
     $this->em->persist($emailType);
     $this->em->persist($accountContact);
     $this->em->persist($email);
     $this->em->persist($phoneType);
     $this->em->persist($phone);
     $this->em->persist($country);
     $this->em->persist($addressType);
     $this->em->persist($address);
     $this->em->persist($accountAddress);
     $this->em->persist($note);
     $this->em->persist($faxType);
     $this->em->persist($fax);
     $this->em->persist($contact);
     $this->em->flush();
 }