[Pkg-owncloud-commits] [php-sabredav] 49/220: Fixed more CalDAV tests.
David Prévot
taffit at moszumanska.debian.org
Thu May 12 01:21:06 UTC 2016
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository php-sabredav.
commit 4abc653c22161089c9e2447518a49e2b95949c95
Author: Evert Pot <me at evertpot.com>
Date: Tue Jan 12 21:39:25 2016 -0500
Fixed more CalDAV tests.
---
lib/CalDAV/Xml/Notification/Invite.php | 11 ++--
lib/CalDAV/Xml/Notification/InviteReply.php | 5 +-
lib/CalDAV/Xml/Property/Invite.php | 17 +++---
lib/CalDAV/Xml/Request/InviteReply.php | 11 ++--
tests/Sabre/CalDAV/Xml/Notification/InviteTest.php | 35 ------------
.../CalDAV/Xml/Notification/SystemStatusTest.php | 9 ++--
.../Xml/Property/AllowedSharingModesTest.php | 4 +-
.../CalDAV/Xml/Property/EmailAddressSetTest.php | 2 +-
tests/Sabre/CalDAV/Xml/Property/InviteTest.php | 62 +++++++++++-----------
tests/Sabre/CalDAV/Xml/Request/InviteReplyTest.php | 6 +--
10 files changed, 62 insertions(+), 100 deletions(-)
diff --git a/lib/CalDAV/Xml/Notification/Invite.php b/lib/CalDAV/Xml/Notification/Invite.php
index 7fb022e..1ca64f3 100644
--- a/lib/CalDAV/Xml/Notification/Invite.php
+++ b/lib/CalDAV/Xml/Notification/Invite.php
@@ -5,6 +5,7 @@ namespace Sabre\CalDAV\Xml\Notification;
use Sabre\Xml\Writer;
use Sabre\CalDAV\SharingPlugin as SharingPlugin;
use Sabre\CalDAV;
+use Sabre\DAV;
/**
* This class represents the cs:invite-notification notification element.
@@ -210,16 +211,10 @@ class Invite implements NotificationInterface {
switch ($this->type) {
- case SharingPlugin::STATUS_ACCEPTED :
+ case DAV\Sharing\Plugin::INVITE_ACCEPTED :
$writer->writeElement($cs . 'invite-accepted');
break;
- case SharingPlugin::STATUS_DECLINED :
- $writer->writeElement($cs . 'invite-declined');
- break;
- case SharingPlugin::STATUS_DELETED :
- $writer->writeElement($cs . 'invite-deleted');
- break;
- case SharingPlugin::STATUS_NORESPONSE :
+ case DAV\Sharing\Plugin::INVITE_NORESPONSE :
$writer->writeElement($cs . 'invite-noresponse');
break;
diff --git a/lib/CalDAV/Xml/Notification/InviteReply.php b/lib/CalDAV/Xml/Notification/InviteReply.php
index 945323f..51bfc17 100644
--- a/lib/CalDAV/Xml/Notification/InviteReply.php
+++ b/lib/CalDAV/Xml/Notification/InviteReply.php
@@ -5,6 +5,7 @@ namespace Sabre\CalDAV\Xml\Notification;
use Sabre\Xml\Writer;
use Sabre\CalDAV;
use Sabre\CalDAV\SharingPlugin;
+use Sabre\DAV;
/**
* This class represents the cs:invite-reply notification element.
@@ -162,10 +163,10 @@ class InviteReply implements NotificationInterface {
switch ($this->type) {
- case SharingPlugin::STATUS_ACCEPTED :
+ case DAV\Sharing\Plugin::INVITE_ACCEPTED :
$writer->writeElement($cs . 'invite-accepted');
break;
- case SharingPlugin::STATUS_DECLINED :
+ case DAV\Sharing\Plugin::INVITE_DECLINED :
$writer->writeElement($cs . 'invite-declined');
break;
diff --git a/lib/CalDAV/Xml/Property/Invite.php b/lib/CalDAV/Xml/Property/Invite.php
index 3ee0532..f9b0bac 100644
--- a/lib/CalDAV/Xml/Property/Invite.php
+++ b/lib/CalDAV/Xml/Property/Invite.php
@@ -7,6 +7,7 @@ use Sabre\Xml\Reader;
use Sabre\Xml\Writer;
use Sabre\CalDAV\Plugin;
use Sabre\CalDAV\SharingPlugin;
+use Sabre\DAV;
/**
* Invite property
@@ -131,16 +132,16 @@ class Invite implements Element {
}
switch ($user['status']) {
- case SharingPlugin::STATUS_ACCEPTED :
+ case DAV\Sharing\Plugin::INVITE_ACCEPTED :
$writer->writeElement($cs . 'invite-accepted');
break;
- case SharingPlugin::STATUS_DECLINED :
+ case DAV\Sharing\Plugin::INVITE_DECLINED :
$writer->writeElement($cs . 'invite-declined');
break;
- case SharingPlugin::STATUS_NORESPONSE :
+ case DAV\Sharing\Plugin::INVITE_NORESPONSE :
$writer->writeElement($cs . 'invite-noresponse');
break;
- case SharingPlugin::STATUS_INVALID :
+ case DAV\Sharing\Plugin::INVITE_INVALID :
$writer->writeElement($cs . 'invite-invalid');
break;
}
@@ -207,16 +208,16 @@ class Invite implements Element {
switch ($userElem['name']) {
case $cs . 'invite-accepted' :
- $user['status'] = SharingPlugin::STATUS_ACCEPTED;
+ $user['status'] = DAV\Sharing\Plugin::INVITE_ACCEPTED;
break;
case $cs . 'invite-declined' :
- $user['status'] = SharingPlugin::STATUS_DECLINED;
+ $user['status'] = DAV\Sharing\Plugin::INVITE_DECLINED;
break;
case $cs . 'invite-noresponse' :
- $user['status'] = SharingPlugin::STATUS_NORESPONSE;
+ $user['status'] = DAV\Sharing\Plugin::INVITE_NORESPONSE;
break;
case $cs . 'invite-invalid' :
- $user['status'] = SharingPlugin::STATUS_INVALID;
+ $user['status'] = DAV\Sharing\Plugin::INVITE_INVALID;
break;
case '{DAV:}href' :
$user['href'] = $userElem['value'];
diff --git a/lib/CalDAV/Xml/Request/InviteReply.php b/lib/CalDAV/Xml/Request/InviteReply.php
index ec62715..2ecf6c2 100644
--- a/lib/CalDAV/Xml/Request/InviteReply.php
+++ b/lib/CalDAV/Xml/Request/InviteReply.php
@@ -2,12 +2,13 @@
namespace Sabre\CalDAV\Xml\Request;
+use Sabre\CalDAV\Plugin;
+use Sabre\CalDAV\SharingPlugin;
+use Sabre\DAV;
+use Sabre\DAV\Exception\BadRequest;
use Sabre\Xml\Reader;
use Sabre\Xml\XmlDeserializable;
use Sabre\Xml\Element\KeyValue;
-use Sabre\DAV\Exception\BadRequest;
-use Sabre\CalDAV\Plugin;
-use Sabre\CalDAV\SharingPlugin;
/**
* Invite-reply POST request parser
@@ -121,10 +122,10 @@ class InviteReply implements XmlDeserializable {
}
break;
case '{' . Plugin::NS_CALENDARSERVER . '}invite-accepted' :
- $status = SharingPlugin::STATUS_ACCEPTED;
+ $status = DAV\Sharing\Plugin::INVITE_ACCEPTED;
break;
case '{' . Plugin::NS_CALENDARSERVER . '}invite-declined' :
- $status = SharingPlugin::STATUS_DECLINED;
+ $status = DAV\Sharing\Plugin::INVITE_DECLINED;
break;
case '{' . Plugin::NS_CALENDARSERVER . '}in-reply-to' :
$inReplyTo = $value;
diff --git a/tests/Sabre/CalDAV/Xml/Notification/InviteTest.php b/tests/Sabre/CalDAV/Xml/Notification/InviteTest.php
index 22f1854..99536c1 100644
--- a/tests/Sabre/CalDAV/Xml/Notification/InviteTest.php
+++ b/tests/Sabre/CalDAV/Xml/Notification/InviteTest.php
@@ -77,41 +77,6 @@ FOO
],
[
[
- 'id' => 'foo',
- 'dtStamp' => $dtStamp,
- 'etag' => '"1"',
- 'href' => 'mailto:foo at example.org',
- 'type' => DAV\Sharing\Plugin::INVITE_DECLINED,
- 'readOnly' => true,
- 'hostUrl' => 'calendar',
- 'organizer' => 'principal/user1',
- 'commonName' => 'John Doe',
- ],
-<<<FOO
-<?xml version="1.0" encoding="UTF-8"?>
-<cs:root xmlns:cs="http://calendarserver.org/ns/" xmlns:d="DAV:" xmlns:cal="urn:ietf:params:xml:ns:caldav">
- <cs:dtstamp>20120101T000000Z</cs:dtstamp>
- <cs:invite-notification>
- <cs:uid>foo</cs:uid>
- <d:href>mailto:foo at example.org</d:href>
- <cs:invite-declined/>
- <cs:hosturl>
- <d:href>/calendar</d:href>
- </cs:hosturl>
- <cs:access>
- <cs:read/>
- </cs:access>
- <cs:organizer>
- <d:href>/principal/user1</d:href>
- <cs:common-name>John Doe</cs:common-name>
- </cs:organizer>
- <cs:organizer-cn>John Doe</cs:organizer-cn>
- </cs:invite-notification>
-</cs:root>
-FOO
- ],
- [
- [
'id' => 'foo',
'dtStamp' => $dtStamp,
'etag' => '"1"',
diff --git a/tests/Sabre/CalDAV/Xml/Notification/SystemStatusTest.php b/tests/Sabre/CalDAV/Xml/Notification/SystemStatusTest.php
index 54251e0..58ab93b 100644
--- a/tests/Sabre/CalDAV/Xml/Notification/SystemStatusTest.php
+++ b/tests/Sabre/CalDAV/Xml/Notification/SystemStatusTest.php
@@ -2,7 +2,6 @@
namespace Sabre\CalDAV\Xml\Notification;
-use Sabre\CalDAV;
use Sabre\DAV;
use Sabre\Xml\Writer;
@@ -30,12 +29,12 @@ class SystemStatusTest extends \PHPUnit_Framework_TestCase {
$writer = new Writer();
$writer->namespaceMap = [
'http://calendarserver.org/ns/' => 'cs',
- 'DAV:' => 'd',
+ 'DAV:' => 'd',
];
$writer->openMemory();
$writer->startDocument('1.0', 'UTF-8');
$writer->startElement('{http://calendarserver.org/ns/}root');
- $notification->xmlSerializeFull($writer);;
+ $notification->xmlSerializeFull($writer);
$writer->endElement();
$this->assertXmlStringEqualsXmlString($expected2, $writer->outputMemory());
@@ -51,12 +50,12 @@ class SystemStatusTest extends \PHPUnit_Framework_TestCase {
'<?xml version="1.0" encoding="UTF-8"?>' . "\n" . '<cs:root xmlns:cs="http://calendarserver.org/ns/" xmlns:d="DAV:"><cs:systemstatus type="high"/></cs:root>' . "\n",
],
[
- new SystemStatus('foo', '"1"', SystemStatus::TYPE_MEDIUM,'bar'),
+ new SystemStatus('foo', '"1"', SystemStatus::TYPE_MEDIUM, 'bar'),
'<?xml version="1.0" encoding="UTF-8"?>' . "\n" . '<cs:root xmlns:cs="http://calendarserver.org/ns/"><cs:systemstatus type="medium"/></cs:root>' . "\n",
'<?xml version="1.0" encoding="UTF-8"?>' . "\n" . '<cs:root xmlns:cs="http://calendarserver.org/ns/" xmlns:d="DAV:"><cs:systemstatus type="medium"><cs:description>bar</cs:description></cs:systemstatus></cs:root>' . "\n",
],
[
- new SystemStatus('foo', '"1"', SystemStatus::TYPE_LOW,null,'http://example.org/'),
+ new SystemStatus('foo', '"1"', SystemStatus::TYPE_LOW, null, 'http://example.org/'),
'<?xml version="1.0" encoding="UTF-8"?>' . "\n" . '<cs:root xmlns:cs="http://calendarserver.org/ns/"><cs:systemstatus type="low"/></cs:root>' . "\n",
'<?xml version="1.0" encoding="UTF-8"?>' . "\n" . '<cs:root xmlns:cs="http://calendarserver.org/ns/" xmlns:d="DAV:"><cs:systemstatus type="low"><d:href>http://example.org/</d:href></cs:systemstatus></cs:root>' . "\n",
]
diff --git a/tests/Sabre/CalDAV/Xml/Property/AllowedSharingModesTest.php b/tests/Sabre/CalDAV/Xml/Property/AllowedSharingModesTest.php
index 375d7fe..0602d4f 100644
--- a/tests/Sabre/CalDAV/Xml/Property/AllowedSharingModesTest.php
+++ b/tests/Sabre/CalDAV/Xml/Property/AllowedSharingModesTest.php
@@ -9,7 +9,7 @@ class AllowedSharingModesTest extends DAV\Xml\XmlTest {
function testSimple() {
- $sccs = new AllowedSharingModes(true,true);
+ $sccs = new AllowedSharingModes(true, true);
$this->assertInstanceOf('Sabre\CalDAV\Xml\Property\AllowedSharingModes', $sccs);
}
@@ -19,7 +19,7 @@ class AllowedSharingModesTest extends DAV\Xml\XmlTest {
*/
function testSerialize() {
- $property = new AllowedSharingModes(true,true);
+ $property = new AllowedSharingModes(true, true);
$this->namespaceMap[CalDAV\Plugin::NS_CALDAV] = 'cal';
$this->namespaceMap[CalDAV\Plugin::NS_CALENDARSERVER] = 'cs';
diff --git a/tests/Sabre/CalDAV/Xml/Property/EmailAddressSetTest.php b/tests/Sabre/CalDAV/Xml/Property/EmailAddressSetTest.php
index c3d8c40..30651a0 100644
--- a/tests/Sabre/CalDAV/Xml/Property/EmailAddressSetTest.php
+++ b/tests/Sabre/CalDAV/Xml/Property/EmailAddressSetTest.php
@@ -8,7 +8,7 @@ class EmailAddressSetTest extends XmlTest {
protected $namespaceMap = [
\Sabre\CalDAV\Plugin::NS_CALENDARSERVER => 'cs',
- 'DAV:' => 'd',
+ 'DAV:' => 'd',
];
function testSimple() {
diff --git a/tests/Sabre/CalDAV/Xml/Property/InviteTest.php b/tests/Sabre/CalDAV/Xml/Property/InviteTest.php
index 64102c4..a954a9c 100644
--- a/tests/Sabre/CalDAV/Xml/Property/InviteTest.php
+++ b/tests/Sabre/CalDAV/Xml/Property/InviteTest.php
@@ -29,34 +29,34 @@ class InviteTest extends DAV\Xml\XmlTest {
$property = new Invite([
[
- 'href' => 'mailto:user1 at example.org',
- 'status' => CalDAV\SharingPlugin::STATUS_ACCEPTED,
+ 'href' => 'mailto:user1 at example.org',
+ 'status' => DAV\Sharing\Plugin::INVITE_ACCEPTED,
'readOnly' => false,
],
[
- 'href' => 'mailto:user2 at example.org',
+ 'href' => 'mailto:user2 at example.org',
'commonName' => 'John Doe',
- 'status' => CalDAV\SharingPlugin::STATUS_DECLINED,
- 'readOnly' => true,
+ 'status' => DAV\Sharing\Plugin::INVITE_DECLINED,
+ 'readOnly' => true,
],
[
- 'href' => 'mailto:user3 at example.org',
+ 'href' => 'mailto:user3 at example.org',
'commonName' => 'Joe Shmoe',
- 'status' => CalDAV\SharingPlugin::STATUS_NORESPONSE,
- 'readOnly' => true,
- 'summary' => 'Something, something',
+ 'status' => DAV\Sharing\Plugin::INVITE_NORESPONSE,
+ 'readOnly' => true,
+ 'summary' => 'Something, something',
],
[
- 'href' => 'mailto:user4 at example.org',
+ 'href' => 'mailto:user4 at example.org',
'commonName' => 'Hoe Boe',
- 'status' => CalDAV\SharingPlugin::STATUS_INVALID,
- 'readOnly' => true,
+ 'status' => DAV\Sharing\Plugin::INVITE_INVALID,
+ 'readOnly' => true,
],
], [
- 'href' => 'mailto:thedoctor at example.org',
+ 'href' => 'mailto:thedoctor at example.org',
'commonName' => 'The Doctor',
- 'firstName' => 'The',
- 'lastName' => 'Doctor',
+ 'firstName' => 'The',
+ 'lastName' => 'Doctor',
]);
$xml = $this->write(['{DAV:}root' => $property]);
@@ -114,32 +114,32 @@ class InviteTest extends DAV\Xml\XmlTest {
$input = [
[
- 'href' => 'mailto:user1 at example.org',
- 'status' => CalDAV\SharingPlugin::STATUS_ACCEPTED,
- 'readOnly' => false,
+ 'href' => 'mailto:user1 at example.org',
+ 'status' => DAV\Sharing\Plugin::INVITE_ACCEPTED,
+ 'readOnly' => false,
'commonName' => '',
- 'summary' => '',
+ 'summary' => '',
],
[
- 'href' => 'mailto:user2 at example.org',
+ 'href' => 'mailto:user2 at example.org',
'commonName' => 'John Doe',
- 'status' => CalDAV\SharingPlugin::STATUS_DECLINED,
- 'readOnly' => true,
- 'summary' => '',
+ 'status' => DAV\Sharing\Plugin::INVITE_DECLINED,
+ 'readOnly' => true,
+ 'summary' => '',
],
[
- 'href' => 'mailto:user3 at example.org',
+ 'href' => 'mailto:user3 at example.org',
'commonName' => 'Joe Shmoe',
- 'status' => CalDAV\SharingPlugin::STATUS_NORESPONSE,
- 'readOnly' => true,
- 'summary' => 'Something, something',
+ 'status' => DAV\Sharing\Plugin::INVITE_NORESPONSE,
+ 'readOnly' => true,
+ 'summary' => 'Something, something',
],
[
- 'href' => 'mailto:user4 at example.org',
+ 'href' => 'mailto:user4 at example.org',
'commonName' => 'Hoe Boe',
- 'status' => CalDAV\SharingPlugin::STATUS_INVALID,
- 'readOnly' => true,
- 'summary' => '',
+ 'status' => DAV\Sharing\Plugin::INVITE_INVALID,
+ 'readOnly' => true,
+ 'summary' => '',
],
];
diff --git a/tests/Sabre/CalDAV/Xml/Request/InviteReplyTest.php b/tests/Sabre/CalDAV/Xml/Request/InviteReplyTest.php
index eca35c9..014ea7a 100644
--- a/tests/Sabre/CalDAV/Xml/Request/InviteReplyTest.php
+++ b/tests/Sabre/CalDAV/Xml/Request/InviteReplyTest.php
@@ -3,7 +3,7 @@
namespace Sabre\CalDAV\Xml\Request;
use Sabre\DAV\Xml\XmlTest;
-use Sabre\CalDAV\SharingPlugin;
+use Sabre\DAV;
class InviteReplyTest extends XmlTest {
@@ -25,7 +25,7 @@ class InviteReplyTest extends XmlTest {
XML;
$result = $this->parse($xml);
- $inviteReply = new InviteReply('/principal/1', '/calendar/1', 'blabla', 'Summary', SharingPlugin::STATUS_ACCEPTED);
+ $inviteReply = new InviteReply('/principal/1', '/calendar/1', 'blabla', 'Summary', DAV\Sharing\Plugin::INVITE_ACCEPTED);
$this->assertEquals(
$inviteReply,
@@ -48,7 +48,7 @@ XML;
XML;
$result = $this->parse($xml);
- $inviteReply = new InviteReply('/principal/1', '/calendar/1', 'blabla', 'Summary', SharingPlugin::STATUS_DECLINED);
+ $inviteReply = new InviteReply('/principal/1', '/calendar/1', 'blabla', 'Summary', DAV\Sharing\Plugin::INVITE_DECLINED);
$this->assertEquals(
$inviteReply,
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-php/php-sabredav.git
More information about the Pkg-owncloud-commits
mailing list