[Pkg-owncloud-commits] [php-sabre-vobject] 20/32: Tests for Property\ICalendar\DateTime

David Prévot taffit at moszumanska.debian.org
Fri Nov 28 22:27:11 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 23e7647fde69f8063162e9c3a32c18c9416d2d54
Author: Evert Pot <me at evertpot.com>
Date:   Thu Nov 13 13:55:28 2014 -0500

    Tests for Property\ICalendar\DateTime
---
 tests/VObject/Property/ICalendar/DateTimeTest.php | 41 ++++++++++++++++++-----
 1 file changed, 33 insertions(+), 8 deletions(-)

diff --git a/tests/VObject/Property/ICalendar/DateTimeTest.php b/tests/VObject/Property/ICalendar/DateTimeTest.php
index 3cf2143..1c028f6 100644
--- a/tests/VObject/Property/ICalendar/DateTimeTest.php
+++ b/tests/VObject/Property/ICalendar/DateTimeTest.php
@@ -2,9 +2,9 @@
 
 namespace Sabre\VObject\Property\ICalendar;
 
-use
-    Sabre\VObject\Component,
-    Sabre\VObject\Component\VCalendar;
+use Sabre\VObject\Component;
+use Sabre\VObject\Component\VCalendar;
+
 
 class DateTimeTest extends \PHPUnit_Framework_TestCase {
 
@@ -121,7 +121,7 @@ class DateTimeTest extends \PHPUnit_Framework_TestCase {
         $dt2->setTimeZone($tz);
 
         $elem = $this->vcal->createProperty('DTSTART');
-        $elem->setValue(array($dt1,$dt2));
+        $elem->setValue([$dt1, $dt2]);
 
         $this->assertEquals('19850704T013000,19850704T023000', (string)$elem);
         $this->assertEquals('Europe/Amsterdam', (string)$elem['TZID']);
@@ -140,7 +140,7 @@ class DateTimeTest extends \PHPUnit_Framework_TestCase {
         $dt2->setTimeZone($tz);
 
         $elem = $this->vcal->createProperty('DTSTART');
-        $elem->setParts(array($dt1,$dt2));
+        $elem->setParts([$dt1, $dt2]);
 
         $this->assertEquals('19850704T013000,19850704T023000', (string)$elem);
         $this->assertEquals('Europe/Amsterdam', (string)$elem['TZID']);
@@ -155,7 +155,7 @@ class DateTimeTest extends \PHPUnit_Framework_TestCase {
         $dt2 = '19850704T023000Z';
 
         $elem = $this->vcal->createProperty('DTSTART');
-        $elem->setParts(array($dt1,$dt2));
+        $elem->setParts([$dt1, $dt2]);
 
         $this->assertEquals('19850704T013000Z,19850704T023000Z', (string)$elem);
         $this->assertNull($elem['VALUE']);
@@ -197,8 +197,20 @@ class DateTimeTest extends \PHPUnit_Framework_TestCase {
 
     }
 
+    function testGetDateTimeDateDATEReferenceTimeZone() {
+
+        $elem = $this->vcal->createProperty('DTSTART','19850704');
+
+        $tz = new \DateTimeZone('America/Toronto');
+        $dt = $elem->getDateTime($tz);
+        $dt->setTimeZone(new \DateTimeZone('UTC'));
+
+        $this->assertInstanceOf('DateTime', $dt);
+        $this->assertEquals('1985-07-04 04:00:00', $dt->format('Y-m-d H:i:s'));
+
+    }
 
-    function testGetDateTimeDateLOCAL() {
+    function testGetDateTimeDateFloating() {
 
         $elem = $this->vcal->createProperty('DTSTART','19850704T013000');
         $dt = $elem->getDateTime();
@@ -208,6 +220,19 @@ class DateTimeTest extends \PHPUnit_Framework_TestCase {
 
     }
 
+    function testGetDateTimeDateFloatingReferenceTimeZone() {
+
+        $elem = $this->vcal->createProperty('DTSTART','19850704T013000');
+
+        $tz = new \DateTimeZone('America/Toronto');
+        $dt = $elem->getDateTime($tz);
+        $dt->setTimeZone(new \DateTimeZone('UTC'));
+
+        $this->assertInstanceOf('DateTime', $dt);
+        $this->assertEquals('1985-07-04 05:30:00', $dt->format('Y-m-d H:i:s'));
+
+    }
+
     function testGetDateTimeDateUTC() {
 
         $elem = $this->vcal->createProperty('DTSTART','19850704T013000Z');
@@ -324,7 +349,7 @@ class DateTimeTest extends \PHPUnit_Framework_TestCase {
         $dtstart = $vevent->add(
             'DTSTART',
             new \DateTime('2014-03-07'),
-            array('VALUE' => 'DATE')
+            ['VALUE' => 'DATE']
         );
 
         $this->assertEquals("DTSTART;VALUE=DATE:20140307\r\n", $dtstart->serialize());

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