Skip to content

Commit

Permalink
Merge branch '1.8'
Browse files Browse the repository at this point in the history
Conflicts:
	composer.json
	lib/Sabre/CalDAV/Version.php
	lib/Sabre/CardDAV/Version.php
  • Loading branch information
evert committed May 22, 2013
2 parents 9bb38ca + 5dac5a2 commit 7d1f5f6
Show file tree
Hide file tree
Showing 12 changed files with 33 additions and 26 deletions.
2 changes: 1 addition & 1 deletion bin/migrateto17.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ function getDenormalizedData($calendarData) {
$endDate = clone $component->DTSTART->getDateTime();
$endDate->add(\Sabre\VObject\DateTimeParser::parse($component->DURATION->value));
$lastOccurence = $endDate->getTimeStamp();
} elseif ($component->DTSTART->getDateType()===\Sabre\VObject\Property\DateTime::DATE) {
} elseif (!$component->DTSTART->hasTime()) {
$endDate = clone $component->DTSTART->getDateTime();
$endDate->modify('+1 day');
$lastOccurence = $endDate->getTimeStamp();
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
],
"require": {
"php": ">=5.4.1",
"sabre/vobject" : "2.0.*@dev",
"sabre/vobject" : "3.0.*@dev",
"ext-dom": "*",
"ext-pcre": "*",
"ext-spl": "*",
Expand Down
4 changes: 3 additions & 1 deletion lib/Sabre/CalDAV/Backend/BackendInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,11 @@ public function getCalendarObjects($calendarId);
* 'calendardata' object is required here though, while it's not required
* for getCalendarObjects.
*
* This method must return null if the object did not exist.
*
* @param mixed $calendarId
* @param string $objectUri
* @return array
* @return array|null
*/
public function getCalendarObject($calendarId,$objectUri);

Expand Down
8 changes: 5 additions & 3 deletions lib/Sabre/CalDAV/Backend/PDO.php
Original file line number Diff line number Diff line change
Expand Up @@ -413,9 +413,11 @@ public function getCalendarObjects($calendarId) {
* 'calendardata' object is required here though, while it's not required
* for getCalendarObjects.
*
* This method must return null if the object did not exist.
*
* @param string $calendarId
* @param string $objectUri
* @return array
* @return array|null
*/
public function getCalendarObject($calendarId,$objectUri) {

Expand Down Expand Up @@ -587,9 +589,9 @@ protected function getDenormalizedData($calendarData) {
$lastOccurence = $component->DTEND->getDateTime()->getTimeStamp();
} elseif (isset($component->DURATION)) {
$endDate = clone $component->DTSTART->getDateTime();
$endDate->add(VObject\DateTimeParser::parse($component->DURATION->value));
$endDate->add(VObject\DateTimeParser::parse($component->DURATION->getValue()));
$lastOccurence = $endDate->getTimeStamp();
} elseif ($component->DTSTART->getDateType()===VObject\Property\DateTime::DATE) {
} elseif (!$component->DTSTART->hasTime()) {
$endDate = clone $component->DTSTART->getDateTime();
$endDate->modify('+1 day');
$lastOccurence = $endDate->getTimeStamp();
Expand Down
2 changes: 1 addition & 1 deletion lib/Sabre/CalDAV/ICSExportPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function beforeMethod($method, $uri) {
*/
public function generateICS(array $nodes) {

$calendar = new VObject\Component('vcalendar');
$calendar = new VObject\Component\VCalendar();
$calendar->version = '2.0';
if (DAV\Server::$exposeVersion) {
$calendar->prodid = '-//SabreDAV//SabreDAV ' . DAV\Version::VERSION . '//EN';
Expand Down
2 changes: 1 addition & 1 deletion lib/Sabre/CalDAV/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -1309,7 +1309,7 @@ protected function getFreeBusyForEmail($email, \DateTime $start, \DateTime $end,

}

$vcalendar = VObject\Component::create('VCALENDAR');
$vcalendar = new VObject\Component\VCalendar();
$vcalendar->VERSION = '2.0';
$vcalendar->METHOD = 'REPLY';
$vcalendar->CALSCALE = 'GREGORIAN';
Expand Down
4 changes: 2 additions & 2 deletions lib/Sabre/CardDAV/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ public function validateFilters($vcardData, array $filters, $test) {
if ($filter['text-matches']) {
$texts = array();
foreach($vProperties as $vProperty)
$texts[] = $vProperty->value;
$texts[] = $vProperty->getValue();

$results[] = $this->validateTextMatches($texts, $filter['text-matches'], $filter['test']);
}
Expand Down Expand Up @@ -572,7 +572,7 @@ protected function validateParamFilters(array $vProperties, array $filters, $tes
foreach($vProperties as $vProperty) {
// If we got all the way here, we'll need to validate the
// text-match filter.
$success = DAV\StringUtil::textMatch($vProperty[$filter['name']]->value, $filter['text-match']['value'], $filter['text-match']['collation'], $filter['text-match']['match-type']);
$success = DAV\StringUtil::textMatch($vProperty[$filter['name']]->getValue(), $filter['text-match']['value'], $filter['text-match']['collation'], $filter['text-match']['match-type']);
if ($success) break;
}
if ($filter['text-match']['negate-condition']) {
Expand Down
4 changes: 2 additions & 2 deletions tests/Sabre/CalDAV/Backend/AbstractPDOTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -561,8 +561,8 @@ function testCalendarQueryTimeRange() {

$backend = new PDO($this->pdo);
$backend->createCalendarObject(1, "todo", "BEGIN:VCALENDAR\r\nBEGIN:VTODO\r\nEND:VTODO\r\nEND:VCALENDAR\r\n");
$backend->createCalendarObject(1, "event", "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART:20120101\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n");
$backend->createCalendarObject(1, "event2", "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART:20120103\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n");
$backend->createCalendarObject(1, "event", "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART;VALUE=DATE:20120101\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n");
$backend->createCalendarObject(1, "event2", "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART;VALUE=DATE:20120103\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n");

$filters = array(
'name' => 'VCALENDAR',
Expand Down
21 changes: 12 additions & 9 deletions tests/Sabre/CalDAV/CalendarQueryVAlarmTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,18 @@ class CalendarQueryVAlarmTest extends \PHPUnit_Framework_TestCase {
*/
function testValarm() {

$vevent = VObject\Component::create('VEVENT');
$vcalendar = new VObject\Component\VCalendar();

$vevent = $vcalendar->createComponent('VEVENT');
$vevent->RRULE = 'FREQ=MONTHLY';
$vevent->DTSTART = '20120101T120000Z';
$vevent->UID = 'bla';

$valarm = VObject\Component::create('VALARM');
$valarm = $vcalendar->createComponent('VALARM');
$valarm->TRIGGER = '-P15D';
$vevent->add($valarm);

$vcalendar = VObject\Component::create('VCALENDAR');

$vcalendar->add($vevent);

$filter = array(
Expand Down Expand Up @@ -54,34 +56,35 @@ function testValarm() {
$validator = new CalendarQueryValidator();
$this->assertTrue($validator->validate($vcalendar, $filter));

$vcalendar = new VObject\Component\VCalendar();

// A limited recurrence rule, should return false
$vevent = VObject\Component::create('VEVENT');
$vevent = $vcalendar->createComponent('VEVENT');
$vevent->RRULE = 'FREQ=MONTHLY;COUNT=1';
$vevent->DTSTART = '20120101T120000Z';
$vevent->UID = 'bla';

$valarm = VObject\Component::create('VALARM');
$valarm = $vcalendar->createComponent('VALARM');
$valarm->TRIGGER = '-P15D';
$vevent->add($valarm);

$vcalendar = VObject\Component::create('VCALENDAR');
$vcalendar->add($vevent);

$this->assertFalse($validator->validate($vcalendar, $filter));
}

function testAlarmWayBefore() {

$vevent = VObject\Component::create('VEVENT');
$vcalendar = new VObject\Component\VCalendar();

$vevent = $vcalendar->createComponent('VEVENT');
$vevent->DTSTART = '20120101T120000Z';
$vevent->UID = 'bla';

$valarm = VObject\Component::create('VALARM');
$valarm = $vcalendar->createComponent('VALARM');
$valarm->TRIGGER = '-P2W1D';
$vevent->add($valarm);

$vcalendar = VObject\Component::create('VCALENDAR');
$vcalendar->add($vevent);

$filter = array(
Expand Down
4 changes: 2 additions & 2 deletions tests/Sabre/CalDAV/ExpandEventsDTSTARTandDTENDTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ function testExpand() {

if ($child->name == 'DTSTART') {
// DTSTART has to be one of three valid values
$this->assertContains($child->value, array('20120207T171500Z', '20120208T171500Z', '20120209T171500Z'), 'DTSTART is not a valid value: '.$child->value);
$this->assertContains($child->getValue(), array('20120207T171500Z', '20120208T171500Z', '20120209T171500Z'), 'DTSTART is not a valid value: '.$child->getValue());
} elseif ($child->name == 'DTEND') {
// DTEND has to be one of three valid values
$this->assertContains($child->value, array('20120207T181500Z', '20120208T181500Z', '20120209T181500Z'), 'DTEND is not a valid value: '.$child->value);
$this->assertContains($child->getValue(), array('20120207T181500Z', '20120208T181500Z', '20120209T181500Z'), 'DTEND is not a valid value: '.$child->getValue());
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Sabre/CalDAV/ExpandEventsDTSTARTandDTENDbyDayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ function testExpandRecurringByDayEvent() {

if ($child->name == 'DTSTART') {
// DTSTART has to be one of two valid values
$this->assertContains($child->value, array('20120214T171500Z', '20120216T171500Z'), 'DTSTART is not a valid value: '.$child->value);
$this->assertContains($child->getValue(), array('20120214T171500Z', '20120216T171500Z'), 'DTSTART is not a valid value: '.$child->getValue());
} elseif ($child->name == 'DTEND') {
// DTEND has to be one of two valid values
$this->assertContains($child->value, array('20120214T181500Z', '20120216T181500Z'), 'DTEND is not a valid value: '.$child->value);
$this->assertContains($child->getValue(), array('20120214T181500Z', '20120216T181500Z'), 'DTEND is not a valid value: '.$child->getValue());
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Sabre/CalDAV/Issue203Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ function testIssue203() {
/** @var $child Sabre\VObject\Property */

if (isset($expectedEvent[$child->name])) {
if ($expectedEvent[$child->name] != $child->value) {
if ($expectedEvent[$child->name] != $child->getValue()) {
continue 2;
}
}
Expand Down

0 comments on commit 7d1f5f6

Please sign in to comment.