[Pkg-owncloud-commits] [php-sabre-vobject] 20/38: ATTACH is a URI value, unless it's specified as BINARY. We had it the other way around.

David Prévot taffit at moszumanska.debian.org
Tue Sep 23 03:10:22 UTC 2014


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

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

commit 79c8e18a412aeab80f447edb826835e897dc16d2
Author: Evert Pot <evert at rooftopsolutions.nl>
Date:   Tue Sep 16 18:45:01 2014 +0100

    ATTACH is a URI value, unless it's specified as BINARY. We had it the other way around.
    
    Fixes #128
---
 ChangeLog.md                                |  2 +-
 lib/Component/VCalendar.php                 |  2 +-
 tests/VObject/ICalendar/AttachParseTest.php | 31 +++++++++++++++++++++++++++++
 tests/VObject/JCalTest.php                  | 11 +++++-----
 tests/VObject/Parser/JsonTest.php           |  2 +-
 5 files changed, 40 insertions(+), 8 deletions(-)

diff --git a/ChangeLog.md b/ChangeLog.md
index b3d2d7c..55c7530 100644
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -12,7 +12,7 @@ ChangeLog
 * #122: Don't generate REPLY messages for events that have been cancelled.
 * #123: Added `SUMMARY` to iTip messages.
 * #130: Incorrect validation rules for `RELATED` (should be `RELATED-TO`).
-
+* #128: `ATTACH` in iCalendar is `URI` by default, not `BINARY`.
 
 3.3.1 (2014-08-18)
 ------------------
diff --git a/lib/Component/VCalendar.php b/lib/Component/VCalendar.php
index 8e609f2..01c165d 100644
--- a/lib/Component/VCalendar.php
+++ b/lib/Component/VCalendar.php
@@ -77,7 +77,7 @@ class VCalendar extends VObject\Document {
         'VERSION'       => 'Sabre\\VObject\\Property\\FlatText',
 
         // Component properties
-        'ATTACH'            => 'Sabre\\VObject\\Property\\Binary',
+        'ATTACH'            => 'Sabre\\VObject\\Property\\Uri',
         'CATEGORIES'        => 'Sabre\\VObject\\Property\\Text',
         'CLASS'             => 'Sabre\\VObject\\Property\\FlatText',
         'COMMENT'           => 'Sabre\\VObject\\Property\\FlatText',
diff --git a/tests/VObject/ICalendar/AttachParseTest.php b/tests/VObject/ICalendar/AttachParseTest.php
new file mode 100644
index 0000000..0c4fc87
--- /dev/null
+++ b/tests/VObject/ICalendar/AttachParseTest.php
@@ -0,0 +1,31 @@
+<?php
+
+namespace Sabre\VObject\ICalendar;
+
+use Sabre\VObject\Reader;
+
+class AttachParseTest extends \PHPUnit_Framework_TestCase {
+
+    /**
+     * See issue #128 for more info.
+     */
+    function testParseAttach() {
+
+        $vcal = <<<ICS
+BEGIN:VCALENDAR
+BEGIN:VEVENT
+ATTACH;FMTTYPE=application/postscript:ftp://example.com/pub/reports/r-960812.ps
+END:VEVENT
+END:VCALENDAR
+ICS;
+
+        $vcal = Reader::read($vcal);
+        $prop = $vcal->VEVENT->ATTACH;
+
+        $this->assertInstanceOf('Sabre\\VObject\\Property\\URI', $prop);
+        $this->assertEquals('ftp://example.com/pub/reports/r-960812.ps', $prop->getValue());
+
+
+    }
+
+}
diff --git a/tests/VObject/JCalTest.php b/tests/VObject/JCalTest.php
index 79731d7..8c44618 100644
--- a/tests/VObject/JCalTest.php
+++ b/tests/VObject/JCalTest.php
@@ -14,7 +14,7 @@ class JCalTest extends \PHPUnit_Framework_TestCase {
             "DURATION" => "P1D",
             "CATEGORIES" => array('home', 'testing'),
             "CREATED" => new \DateTime("2013-05-26 18:10:00Z"),
-            "ATTACH" => "attachment",
+
             "ATTENDEE" => "mailto:armin at example.org",
             "GEO" => array(51.96668, 7.61876),
             "SEQUENCE" => 5,
@@ -28,7 +28,7 @@ class JCalTest extends \PHPUnit_Framework_TestCase {
         $event->dtstart['VALUE'] = 'DATE';
         $event->add("X-BOOL", true, array('VALUE' => 'BOOLEAN'));
         $event->add("X-TIME", "08:00:00", array('VALUE' => 'TIME'));
-
+        $event->add("ATTACH", "attachment", array('VALUE' => 'BINARY'));
         $event->add("ATTENDEE", "mailto:dominik at example.org", array("CN" => "Dominik", "PARTSTAT" => "DECLINED"));
 
         $event->add('REQUEST-STATUS', array("2.0", "Success"));
@@ -74,9 +74,7 @@ class JCalTest extends \PHPUnit_Framework_TestCase {
                         array(
                             "created", new \StdClass(), "date-time", "2013-05-26T18:10:00Z",
                         ),
-                        array(
-                            "attach", new \StdClass(), "binary", base64_encode('attachment')
-                        ),
+
                         array(
                             "attendee", new \StdClass(), "cal-address", "mailto:armin at example.org",
                         ),
@@ -108,6 +106,9 @@ class JCalTest extends \PHPUnit_Framework_TestCase {
                             "x-time", new \StdClass(), "time", "08:00:00",
                         ),
                         array(
+                            "attach", new \StdClass(), "binary", base64_encode('attachment')
+                        ),
+                        array(
                             "attendee",
                             (object)array(
                                 "cn" => "Dominik",
diff --git a/tests/VObject/Parser/JsonTest.php b/tests/VObject/Parser/JsonTest.php
index bba6434..adbbda3 100644
--- a/tests/VObject/Parser/JsonTest.php
+++ b/tests/VObject/Parser/JsonTest.php
@@ -325,7 +325,7 @@ DTSTART;VALUE=DATE:20130526
 DURATION:P1D
 CATEGORIES:home,testing
 CREATED:20130526T181000Z
-ATTACH:YXR0YWNobWVudA==
+ATTACH;VALUE=BINARY:YXR0YWNobWVudA==
 ATTENDEE:mailto:armin at example.org
 GEO:51.96668;7.61876
 SEQUENCE:5

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