<product-id>Horde::Kolab</product-id>
  <display-name>Another lista</display-name>
  <member>
    <display-name>Another  User</display-name>
    <smtp-address>other@debian-vm.local</smtp-address>
    <uid>a2cfdc52365ef429042413bf7717dc85</uid>
  </member>
  <member>
    <display-name>Sample A. User Jr.</display-name>
    <smtp-address>sample@debian-vm.local</smtp-address>
    <uid>f538c7e9ad5a63e4452b7db3bc291231</uid>
  </member>
</distribution-list>
EOL;
$xo = new XMLObject();
$dl = new DistList($xo->readDistList($dlxml, kolabobject::KolabV2));
echo $dl->uid() . "\n\n";
$ml = $dl->members();
for ($i = 0; $i < $ml->size(); $i++) {
    $m = $ml->get($i);
    echo "Member [" . $m->type() . "]: " . $m->uid() . "; " . $m->email() . "\n";
}
$dl2 = new DistList();
$ml = new vectorcontactref();
$m1 = new ContactReference(ContactReference::UidReference, 'some-uid-value');
$ml->push($m1);
$m2 = new ContactReference(ContactReference::EmailReference, 'sample@localhost');
$ml->push($m2);
$dl2->setMembers($ml);
echo $xo->writeDistList($dl2, kolabobject::KolabV2);
echo $xo->writeDistList($dl2, kolabobject::KolabV3);
assertcontains($xml, "<n><surname>Surname</surname><given>Given</given><additional>Middle1</additional><additional>Middle2</additional><prefix>Prefix</prefix></n>", "Contact::setNameComponents()");
assertcontains($xml, "<title><text>MyProfession</text></title>", "Contact::setTitles()");
assertcontains($xml, "<photo><uri>data:image/gif;base64,{$pic}</uri></photo>", "Contact::setPhoto()");
assertcontains($xml, "<bday><date>19800801</date></bday>", "Contact::setBDay()");
assertcontains($xml, "<geo><uri>geo:46.952585,7.43766</uri></geo>", "Contact::setGPSpos()");
$c1 = kolabformat::readContact($xml, false);
assertequal($xml, kolabformat::writeContact($c1), "kolabformat::readContact() => kolabformat::writeContact()");
assertequal($c1->photoMimetype(), "image/gif", "Contact::photoMimetype()");
assertequal($c1->uid(), kolabformat::getSerializedUID(), "kolabformat::getSerializedUID()");
$lm = $c1->lastModified();
assertequal(sprintf('%d-%02d-%02d', $lm->year(), $lm->month(), $lm->day()), gmdate('Y-m-d'), "Contact::lastModified()");
$c1->setBDay(new cDateTime());
$xml = kolabformat::writeContact($c);
assertfalse(strpos($xml, '<bday><date>'), "Unset BDay with empty cDateTime");
/////// Test DistList
$dl = new DistList();
$dl->setName("DalistÄÖŸ");
$m = new vectorcontactref();
$a = new ContactReference(ContactReference::EmailReference, "a@localhost", "Member-A");
$m->push($a);
$b = new ContactReference(ContactReference::UidReference, "x-member-b-fff");
$b->setName("Member-B");
$m->push($b);
#$c = new ContactReference(ContactReference::EmailAndUidReference, "c@localhost", "dddaab06-0000-0000-eeb5-cc64ff7f0000");
#$c->setName("Member-C");
#$m->push($c);
assertequal($m->size(), 2, "vectorcontactref::size()");
$dl->setMembers($m);
$xml = kolabformat::writeDistlist($dl);
#print $xml;
assertcontains($xml, '<fn><text>DalistÄÖŸ</text></fn>', "kolabformat::writeDistlist(): FN (UTF-8)");