function testEncode() { $card = new Component\VCard(); $card->add('N', array('van der Harten', array('Rene', 'J.'), "", 'Sir', 'R.D.O.N.'), array('SORT-AS' => array('Harten', 'Rene'))); $expected = implode("\r\n", array("BEGIN:VCARD", "VERSION:3.0", "PRODID:-//Sabre//Sabre VObject " . Version::VERSION . '//EN', "N;SORT-AS=Harten,Rene:van der Harten;Rene,J.;;Sir;R.D.O.N.", "END:VCARD", "")); $this->assertEquals($expected, $card->serialize()); }
function testVCard21Parameter() { $vcard = new Component\VCard(array(), false); $vcard->VERSION = '2.1'; $vcard->PHOTO = 'random_stuff'; $vcard->PHOTO->add(null, 'BASE64'); $vcard->UID = 'foo-bar'; $result = $vcard->serialize(); $expected = array("BEGIN:VCARD", "VERSION:2.1", "PHOTO;BASE64:" . base64_encode('random_stuff'), "UID:foo-bar", "END:VCARD", ""); $this->assertEquals(implode("\r\n", $expected), $result); }