Example #1
0
 /**
  * @group default
  * @depends testOutputEmptyVCard
  */
 public function testOutputWithOneN()
 {
     $name = ['GivenName' => 'Luna', 'AdditionalNames' => 'Charlotte', 'FamilyName' => 'Begtrup', 'Prefixes' => 'Ms.', 'Suffixes' => 'PhD'];
     $fn = 'Ms. Luna C. Begtrup, PhD';
     $fnEsc = VCard::escape($fn);
     $vcard = new vCard();
     $vcard->push(VCard::builder('fn')->setValue($fn)->build())->push(VCard::builder('n')->setValue($name)->build());
     $output = $vcard->output();
     $expected = ['N:' . $name['FamilyName'] . ';' . $name['GivenName'] . ';' . $name['AdditionalNames'] . ';' . $name['Prefixes'] . ';' . $name['Suffixes'], 'FN:' . $fnEsc, 'UID:' . VCard::escape($vcard->getUID())];
     sort($expected);
     $lines = $this->checkAndRemoveSkeleton($output);
     $this->assertEquals($expected, $lines);
 }
Example #2
0
 /**
  * @group default
  * @depends testStoreAndRetrieveVCard
  */
 public function testStoreAndRetrieveWRelated(VCardDB $vcardDB)
 {
     $this->checkRowCounts(['CONTACT' => 0]);
     $vcard = new vCard();
     $vcard->push(VCard::builder('related')->setValue('someUIDValue')->build());
     $vcard->push(VCard::builder('fn')->setValue('nothingInteresting')->build());
     $contactID = $vcardDB->store($vcard);
     $this->checkRowCounts(['CONTACT' => 1], $vcard);
     $resultVCard = $vcardDB->fetchOne($contactID);
     $this->compareVCards($vcard, $resultVCard);
 }