[Pkg-owncloud-commits] [php-sabre-vobject] 94/128: Testing VJOURNAL

David Prévot taffit at moszumanska.debian.org
Tue May 20 23:11:06 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 538b1714cee88190326f1742b49b49e81a6a0998
Author: Evert Pot <evert at rooftopsolutions.nl>
Date:   Wed Apr 2 17:57:46 2014 -0400

    Testing VJOURNAL
---
 tests/Sabre/VObject/Component/VJournalTest.php | 58 ++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)

diff --git a/tests/Sabre/VObject/Component/VJournalTest.php b/tests/Sabre/VObject/Component/VJournalTest.php
index 35f6d6c..10fc49f 100644
--- a/tests/Sabre/VObject/Component/VJournalTest.php
+++ b/tests/Sabre/VObject/Component/VJournalTest.php
@@ -3,6 +3,7 @@
 namespace Sabre\VObject\Component;
 
 use Sabre\VObject\Component;
+use Sabre\VObject\Reader;
 
 class VJournalTest extends \PHPUnit_Framework_TestCase {
 
@@ -15,6 +16,61 @@ class VJournalTest extends \PHPUnit_Framework_TestCase {
 
     }
 
+    public function testValidate() {
+
+        $input = <<<HI
+BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:YoYo
+BEGIN:VJOURNAL
+UID:12345678
+DTSTAMP:20140402T174100Z
+END:VJOURNAL
+END:VCALENDAR
+HI;
+
+        $obj = Reader::read($input);
+
+        $warnings = $obj->validate();
+        $messages = array();
+        foreach($warnings as $warning) {
+            $messages[] = $warning['message'];
+        }
+
+        $this->assertEquals(array(), $messages);
+
+    }
+
+    public function testValidateBroken() {
+
+        $input = <<<HI
+BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:YoYo
+BEGIN:VJOURNAL
+UID:12345678
+DTSTAMP:20140402T174100Z
+URL:http://example.org/
+URL:http://example.com/
+END:VJOURNAL
+END:VCALENDAR
+HI;
+
+        $obj = Reader::read($input);
+
+        $warnings = $obj->validate();
+        $messages = array();
+        foreach($warnings as $warning) {
+            $messages[] = $warning['message'];
+        }
+
+        $this->assertEquals(
+            array("URL MUST NOT appear more than once in a VJOURNAL component"),
+            $messages
+        );
+
+    }
+
     public function timeRangeTestData() {
 
         $calendar = new VCalendar();
@@ -39,5 +95,7 @@ class VJournalTest extends \PHPUnit_Framework_TestCase {
         return $tests;
     }
 
+
+
 }
 

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