From: gggeek Date: Sun, 7 Dec 2014 21:08:14 +0000 (+0000) Subject: Avoid testsuite failure on php 5.2 with DateTimes X-Git-Tag: 4.0.0-alpha~5 X-Git-Url: http://git.onelab.eu/?p=plcapi.git;a=commitdiff_plain;h=9107200d73d380c154d92ebb9d5452f3a3c8169d Avoid testsuite failure on php 5.2 with DateTimes --- diff --git a/test/testsuite.php b/test/testsuite.php index 0164c66..3b33f80 100644 --- a/test/testsuite.php +++ b/test/testsuite.php @@ -228,8 +228,12 @@ And turned it into nylon'; if (class_exists('DateTime')) { $datetime = new DateTime(); - $t3 = new xmlrpcval($datetime->setTimestamp($time), 'dateTime.iso8601'); - $this->assertEquals($t1->serialize(), $t3->serialize()); + // skip this test for php 5.2. It is a bit harder there to build a DateTime from unix timestamp with proper TZ info + if(is_callable(array($datetime,'setTimestamp'))) + { + $t3 = new xmlrpcval($datetime->setTimestamp($time), 'dateTime.iso8601'); + $this->assertEquals($t1->serialize(), $t3->serialize()); + } } }