[Pkg-owncloud-commits] [php-sabre-vobject] 92/128: Higher test coverage.

David Prévot taffit at moszumanska.debian.org
Tue May 20 23:11:05 UTC 2014


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 7341af678916f28739bee4085b23d43dab3fe0ac
Author: Evert Pot <evert at rooftopsolutions.nl>
Date:   Wed Apr 2 17:15:14 2014 -0400

    Higher test coverage.
---
 lib/Sabre/VObject/TimeZoneUtil.php   | 14 ++++++++------
 tests/Sabre/VObject/UUIDUtilTest.php | 37 ++++++++++++++++++++++++++++++++++++
 2 files changed, 45 insertions(+), 6 deletions(-)

diff --git a/lib/Sabre/VObject/TimeZoneUtil.php b/lib/Sabre/VObject/TimeZoneUtil.php
index 41b4581..eb3d47c 100644
--- a/lib/Sabre/VObject/TimeZoneUtil.php
+++ b/lib/Sabre/VObject/TimeZoneUtil.php
@@ -150,14 +150,16 @@ class TimeZoneUtil {
 
         // Maybe the author was hyper-lazy and just included an offset. We
         // support it, but we aren't happy about it.
-        //
-        // Note that the path in the source will never be taken from PHP 5.5.10
-        // onwards. PHP 5.5.10 supports the "GMT+0100" style of format, so it
-        // already gets returned early in this function. Once we drop support
-        // for versions under PHP 5.5.10, this bit can be taken out of the
-        // source.
         if (preg_match('/^GMT(\+|-)([0-9]{4})$/', $tzid, $matches)) {
+
+            // Note that the path in the source will never be taken from PHP 5.5.10
+            // onwards. PHP 5.5.10 supports the "GMT+0100" style of format, so it
+            // already gets returned early in this function. Once we drop support
+            // for versions under PHP 5.5.10, this bit can be taken out of the
+            // source.
+            // @codeCoverageIgnoreStart
             return new \DateTimeZone('Etc/GMT' . $matches[1] . ltrim(substr($matches[2],0,2),'0'));
+            // @codeCoverageIgnoreEnd
         }
 
         if ($vcalendar) {
diff --git a/tests/Sabre/VObject/UUIDUtilTest.php b/tests/Sabre/VObject/UUIDUtilTest.php
new file mode 100644
index 0000000..d33a879
--- /dev/null
+++ b/tests/Sabre/VObject/UUIDUtilTest.php
@@ -0,0 +1,37 @@
+<?php
+
+namespace Sabre\VObject;
+
+class UUIDUtilTest extends \PHPUnit_Framework_TestCase {
+
+    function testValidateUUID() {
+
+        $this->assertTrue(
+            UUIDUtil::validateUUID('11111111-2222-3333-4444-555555555555')
+        );
+        $this->assertFalse(
+            UUIDUtil::validateUUID(' 11111111-2222-3333-4444-555555555555')
+        );
+        $this->assertTrue(
+            UUIDUtil::validateUUID('ffffffff-2222-3333-4444-555555555555')
+        );
+        $this->assertFalse(
+            UUIDUtil::validateUUID('fffffffg-2222-3333-4444-555555555555')
+        );
+
+    }
+
+    /**
+     * @depends testValidateUUID
+     */
+    function testGetUUID() {
+
+        $this->assertTrue(
+            UUIDUtil::validateUUID(
+                UUIDUtil::getUUID()
+            )
+        );
+
+    }
+
+}

-- 
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