2 commits - c++/lib

Thomas Brüderli bruederli at kolabsys.com
Wed Mar 14 18:55:34 CET 2012


 c++/lib/php/test.php |    9 +++++++++
 1 file changed, 9 insertions(+)

New commits:
commit 39ddb5d7dd76120e21a219458bd4a0c5f8ecf386
Merge: 1bb6c03 bba7c40
Author: Thomas Bruederli <bruederli at kolabsys.com>
Date:   Wed Mar 14 18:55:27 2012 +0100

    Merge branch 'master' of ssh://git.kolab.org/git/libkolabxml



commit 1bb6c03b888b57cf1c39c13040dbb2d7afc8160a
Author: Thomas Bruederli <bruederli at kolabsys.com>
Date:   Wed Mar 14 18:54:17 2012 +0100

    Add test for setting and unsetting date fields

diff --git a/c++/lib/php/test.php b/c++/lib/php/test.php
index 71f0443..916bc5a 100644
--- a/c++/lib/php/test.php
+++ b/c++/lib/php/test.php
@@ -102,6 +102,9 @@ $pic = "R0lGODlhEgASAIAAAMDAwAAAACH5BAEAAAAALAAAAAASABIAQAIPhI+py+0Po5y02ouz3pwX
 $c->setPhoto(base64_decode($pic), 'image/gif');
 $c->setGPSpos(array2vector("geo:46.952585,7.43766"));
 
+$bd = new cDateTime(1980,8,1);
+$c->setBDay($bd);
+
 $vcs = new vectorcs;
 $vcs->push(new CustomProperty("initials", "KF"));
 $c->setCustomProperties($vcs);
@@ -111,11 +114,17 @@ $xml = kolabformat::writeContact($c);
 assertcontains($xml, "<uid><uri>urn:uuid:", "Generate Contact UID as urn::uuid");
 assertcontains($xml, "<n><surname>Surname</surname><given>Given</given><additional>Middle1</additional><additional>Middle2</additional><prefix>Prefix</prefix></n>", "Contact::setNameComponents()");
 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()");
+
+$c1->setBDay(new cDateTime);
+$xml = kolabformat::writeContact($c);
+assertfalse(strpos($xml, '<bday><date>'), "Unset BDay with empty cDateTime");
 
 
 /////// Test DistList





More information about the commits mailing list