forked from sabre-io/vobject
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:fruux/sabre-vobject
- Loading branch information
Showing
15 changed files
with
224 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,6 @@ class Version { | |
/** | ||
* Full version number. | ||
*/ | ||
const VERSION = '4.0.0-alpha2'; | ||
const VERSION = '4.0.0-alpha3'; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
namespace Sabre\VObject; | ||
|
||
class Issue259Test extends \PHPUnit_Framework_TestCase { | ||
|
||
function testParsingJcalWithUntil() { | ||
$jcalWithUntil = '["vcalendar",[],[["vevent",[["uid",{},"text","dd1f7d29"],["organizer",{"cn":"robert"},"cal-address","mailto:robert@robert.com"],["dtstart",{"tzid":"Europe/Berlin"},"date-time","2015-10-21T12:00:00"],["dtend",{"tzid":"Europe/Berlin"},"date-time","2015-10-21T13:00:00"],["transp",{},"text","OPAQUE"],["rrule",{},"recur",{"freq":"MONTHLY","until":"2016-01-01T22:00:00Z"}]],[]]]]'; | ||
$parser = new Parser\Json(); | ||
$parser->setInput($jcalWithUntil); | ||
|
||
$vcalendar = $parser->parse(); | ||
$eventAsArray = $vcalendar->select('VEVENT'); | ||
$event = reset($eventAsArray); | ||
$rruleAsArray = $event->select('RRULE'); | ||
$rrule = reset($rruleAsArray); | ||
$this->assertNotNull($rrule); | ||
$this->assertEquals($rrule->getValue(), 'FREQ=MONTHLY;UNTIL=20160101T220000Z'); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
namespace Sabre\VObject; | ||
|
||
class IssueUndefinedIndexTest extends \PHPUnit_Framework_TestCase { | ||
|
||
/** | ||
* @expectedException \Sabre\VObject\ParseException | ||
*/ | ||
function testRead() { | ||
|
||
$input = <<<VCF | ||
BEGIN:VCARD | ||
VERSION:3.0 | ||
PRODID:foo | ||
N:Holmes;Sherlock;;; | ||
FN:Sherlock Holmes | ||
ORG:Acme Inc; | ||
ADR;type=WORK;type=pref:;;, | ||
\\n221B,Baker Street;London;;12345;United Kingdom | ||
UID:foo | ||
END:VCARD | ||
VCF; | ||
|
||
$vcard = Reader::read($input, Reader::OPTION_FORGIVING); | ||
$this->assertInstanceOf('Sabre\\VObject\\Component\\VCard', $vcard); | ||
|
||
} | ||
|
||
} |
59 changes: 59 additions & 0 deletions
59
tests/VObject/Recur/EventIterator/HandleRDateExpandTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
|
||
namespace Sabre\VObject; | ||
|
||
use DateTime; | ||
use DateTimeImmutable; | ||
use DateTimeZone; | ||
|
||
/** | ||
* This is a unittest for Issue #53. | ||
*/ | ||
class HandleRDateExpandTest extends \PHPUnit_Framework_TestCase { | ||
|
||
function testExpand() { | ||
|
||
$input = <<<ICS | ||
BEGIN:VCALENDAR | ||
VERSION:2.0 | ||
BEGIN:VEVENT | ||
UID:2CD5887F7CF4600F7A3B1F8065099E40-240BDA7121B61224 | ||
DTSTAMP;VALUE=DATE-TIME:20151014T110604Z | ||
CREATED;VALUE=DATE-TIME:20151014T110245Z | ||
LAST-MODIFIED;VALUE=DATE-TIME:20151014T110541Z | ||
DTSTART;VALUE=DATE-TIME;TZID=Europe/Berlin:20151012T020000 | ||
DTEND;VALUE=DATE-TIME;TZID=Europe/Berlin:20151012T013000 | ||
SUMMARY:Test | ||
SEQUENCE:2 | ||
RDATE;VALUE=DATE-TIME;TZID=Europe/Berlin:20151015T020000,20151017T020000,20 | ||
151018T020000,20151020T020000 | ||
TRANSP:OPAQUE | ||
CLASS:PUBLIC | ||
END:VEVENT | ||
END:VCALENDAR | ||
ICS; | ||
|
||
$vcal = Reader::read($input); | ||
$this->assertInstanceOf('Sabre\\VObject\\Component\\VCalendar', $vcal); | ||
|
||
$vcal->expand(new DateTime('2015-01-01'), new DateTime('2015-12-01')); | ||
|
||
$result = iterator_to_array($vcal->vevent); | ||
|
||
$this->assertEquals(5, count($result)); | ||
|
||
$utc = new DateTimeZone('UTC'); | ||
$expected = array( | ||
new DateTimeImmutable("2015-10-12", $utc), | ||
new DateTimeImmutable("2015-10-15", $utc), | ||
new DateTimeImmutable("2015-10-17", $utc), | ||
new DateTimeImmutable("2015-10-18", $utc), | ||
new DateTimeImmutable("2015-10-20", $utc), | ||
); | ||
|
||
$result = array_map(function($ev){return $ev->dtstart->getDateTime();}, $result); | ||
$this->assertEquals($expected, $result); | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters