[Pkg-owncloud-commits] [php-sabre-vobject] 37/65: Skip missing timezones in unittests.

David Prévot taffit at moszumanska.debian.org
Tue Feb 24 23:57:16 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository php-sabre-vobject.

commit 0873d63c4b8c8f9c95d42b9efebf231787321d32
Author: Evert Pot <me at evertpot.com>
Date:   Wed Feb 4 13:44:06 2015 -0500

    Skip missing timezones in unittests.
    
    Fixes #203.
---
 ChangeLog.md                       |  2 ++
 tests/VObject/TimeZoneUtilTest.php | 13 +++++++++++--
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/ChangeLog.md b/ChangeLog.md
index 45a98a5..2cad70e 100644
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -8,6 +8,8 @@ ChangeLog
 * #188: Retain floating times when generating instances using
   `Recur\EventIterator`.
 * Updated windows timezone mappings to latest unicode version.
+* #203: Skip tests for timezones that are not supported on older PHP versions,
+  instead of a hard fail.
 
 
 3.3.5 (2015-01-09)
diff --git a/tests/VObject/TimeZoneUtilTest.php b/tests/VObject/TimeZoneUtilTest.php
index b78eb68..9c747e8 100644
--- a/tests/VObject/TimeZoneUtilTest.php
+++ b/tests/VObject/TimeZoneUtilTest.php
@@ -16,8 +16,17 @@ class TimezoneUtilTest extends \PHPUnit_Framework_TestCase {
      */
     function testCorrectTZ($timezoneName) {
 
-        $tz = new \DateTimeZone($timezoneName);
-        $this->assertInstanceOf('DateTimeZone', $tz);
+        try {
+            $tz = new \DateTimeZone($timezoneName);
+            $this->assertInstanceOf('DateTimeZone', $tz);
+        } catch (\Exception $e) {
+            if (strpos($e->getMessage(), "Unknown or bad timezone")!==false) {
+                $this->markTestSkipped($timezoneName . ' is not (yet) supported in this PHP version. Update pecl/timezonedb');
+            } else {
+                throw $e;
+            }
+
+        }
 
     }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/php-sabre-vobject.git



More information about the Pkg-owncloud-commits mailing list