c++/lib

Thomas Brüderli bruederli at kolabsys.com
Wed Mar 21 15:13:19 CET 2012


 c++/lib/php/test.php |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit c2f4ccf74d699fc562518e3c27c47d6c9fd9d9da
Author: Thomas Bruederli <bruederli at kolabsys.com>
Date:   Wed Mar 21 15:13:09 2012 +0100

    Add (yet failing) test for Contact::setTitles()

diff --git a/c++/lib/php/test.php b/c++/lib/php/test.php
old mode 100644
new mode 100755
index be1ef59..48c3304
--- a/c++/lib/php/test.php
+++ b/c++/lib/php/test.php
@@ -17,8 +17,9 @@ function assertequal($got, $expect, $name) {
 
 function assertcontains($haystack, $needle, $name) {
 	// remove whitespace
-	$haystack = preg_replace('/\s/ims', '', $haystack);
-	$needle = preg_replace('/\s/ims', '', $needle);
+	$haystack = preg_replace('/\n\s*/ims', '', $haystack);
+	$needle = preg_replace('/\n\s*/ims', '', $needle);
+
 	return assertequal(substr(strstr($haystack, $needle), 0, strlen($needle)), $needle, $name);
 }
 
@@ -97,6 +98,7 @@ assertcontains($nc->prefixes()->size(),    1, "NameComponents::setPrefixes()");
 assertcontains($nc->suffixes()->size(),    0, "NameComponents::suffixes()");
 
 $c->setNameComponents($nc);
+$c->setTitles(array2vector("MyProfession"));
 
 $pic = "R0lGODlhEgASAIAAAMDAwAAAACH5BAEAAAAALAAAAAASABIAQAIPhI+py+0Po5y02ouz3pwXADs=";
 $c->setPhoto(base64_decode($pic), 'image/gif');
@@ -113,6 +115,7 @@ $xml = kolabformat::writeContact($c);
 #print $xml;
 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, "<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()");





More information about the commits mailing list