aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/sabre/dav/tests/Sabre/CardDAV
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/sabre/dav/tests/Sabre/CardDAV')
-rw-r--r--vendor/sabre/dav/tests/Sabre/CardDAV/AbstractPluginTest.php14
-rw-r--r--vendor/sabre/dav/tests/Sabre/CardDAV/AddressBookQueryTest.php84
-rw-r--r--vendor/sabre/dav/tests/Sabre/CardDAV/AddressBookRootTest.php16
-rw-r--r--vendor/sabre/dav/tests/Sabre/CardDAV/AddressBookTest.php115
-rw-r--r--vendor/sabre/dav/tests/Sabre/CardDAV/Backend/AbstractPDOTest.php272
-rw-r--r--vendor/sabre/dav/tests/Sabre/CardDAV/Backend/Mock.php116
-rw-r--r--vendor/sabre/dav/tests/Sabre/CardDAV/Backend/PDOMySQLTest.php7
-rw-r--r--vendor/sabre/dav/tests/Sabre/CardDAV/Backend/PDOSqliteTest.php7
-rw-r--r--vendor/sabre/dav/tests/Sabre/CardDAV/CardTest.php132
-rw-r--r--vendor/sabre/dav/tests/Sabre/CardDAV/IDirectoryTest.php22
-rw-r--r--vendor/sabre/dav/tests/Sabre/CardDAV/MultiGetTest.php38
-rw-r--r--vendor/sabre/dav/tests/Sabre/CardDAV/PluginTest.php91
-rw-r--r--vendor/sabre/dav/tests/Sabre/CardDAV/SogoStripContentTypeTest.php41
-rw-r--r--vendor/sabre/dav/tests/Sabre/CardDAV/TestUtil.php31
-rw-r--r--vendor/sabre/dav/tests/Sabre/CardDAV/VCFExportTest.php65
-rw-r--r--vendor/sabre/dav/tests/Sabre/CardDAV/ValidateFilterTest.php83
-rw-r--r--vendor/sabre/dav/tests/Sabre/CardDAV/ValidateVCardTest.php100
17 files changed, 585 insertions, 649 deletions
diff --git a/vendor/sabre/dav/tests/Sabre/CardDAV/AbstractPluginTest.php b/vendor/sabre/dav/tests/Sabre/CardDAV/AbstractPluginTest.php
index 552e2ba77..c945e2c58 100644
--- a/vendor/sabre/dav/tests/Sabre/CardDAV/AbstractPluginTest.php
+++ b/vendor/sabre/dav/tests/Sabre/CardDAV/AbstractPluginTest.php
@@ -1,13 +1,15 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CardDAV;
use Sabre\DAV;
use Sabre\DAVACL;
use Sabre\HTTP;
-abstract class AbstractPluginTest extends \PHPUnit_Framework_TestCase {
-
+abstract class AbstractPluginTest extends \PHPUnit\Framework\TestCase
+{
/**
* @var Sabre\CardDAV\Plugin
*/
@@ -21,14 +23,14 @@ abstract class AbstractPluginTest extends \PHPUnit_Framework_TestCase {
*/
protected $backend;
- function setUp() {
-
+ public function setUp()
+ {
$this->backend = new Backend\Mock();
$principalBackend = new DAVACL\PrincipalBackend\Mock();
$tree = [
new AddressBookRoot($principalBackend, $this->backend),
- new DAVACL\PrincipalCollection($principalBackend)
+ new DAVACL\PrincipalCollection($principalBackend),
];
$this->plugin = new Plugin();
@@ -37,7 +39,5 @@ abstract class AbstractPluginTest extends \PHPUnit_Framework_TestCase {
$this->server->sapi = new HTTP\SapiMock();
$this->server->addPlugin($this->plugin);
$this->server->debugExceptions = true;
-
}
-
}
diff --git a/vendor/sabre/dav/tests/Sabre/CardDAV/AddressBookQueryTest.php b/vendor/sabre/dav/tests/Sabre/CardDAV/AddressBookQueryTest.php
index f8da38a16..6e7e13106 100644
--- a/vendor/sabre/dav/tests/Sabre/CardDAV/AddressBookQueryTest.php
+++ b/vendor/sabre/dav/tests/Sabre/CardDAV/AddressBookQueryTest.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CardDAV;
use Sabre\DAV;
@@ -8,10 +10,10 @@ use Sabre\HTTP;
require_once 'Sabre/CardDAV/AbstractPluginTest.php';
require_once 'Sabre/HTTP/ResponseMock.php';
-class AddressBookQueryTest extends AbstractPluginTest {
-
- function testQuery() {
-
+class AddressBookQueryTest extends AbstractPluginTest
+{
+ public function testQuery()
+ {
$request = new HTTP\Request(
'REPORT',
'/addressbooks/user1/book1',
@@ -37,7 +39,7 @@ class AddressBookQueryTest extends AbstractPluginTest {
$this->server->exec();
- $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:' . $response->body);
+ $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:'.$response->body);
// using the client for parsing
$client = new DAV\Client(['baseUri' => '/']);
@@ -47,21 +49,19 @@ class AddressBookQueryTest extends AbstractPluginTest {
$this->assertEquals([
'/addressbooks/user1/book1/card1' => [
200 => [
- '{DAV:}getetag' => '"' . md5("BEGIN:VCARD\nVERSION:3.0\nUID:12345\nEND:VCARD") . '"',
+ '{DAV:}getetag' => '"'.md5("BEGIN:VCARD\nVERSION:3.0\nUID:12345\nEND:VCARD").'"',
],
],
'/addressbooks/user1/book1/card2' => [
404 => [
'{DAV:}getetag' => null,
],
- ]
+ ],
], $result);
-
-
}
- function testQueryDepth0() {
-
+ public function testQueryDepth0()
+ {
$request = new HTTP\Request(
'REPORT',
'/addressbooks/user1/book1/card1',
@@ -87,7 +87,7 @@ class AddressBookQueryTest extends AbstractPluginTest {
$this->server->exec();
- $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:' . $response->body);
+ $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:'.$response->body);
// using the client for parsing
$client = new DAV\Client(['baseUri' => '/']);
@@ -97,16 +97,14 @@ class AddressBookQueryTest extends AbstractPluginTest {
$this->assertEquals([
'/addressbooks/user1/book1/card1' => [
200 => [
- '{DAV:}getetag' => '"' . md5("BEGIN:VCARD\nVERSION:3.0\nUID:12345\nEND:VCARD") . '"',
+ '{DAV:}getetag' => '"'.md5("BEGIN:VCARD\nVERSION:3.0\nUID:12345\nEND:VCARD").'"',
],
],
], $result);
-
-
}
- function testQueryNoMatch() {
-
+ public function testQueryNoMatch()
+ {
$request = new HTTP\Request(
'REPORT',
'/addressbooks/user1/book1',
@@ -132,7 +130,7 @@ class AddressBookQueryTest extends AbstractPluginTest {
$this->server->exec();
- $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:' . $response->body);
+ $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:'.$response->body);
// using the client for parsing
$client = new DAV\Client(['baseUri' => '/']);
@@ -140,15 +138,14 @@ class AddressBookQueryTest extends AbstractPluginTest {
$result = $client->parseMultiStatus($response->body);
$this->assertEquals([], $result);
-
}
- function testQueryLimit() {
-
+ public function testQueryLimit()
+ {
$request = HTTP\Sapi::createFromServerArray([
'REQUEST_METHOD' => 'REPORT',
- 'REQUEST_URI' => '/addressbooks/user1/book1',
- 'HTTP_DEPTH' => '1',
+ 'REQUEST_URI' => '/addressbooks/user1/book1',
+ 'HTTP_DEPTH' => '1',
]);
$request->setBody(
@@ -171,7 +168,7 @@ class AddressBookQueryTest extends AbstractPluginTest {
$this->server->exec();
- $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:' . $response->body);
+ $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:'.$response->body);
// using the client for parsing
$client = new DAV\Client(['baseUri' => '/']);
@@ -181,16 +178,14 @@ class AddressBookQueryTest extends AbstractPluginTest {
$this->assertEquals([
'/addressbooks/user1/book1/card1' => [
200 => [
- '{DAV:}getetag' => '"' . md5("BEGIN:VCARD\nVERSION:3.0\nUID:12345\nEND:VCARD") . '"',
+ '{DAV:}getetag' => '"'.md5("BEGIN:VCARD\nVERSION:3.0\nUID:12345\nEND:VCARD").'"',
],
],
], $result);
-
-
}
- function testJson() {
-
+ public function testJson()
+ {
$request = new HTTP\Request(
'REPORT',
'/addressbooks/user1/book1/card1',
@@ -214,7 +209,7 @@ class AddressBookQueryTest extends AbstractPluginTest {
$this->server->exec();
- $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:' . $response->body);
+ $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:'.$response->body);
// using the client for parsing
$client = new DAV\Client(['baseUri' => '/']);
@@ -226,16 +221,15 @@ class AddressBookQueryTest extends AbstractPluginTest {
$this->assertEquals([
'/addressbooks/user1/book1/card1' => [
200 => [
- '{DAV:}getetag' => '"' . md5("BEGIN:VCARD\nVERSION:3.0\nUID:12345\nEND:VCARD") . '"',
- '{urn:ietf:params:xml:ns:carddav}address-data' => '["vcard",[["version",{},"text","4.0"],["prodid",{},"text","-\/\/Sabre\/\/Sabre VObject ' . $vobjVersion . '\/\/EN"],["uid",{},"text","12345"]]]',
+ '{DAV:}getetag' => '"'.md5("BEGIN:VCARD\nVERSION:3.0\nUID:12345\nEND:VCARD").'"',
+ '{urn:ietf:params:xml:ns:carddav}address-data' => '["vcard",[["version",{},"text","4.0"],["prodid",{},"text","-\/\/Sabre\/\/Sabre VObject '.$vobjVersion.'\/\/EN"],["uid",{},"text","12345"]]]',
],
],
], $result);
-
}
- function testVCard4() {
-
+ public function testVCard4()
+ {
$request = new HTTP\Request(
'REPORT',
'/addressbooks/user1/book1/card1',
@@ -259,7 +253,7 @@ class AddressBookQueryTest extends AbstractPluginTest {
$this->server->exec();
- $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:' . $response->body);
+ $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:'.$response->body);
// using the client for parsing
$client = new DAV\Client(['baseUri' => '/']);
@@ -271,16 +265,15 @@ class AddressBookQueryTest extends AbstractPluginTest {
$this->assertEquals([
'/addressbooks/user1/book1/card1' => [
200 => [
- '{DAV:}getetag' => '"' . md5("BEGIN:VCARD\nVERSION:3.0\nUID:12345\nEND:VCARD") . '"',
+ '{DAV:}getetag' => '"'.md5("BEGIN:VCARD\nVERSION:3.0\nUID:12345\nEND:VCARD").'"',
'{urn:ietf:params:xml:ns:carddav}address-data' => "BEGIN:VCARD\r\nVERSION:4.0\r\nPRODID:-//Sabre//Sabre VObject $vobjVersion//EN\r\nUID:12345\r\nEND:VCARD\r\n",
],
],
], $result);
-
}
- function testAddressBookDepth0() {
-
+ public function testAddressBookDepth0()
+ {
$request = new HTTP\Request(
'REPORT',
'/addressbooks/user1/book1',
@@ -304,11 +297,11 @@ class AddressBookQueryTest extends AbstractPluginTest {
$this->server->exec();
- $this->assertEquals(415, $response->status, 'Incorrect status code. Full response body:' . $response->body);
+ $this->assertEquals(415, $response->status, 'Incorrect status code. Full response body:'.$response->body);
}
- function testAddressBookProperties() {
-
+ public function testAddressBookProperties()
+ {
$request = new HTTP\Request(
'REPORT',
'/addressbooks/user1/book3',
@@ -335,7 +328,7 @@ class AddressBookQueryTest extends AbstractPluginTest {
$this->server->exec();
- $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:' . $response->body);
+ $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:'.$response->body);
// using the client for parsing
$client = new DAV\Client(['baseUri' => '/']);
@@ -345,11 +338,10 @@ class AddressBookQueryTest extends AbstractPluginTest {
$this->assertEquals([
'/addressbooks/user1/book3/card3' => [
200 => [
- '{DAV:}getetag' => '"' . md5("BEGIN:VCARD\nVERSION:3.0\nUID:12345\nFN:Test-Card\nEMAIL;TYPE=home:bar@example.org\nEND:VCARD") . '"',
+ '{DAV:}getetag' => '"'.md5("BEGIN:VCARD\nVERSION:3.0\nUID:12345\nFN:Test-Card\nEMAIL;TYPE=home:bar@example.org\nEND:VCARD").'"',
'{urn:ietf:params:xml:ns:carddav}address-data' => "BEGIN:VCARD\r\nVERSION:3.0\r\nUID:12345\r\nFN:Test-Card\r\nEND:VCARD\r\n",
],
],
], $result);
-
}
}
diff --git a/vendor/sabre/dav/tests/Sabre/CardDAV/AddressBookRootTest.php b/vendor/sabre/dav/tests/Sabre/CardDAV/AddressBookRootTest.php
index fc20480f2..c4aff2712 100644
--- a/vendor/sabre/dav/tests/Sabre/CardDAV/AddressBookRootTest.php
+++ b/vendor/sabre/dav/tests/Sabre/CardDAV/AddressBookRootTest.php
@@ -1,22 +1,23 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CardDAV;
use Sabre\DAVACL;
-class AddressBookRootTest extends \PHPUnit_Framework_TestCase {
-
- function testGetName() {
-
+class AddressBookRootTest extends \PHPUnit\Framework\TestCase
+{
+ public function testGetName()
+ {
$pBackend = new DAVACL\PrincipalBackend\Mock();
$cBackend = new Backend\Mock();
$root = new AddressBookRoot($pBackend, $cBackend);
$this->assertEquals('addressbooks', $root->getName());
-
}
- function testGetChildForPrincipal() {
-
+ public function testGetChildForPrincipal()
+ {
$pBackend = new DAVACL\PrincipalBackend\Mock();
$cBackend = new Backend\Mock();
$root = new AddressBookRoot($pBackend, $cBackend);
@@ -26,6 +27,5 @@ class AddressBookRootTest extends \PHPUnit_Framework_TestCase {
$this->assertInstanceOf('Sabre\\CardDAV\\AddressBookHome', $children[0]);
$this->assertEquals('user1', $children[0]->getName());
-
}
}
diff --git a/vendor/sabre/dav/tests/Sabre/CardDAV/AddressBookTest.php b/vendor/sabre/dav/tests/Sabre/CardDAV/AddressBookTest.php
index 1f0064dd3..879816803 100644
--- a/vendor/sabre/dav/tests/Sabre/CardDAV/AddressBookTest.php
+++ b/vendor/sabre/dav/tests/Sabre/CardDAV/AddressBookTest.php
@@ -1,11 +1,13 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CardDAV;
use Sabre\DAV\PropPatch;
-class AddressBookTest extends \PHPUnit_Framework_TestCase {
-
+class AddressBookTest extends \PHPUnit\Framework\TestCase
+{
use \Sabre\DAV\DbTestHelperTrait;
/**
@@ -14,98 +16,88 @@ class AddressBookTest extends \PHPUnit_Framework_TestCase {
protected $ab;
protected $backend;
- function setUp() {
-
+ public function setUp()
+ {
$this->backend = new Backend\Mock();
$this->ab = new AddressBook(
$this->backend,
[
- 'uri' => 'book1',
- 'id' => 'foo',
+ 'uri' => 'book1',
+ 'id' => 'foo',
'{DAV:}displayname' => 'd-name',
- 'principaluri' => 'principals/user1',
+ 'principaluri' => 'principals/user1',
]
);
-
}
- function testGetName() {
-
+ public function testGetName()
+ {
$this->assertEquals('book1', $this->ab->getName());
-
}
- function testGetChild() {
-
+ public function testGetChild()
+ {
$card = $this->ab->getChild('card1');
$this->assertInstanceOf('Sabre\\CardDAV\\Card', $card);
$this->assertEquals('card1', $card->getName());
-
}
/**
- * @expectedException Sabre\DAV\Exception\NotFound
+ * @expectedException \Sabre\DAV\Exception\NotFound
*/
- function testGetChildNotFound() {
-
+ public function testGetChildNotFound()
+ {
$card = $this->ab->getChild('card3');
-
}
- function testGetChildren() {
-
+ public function testGetChildren()
+ {
$cards = $this->ab->getChildren();
$this->assertEquals(2, count($cards));
$this->assertEquals('card1', $cards[0]->getName());
$this->assertEquals('card2', $cards[1]->getName());
-
}
/**
- * @expectedException Sabre\DAV\Exception\MethodNotAllowed
+ * @expectedException \Sabre\DAV\Exception\MethodNotAllowed
*/
- function testCreateDirectory() {
-
+ public function testCreateDirectory()
+ {
$this->ab->createDirectory('name');
-
}
- function testCreateFile() {
-
+ public function testCreateFile()
+ {
$file = fopen('php://memory', 'r+');
fwrite($file, 'foo');
rewind($file);
$this->ab->createFile('card2', $file);
$this->assertEquals('foo', $this->backend->cards['foo']['card2']);
-
}
- function testDelete() {
-
+ public function testDelete()
+ {
$this->ab->delete();
$this->assertEquals(1, count($this->backend->addressBooks));
-
}
/**
- * @expectedException Sabre\DAV\Exception\MethodNotAllowed
+ * @expectedException \Sabre\DAV\Exception\MethodNotAllowed
*/
- function testSetName() {
-
+ public function testSetName()
+ {
$this->ab->setName('foo');
-
}
- function testGetLastModified() {
-
+ public function testGetLastModified()
+ {
$this->assertNull($this->ab->getLastModified());
-
}
- function testUpdateProperties() {
-
+ public function testUpdateProperties()
+ {
$propPatch = new PropPatch([
'{DAV:}displayname' => 'barrr',
]);
@@ -113,20 +105,18 @@ class AddressBookTest extends \PHPUnit_Framework_TestCase {
$this->assertTrue($propPatch->commit());
$this->assertEquals('barrr', $this->backend->addressBooks[0]['{DAV:}displayname']);
-
}
- function testGetProperties() {
-
+ public function testGetProperties()
+ {
$props = $this->ab->getProperties(['{DAV:}displayname']);
$this->assertEquals([
'{DAV:}displayname' => 'd-name',
], $props);
-
}
- function testACLMethods() {
-
+ public function testACLMethods()
+ {
$this->assertEquals('principals/user1', $this->ab->getOwner());
$this->assertNull($this->ab->getGroup());
$this->assertEquals([
@@ -136,39 +126,35 @@ class AddressBookTest extends \PHPUnit_Framework_TestCase {
'protected' => true,
],
], $this->ab->getACL());
-
}
/**
- * @expectedException Sabre\DAV\Exception\Forbidden
+ * @expectedException \Sabre\DAV\Exception\Forbidden
*/
- function testSetACL() {
-
- $this->ab->setACL([]);
-
+ public function testSetACL()
+ {
+ $this->ab->setACL([]);
}
- function testGetSupportedPrivilegeSet() {
-
+ public function testGetSupportedPrivilegeSet()
+ {
$this->assertNull(
$this->ab->getSupportedPrivilegeSet()
);
-
}
- function testGetSyncTokenNoSyncSupport() {
-
+ public function testGetSyncTokenNoSyncSupport()
+ {
$this->assertNull($this->ab->getSyncToken());
-
}
- function testGetChangesNoSyncSupport() {
+ public function testGetChangesNoSyncSupport()
+ {
$this->assertNull($this->ab->getChanges(1, null));
-
}
- function testGetSyncToken() {
-
+ public function testGetSyncToken()
+ {
$this->driver = 'sqlite';
$this->dropTables(['addressbooks', 'cards', 'addressbookchanges']);
$this->createSchema('addressbooks');
@@ -179,8 +165,8 @@ class AddressBookTest extends \PHPUnit_Framework_TestCase {
$this->assertEquals(2, $ab->getSyncToken());
}
- function testGetSyncToken2() {
-
+ public function testGetSyncToken2()
+ {
$this->driver = 'sqlite';
$this->dropTables(['addressbooks', 'cards', 'addressbookchanges']);
$this->createSchema('addressbooks');
@@ -190,5 +176,4 @@ class AddressBookTest extends \PHPUnit_Framework_TestCase {
$ab = new AddressBook($backend, ['id' => 1, '{http://sabredav.org/ns}sync-token' => 2]);
$this->assertEquals(2, $ab->getSyncToken());
}
-
}
diff --git a/vendor/sabre/dav/tests/Sabre/CardDAV/Backend/AbstractPDOTest.php b/vendor/sabre/dav/tests/Sabre/CardDAV/Backend/AbstractPDOTest.php
index f62bfb1ae..e5bd088fc 100644
--- a/vendor/sabre/dav/tests/Sabre/CardDAV/Backend/AbstractPDOTest.php
+++ b/vendor/sabre/dav/tests/Sabre/CardDAV/Backend/AbstractPDOTest.php
@@ -1,12 +1,14 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CardDAV\Backend;
use Sabre\CardDAV;
use Sabre\DAV\PropPatch;
-abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
-
+abstract class AbstractPDOTest extends \PHPUnit\Framework\TestCase
+{
use \Sabre\DAV\DbTestHelperTrait;
/**
@@ -14,8 +16,8 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
*/
protected $backend;
- function setUp() {
-
+ public function setUp()
+ {
$this->dropTables([
'addressbooks',
'cards',
@@ -26,36 +28,34 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
$this->backend = new PDO($pdo);
$pdo->exec("INSERT INTO addressbooks (principaluri, displayname, uri, description, synctoken) VALUES ('principals/user1', 'book1', 'book1', 'addressbook 1', 1)");
- $pdo->exec("INSERT INTO cards (addressbookid, carddata, uri, lastmodified, etag, size) VALUES (1, 'card1', 'card1', 0, '" . md5('card1') . "', 5)");
-
+ $pdo->exec("INSERT INTO cards (addressbookid, carddata, uri, lastmodified, etag, size) VALUES (1, 'card1', 'card1', 0, '".md5('card1')."', 5)");
}
- function testGetAddressBooksForUser() {
-
+ public function testGetAddressBooksForUser()
+ {
$result = $this->backend->getAddressBooksForUser('principals/user1');
$expected = [
[
- 'id' => 1,
- 'uri' => 'book1',
- 'principaluri' => 'principals/user1',
- '{DAV:}displayname' => 'book1',
- '{' . CardDAV\Plugin::NS_CARDDAV . '}addressbook-description' => 'addressbook 1',
- '{http://calendarserver.org/ns/}getctag' => 1,
- '{http://sabredav.org/ns}sync-token' => 1
- ]
+ 'id' => 1,
+ 'uri' => 'book1',
+ 'principaluri' => 'principals/user1',
+ '{DAV:}displayname' => 'book1',
+ '{'.CardDAV\Plugin::NS_CARDDAV.'}addressbook-description' => 'addressbook 1',
+ '{http://calendarserver.org/ns/}getctag' => 1,
+ '{http://sabredav.org/ns}sync-token' => 1,
+ ],
];
$this->assertEquals($expected, $result);
-
}
- function testUpdateAddressBookInvalidProp() {
-
+ public function testUpdateAddressBookInvalidProp()
+ {
$propPatch = new PropPatch([
- '{DAV:}displayname' => 'updated',
- '{' . CardDAV\Plugin::NS_CARDDAV . '}addressbook-description' => 'updated',
- '{DAV:}foo' => 'bar',
+ '{DAV:}displayname' => 'updated',
+ '{'.CardDAV\Plugin::NS_CARDDAV.'}addressbook-description' => 'updated',
+ '{DAV:}foo' => 'bar',
]);
$this->backend->updateAddressBook(1, $propPatch);
@@ -67,22 +67,21 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
$expected = [
[
- 'id' => 1,
- 'uri' => 'book1',
- 'principaluri' => 'principals/user1',
- '{DAV:}displayname' => 'book1',
- '{' . CardDAV\Plugin::NS_CARDDAV . '}addressbook-description' => 'addressbook 1',
- '{http://calendarserver.org/ns/}getctag' => 1,
- '{http://sabredav.org/ns}sync-token' => 1
- ]
+ 'id' => 1,
+ 'uri' => 'book1',
+ 'principaluri' => 'principals/user1',
+ '{DAV:}displayname' => 'book1',
+ '{'.CardDAV\Plugin::NS_CARDDAV.'}addressbook-description' => 'addressbook 1',
+ '{http://calendarserver.org/ns/}getctag' => 1,
+ '{http://sabredav.org/ns}sync-token' => 1,
+ ],
];
$this->assertEquals($expected, $result);
-
}
- function testUpdateAddressBookNoProps() {
-
+ public function testUpdateAddressBookNoProps()
+ {
$propPatch = new PropPatch([
]);
@@ -94,26 +93,24 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
$expected = [
[
- 'id' => 1,
- 'uri' => 'book1',
- 'principaluri' => 'principals/user1',
- '{DAV:}displayname' => 'book1',
- '{' . CardDAV\Plugin::NS_CARDDAV . '}addressbook-description' => 'addressbook 1',
- '{http://calendarserver.org/ns/}getctag' => 1,
- '{http://sabredav.org/ns}sync-token' => 1
- ]
+ 'id' => 1,
+ 'uri' => 'book1',
+ 'principaluri' => 'principals/user1',
+ '{DAV:}displayname' => 'book1',
+ '{'.CardDAV\Plugin::NS_CARDDAV.'}addressbook-description' => 'addressbook 1',
+ '{http://calendarserver.org/ns/}getctag' => 1,
+ '{http://sabredav.org/ns}sync-token' => 1,
+ ],
];
$this->assertEquals($expected, $result);
-
-
}
- function testUpdateAddressBookSuccess() {
-
+ public function testUpdateAddressBookSuccess()
+ {
$propPatch = new PropPatch([
- '{DAV:}displayname' => 'updated',
- '{' . CardDAV\Plugin::NS_CARDDAV . '}addressbook-description' => 'updated',
+ '{DAV:}displayname' => 'updated',
+ '{'.CardDAV\Plugin::NS_CARDDAV.'}addressbook-description' => 'updated',
]);
$this->backend->updateAddressBook(1, $propPatch);
@@ -125,101 +122,95 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
$expected = [
[
- 'id' => 1,
- 'uri' => 'book1',
- 'principaluri' => 'principals/user1',
- '{DAV:}displayname' => 'updated',
- '{' . CardDAV\Plugin::NS_CARDDAV . '}addressbook-description' => 'updated',
- '{http://calendarserver.org/ns/}getctag' => 2,
- '{http://sabredav.org/ns}sync-token' => 2
- ]
+ 'id' => 1,
+ 'uri' => 'book1',
+ 'principaluri' => 'principals/user1',
+ '{DAV:}displayname' => 'updated',
+ '{'.CardDAV\Plugin::NS_CARDDAV.'}addressbook-description' => 'updated',
+ '{http://calendarserver.org/ns/}getctag' => 2,
+ '{http://sabredav.org/ns}sync-token' => 2,
+ ],
];
$this->assertEquals($expected, $result);
-
-
}
- function testDeleteAddressBook() {
-
+ public function testDeleteAddressBook()
+ {
$this->backend->deleteAddressBook(1);
$this->assertEquals([], $this->backend->getAddressBooksForUser('principals/user1'));
-
}
/**
- * @expectedException Sabre\DAV\Exception\BadRequest
+ * @expectedException \Sabre\DAV\Exception\BadRequest
*/
- function testCreateAddressBookUnsupportedProp() {
-
+ public function testCreateAddressBookUnsupportedProp()
+ {
$this->backend->createAddressBook('principals/user1', 'book2', [
'{DAV:}foo' => 'bar',
]);
-
}
- function testCreateAddressBookSuccess() {
-
+ public function testCreateAddressBookSuccess()
+ {
$this->backend->createAddressBook('principals/user1', 'book2', [
- '{DAV:}displayname' => 'book2',
- '{' . CardDAV\Plugin::NS_CARDDAV . '}addressbook-description' => 'addressbook 2',
+ '{DAV:}displayname' => 'book2',
+ '{'.CardDAV\Plugin::NS_CARDDAV.'}addressbook-description' => 'addressbook 2',
]);
$expected = [
[
- 'id' => 1,
- 'uri' => 'book1',
- 'principaluri' => 'principals/user1',
- '{DAV:}displayname' => 'book1',
- '{' . CardDAV\Plugin::NS_CARDDAV . '}addressbook-description' => 'addressbook 1',
- '{http://calendarserver.org/ns/}getctag' => 1,
- '{http://sabredav.org/ns}sync-token' => 1,
+ 'id' => 1,
+ 'uri' => 'book1',
+ 'principaluri' => 'principals/user1',
+ '{DAV:}displayname' => 'book1',
+ '{'.CardDAV\Plugin::NS_CARDDAV.'}addressbook-description' => 'addressbook 1',
+ '{http://calendarserver.org/ns/}getctag' => 1,
+ '{http://sabredav.org/ns}sync-token' => 1,
],
[
- 'id' => 2,
- 'uri' => 'book2',
- 'principaluri' => 'principals/user1',
- '{DAV:}displayname' => 'book2',
- '{' . CardDAV\Plugin::NS_CARDDAV . '}addressbook-description' => 'addressbook 2',
- '{http://calendarserver.org/ns/}getctag' => 1,
- '{http://sabredav.org/ns}sync-token' => 1,
- ]
+ 'id' => 2,
+ 'uri' => 'book2',
+ 'principaluri' => 'principals/user1',
+ '{DAV:}displayname' => 'book2',
+ '{'.CardDAV\Plugin::NS_CARDDAV.'}addressbook-description' => 'addressbook 2',
+ '{http://calendarserver.org/ns/}getctag' => 1,
+ '{http://sabredav.org/ns}sync-token' => 1,
+ ],
];
$result = $this->backend->getAddressBooksForUser('principals/user1');
$this->assertEquals($expected, $result);
-
}
- function testGetCards() {
-
+ public function testGetCards()
+ {
$result = $this->backend->getCards(1);
$expected = [
[
- 'id' => 1,
- 'uri' => 'card1',
+ 'id' => 1,
+ 'uri' => 'card1',
'lastmodified' => 0,
- 'etag' => '"' . md5('card1') . '"',
- 'size' => 5
- ]
+ 'etag' => '"'.md5('card1').'"',
+ 'size' => 5,
+ ],
];
$this->assertEquals($expected, $result);
-
}
- function testGetCard() {
-
+ public function testGetCard()
+ {
$result = $this->backend->getCard(1, 'card1');
$expected = [
- 'id' => 1,
- 'uri' => 'card1',
- 'carddata' => 'card1',
+ 'id' => 1,
+ 'uri' => 'card1',
+ 'carddata' => 'card1',
'lastmodified' => 0,
- 'etag' => '"' . md5('card1') . '"',
- 'size' => 5
+ 'etag' => '"'.md5('card1').'"',
+ 'size' => 5,
];
if (is_resource($result['carddata'])) {
@@ -227,16 +218,15 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
}
$this->assertEquals($expected, $result);
-
}
/**
* @depends testGetCard
*/
- function testCreateCard() {
-
+ public function testCreateCard()
+ {
$result = $this->backend->createCard(1, 'card2', 'data2');
- $this->assertEquals('"' . md5('data2') . '"', $result);
+ $this->assertEquals('"'.md5('data2').'"', $result);
$result = $this->backend->getCard(1, 'card2');
$this->assertEquals(2, $result['id']);
$this->assertEquals('card2', $result['uri']);
@@ -244,33 +234,32 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
$result['carddata'] = stream_get_contents($result['carddata']);
}
$this->assertEquals('data2', $result['carddata']);
-
}
/**
* @depends testCreateCard
*/
- function testGetMultiple() {
-
+ public function testGetMultiple()
+ {
$result = $this->backend->createCard(1, 'card2', 'data2');
$result = $this->backend->createCard(1, 'card3', 'data3');
$check = [
[
- 'id' => 1,
- 'uri' => 'card1',
- 'carddata' => 'card1',
+ 'id' => 1,
+ 'uri' => 'card1',
+ 'carddata' => 'card1',
'lastmodified' => 0,
],
[
- 'id' => 2,
- 'uri' => 'card2',
- 'carddata' => 'data2',
+ 'id' => 2,
+ 'uri' => 'card2',
+ 'carddata' => 'data2',
'lastmodified' => time(),
],
[
- 'id' => 3,
- 'uri' => 'card3',
- 'carddata' => 'data3',
+ 'id' => 3,
+ 'uri' => 'card3',
+ 'carddata' => 'data3',
'lastmodified' => time(),
],
];
@@ -278,40 +267,34 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
$result = $this->backend->getMultipleCards(1, ['card1', 'card2', 'card3']);
foreach ($check as $index => $node) {
-
foreach ($node as $k => $v) {
-
$expected = $v;
$actual = $result[$index][$k];
switch ($k) {
- case 'lastmodified' :
+ case 'lastmodified':
$this->assertInternalType('int', $actual);
break;
- case 'carddata' :
+ case 'carddata':
if (is_resource($actual)) {
$actual = stream_get_contents($actual);
}
- // No break intended.
- default :
+ // no break intended.
+ default:
$this->assertEquals($expected, $actual);
break;
}
-
}
-
}
-
-
}
/**
* @depends testGetCard
*/
- function testUpdateCard() {
-
+ public function testUpdateCard()
+ {
$result = $this->backend->updateCard(1, 'card1', 'newdata');
- $this->assertEquals('"' . md5('newdata') . '"', $result);
+ $this->assertEquals('"'.md5('newdata').'"', $result);
$result = $this->backend->getCard(1, 'card1');
$this->assertEquals(1, $result['id']);
@@ -319,22 +302,20 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
$result['carddata'] = stream_get_contents($result['carddata']);
}
$this->assertEquals('newdata', $result['carddata']);
-
}
/**
* @depends testGetCard
*/
- function testDeleteCard() {
-
+ public function testDeleteCard()
+ {
$this->backend->deleteCard(1, 'card1');
$result = $this->backend->getCard(1, 'card1');
$this->assertFalse($result);
-
}
- function testGetChanges() {
-
+ public function testGetChanges()
+ {
$backend = $this->backend;
$id = $backend->createAddressBook(
'principals/user1',
@@ -345,29 +326,28 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
$this->assertEquals([
'syncToken' => 1,
- "added" => [],
- 'modified' => [],
- 'deleted' => [],
+ 'added' => [],
+ 'modified' => [],
+ 'deleted' => [],
], $result);
$currentToken = $result['syncToken'];
$dummyCard = "BEGIN:VCARD\r\nEND:VCARD\r\n";
- $backend->createCard($id, "card1.ics", $dummyCard);
- $backend->createCard($id, "card2.ics", $dummyCard);
- $backend->createCard($id, "card3.ics", $dummyCard);
- $backend->updateCard($id, "card1.ics", $dummyCard);
- $backend->deleteCard($id, "card2.ics");
+ $backend->createCard($id, 'card1.ics', $dummyCard);
+ $backend->createCard($id, 'card2.ics', $dummyCard);
+ $backend->createCard($id, 'card3.ics', $dummyCard);
+ $backend->updateCard($id, 'card1.ics', $dummyCard);
+ $backend->deleteCard($id, 'card2.ics');
$result = $backend->getChangesForAddressBook($id, $currentToken, 1);
$this->assertEquals([
'syncToken' => 6,
- 'modified' => ["card1.ics"],
- 'deleted' => ["card2.ics"],
- "added" => ["card3.ics"],
+ 'modified' => ['card1.ics'],
+ 'deleted' => ['card2.ics'],
+ 'added' => ['card3.ics'],
], $result);
-
}
}
diff --git a/vendor/sabre/dav/tests/Sabre/CardDAV/Backend/Mock.php b/vendor/sabre/dav/tests/Sabre/CardDAV/Backend/Mock.php
index 8638dc74a..f7e20fbfb 100644
--- a/vendor/sabre/dav/tests/Sabre/CardDAV/Backend/Mock.php
+++ b/vendor/sabre/dav/tests/Sabre/CardDAV/Backend/Mock.php
@@ -1,29 +1,31 @@
<?php
-namespace Sabre\CardDAV\Backend;
+declare(strict_types=1);
-class Mock extends AbstractBackend {
+namespace Sabre\CardDAV\Backend;
+class Mock extends AbstractBackend
+{
public $addressBooks;
public $cards;
- function __construct($addressBooks = null, $cards = null) {
-
+ public function __construct($addressBooks = null, $cards = null)
+ {
$this->addressBooks = $addressBooks;
$this->cards = $cards;
if (is_null($this->addressBooks)) {
$this->addressBooks = [
[
- 'id' => 'foo',
- 'uri' => 'book1',
- 'principaluri' => 'principals/user1',
+ 'id' => 'foo',
+ 'uri' => 'book1',
+ 'principaluri' => 'principals/user1',
'{DAV:}displayname' => 'd-name',
],
[
- 'id' => 'bar',
- 'uri' => 'book3',
- 'principaluri' => 'principals/user1',
+ 'id' => 'bar',
+ 'uri' => 'book3',
+ 'principaluri' => 'principals/user1',
'{DAV:}displayname' => 'd-name',
],
];
@@ -41,20 +43,18 @@ class Mock extends AbstractBackend {
],
];
}
-
}
-
- function getAddressBooksForUser($principalUri) {
-
+ public function getAddressBooksForUser($principalUri)
+ {
$books = [];
foreach ($this->addressBooks as $book) {
if ($book['principaluri'] === $principalUri) {
$books[] = $book;
}
}
- return $books;
+ return $books;
}
/**
@@ -69,45 +69,43 @@ class Mock extends AbstractBackend {
*
* Read the PropPatch documentation for more info and examples.
*
- * @param string $addressBookId
+ * @param string $addressBookId
* @param \Sabre\DAV\PropPatch $propPatch
- * @return void
*/
- function updateAddressBook($addressBookId, \Sabre\DAV\PropPatch $propPatch) {
-
+ public function updateAddressBook($addressBookId, \Sabre\DAV\PropPatch $propPatch)
+ {
foreach ($this->addressBooks as &$book) {
- if ($book['id'] !== $addressBookId)
+ if ($book['id'] !== $addressBookId) {
continue;
+ }
- $propPatch->handleRemaining(function($mutations) use (&$book) {
+ $propPatch->handleRemaining(function ($mutations) use (&$book) {
foreach ($mutations as $key => $value) {
$book[$key] = $value;
}
+
return true;
});
-
}
-
}
- function createAddressBook($principalUri, $url, array $properties) {
-
+ public function createAddressBook($principalUri, $url, array $properties)
+ {
$this->addressBooks[] = array_merge($properties, [
- 'id' => $url,
- 'uri' => $url,
+ 'id' => $url,
+ 'uri' => $url,
'principaluri' => $principalUri,
]);
-
}
- function deleteAddressBook($addressBookId) {
-
+ public function deleteAddressBook($addressBookId)
+ {
foreach ($this->addressBooks as $key => $value) {
- if ($value['id'] === $addressBookId)
+ if ($value['id'] === $addressBookId) {
unset($this->addressBooks[$key]);
+ }
}
unset($this->cards[$addressBookId]);
-
}
/**
@@ -127,28 +125,29 @@ class Mock extends AbstractBackend {
* This may speed up certain requests, especially with large cards.
*
* @param mixed $addressBookId
+ *
* @return array
*/
- function getCards($addressBookId) {
-
+ public function getCards($addressBookId)
+ {
$cards = [];
foreach ($this->cards[$addressBookId] as $uri => $data) {
if (is_resource($data)) {
$cards[] = [
- 'uri' => $uri,
+ 'uri' => $uri,
'carddata' => $data,
];
} else {
$cards[] = [
- 'uri' => $uri,
+ 'uri' => $uri,
'carddata' => $data,
- 'etag' => '"' . md5($data) . '"',
- 'size' => strlen($data)
+ 'etag' => '"'.md5($data).'"',
+ 'size' => strlen($data),
];
}
}
- return $cards;
+ return $cards;
}
/**
@@ -159,24 +158,25 @@ class Mock extends AbstractBackend {
*
* If the card does not exist, you must return false.
*
- * @param mixed $addressBookId
+ * @param mixed $addressBookId
* @param string $cardUri
+ *
* @return array
*/
- function getCard($addressBookId, $cardUri) {
-
+ public function getCard($addressBookId, $cardUri)
+ {
if (!isset($this->cards[$addressBookId][$cardUri])) {
return false;
}
$data = $this->cards[$addressBookId][$cardUri];
+
return [
- 'uri' => $cardUri,
+ 'uri' => $cardUri,
'carddata' => $data,
- 'etag' => '"' . md5($data) . '"',
- 'size' => strlen($data)
+ 'etag' => '"'.md5($data).'"',
+ 'size' => strlen($data),
];
-
}
/**
@@ -199,19 +199,20 @@ class Mock extends AbstractBackend {
*
* If you don't return an ETag, you can just return null.
*
- * @param mixed $addressBookId
+ * @param mixed $addressBookId
* @param string $cardUri
* @param string $cardData
+ *
* @return string|null
*/
- function createCard($addressBookId, $cardUri, $cardData) {
-
+ public function createCard($addressBookId, $cardUri, $cardData)
+ {
if (is_resource($cardData)) {
$cardData = stream_get_contents($cardData);
}
$this->cards[$addressBookId][$cardUri] = $cardData;
- return '"' . md5($cardData) . '"';
+ return '"'.md5($cardData).'"';
}
/**
@@ -234,25 +235,24 @@ class Mock extends AbstractBackend {
*
* If you don't return an ETag, you can just return null.
*
- * @param mixed $addressBookId
+ * @param mixed $addressBookId
* @param string $cardUri
* @param string $cardData
+ *
* @return string|null
*/
- function updateCard($addressBookId, $cardUri, $cardData) {
-
+ public function updateCard($addressBookId, $cardUri, $cardData)
+ {
if (is_resource($cardData)) {
$cardData = stream_get_contents($cardData);
}
$this->cards[$addressBookId][$cardUri] = $cardData;
- return '"' . md5($cardData) . '"';
+ return '"'.md5($cardData).'"';
}
- function deleteCard($addressBookId, $cardUri) {
-
+ public function deleteCard($addressBookId, $cardUri)
+ {
unset($this->cards[$addressBookId][$cardUri]);
-
}
-
}
diff --git a/vendor/sabre/dav/tests/Sabre/CardDAV/Backend/PDOMySQLTest.php b/vendor/sabre/dav/tests/Sabre/CardDAV/Backend/PDOMySQLTest.php
index c1b0e274e..718eec6be 100644
--- a/vendor/sabre/dav/tests/Sabre/CardDAV/Backend/PDOMySQLTest.php
+++ b/vendor/sabre/dav/tests/Sabre/CardDAV/Backend/PDOMySQLTest.php
@@ -1,9 +1,10 @@
<?php
-namespace Sabre\CardDAV\Backend;
+declare(strict_types=1);
-class PDOMySQLTest extends AbstractPDOTest {
+namespace Sabre\CardDAV\Backend;
+class PDOMySQLTest extends AbstractPDOTest
+{
public $driver = 'mysql';
-
}
diff --git a/vendor/sabre/dav/tests/Sabre/CardDAV/Backend/PDOSqliteTest.php b/vendor/sabre/dav/tests/Sabre/CardDAV/Backend/PDOSqliteTest.php
index b187c4d78..b16a00ce2 100644
--- a/vendor/sabre/dav/tests/Sabre/CardDAV/Backend/PDOSqliteTest.php
+++ b/vendor/sabre/dav/tests/Sabre/CardDAV/Backend/PDOSqliteTest.php
@@ -1,9 +1,10 @@
<?php
-namespace Sabre\CardDAV\Backend;
+declare(strict_types=1);
-class PDOSqliteTest extends AbstractPDOTest {
+namespace Sabre\CardDAV\Backend;
+class PDOSqliteTest extends AbstractPDOTest
+{
public $driver = 'sqlite';
-
}
diff --git a/vendor/sabre/dav/tests/Sabre/CardDAV/CardTest.php b/vendor/sabre/dav/tests/Sabre/CardDAV/CardTest.php
index cb7d152c3..41853aa63 100644
--- a/vendor/sabre/dav/tests/Sabre/CardDAV/CardTest.php
+++ b/vendor/sabre/dav/tests/Sabre/CardDAV/CardTest.php
@@ -1,9 +1,11 @@
<?php
-namespace Sabre\CardDAV;
+declare(strict_types=1);
-class CardTest extends \PHPUnit_Framework_TestCase {
+namespace Sabre\CardDAV;
+class CardTest extends \PHPUnit\Framework\TestCase
+{
/**
* @var Sabre\CardDAV\Card
*/
@@ -13,140 +15,128 @@ class CardTest extends \PHPUnit_Framework_TestCase {
*/
protected $backend;
- function setUp() {
-
+ public function setUp()
+ {
$this->backend = new Backend\Mock();
$this->card = new Card(
$this->backend,
[
- 'uri' => 'book1',
- 'id' => 'foo',
+ 'uri' => 'book1',
+ 'id' => 'foo',
'principaluri' => 'principals/user1',
],
[
- 'uri' => 'card1',
+ 'uri' => 'card1',
'addressbookid' => 'foo',
- 'carddata' => 'card',
+ 'carddata' => 'card',
]
);
-
}
- function testGet() {
-
+ public function testGet()
+ {
$result = $this->card->get();
$this->assertEquals('card', $result);
-
}
- function testGet2() {
+ public function testGet2()
+ {
$this->card = new Card(
$this->backend,
[
- 'uri' => 'book1',
- 'id' => 'foo',
+ 'uri' => 'book1',
+ 'id' => 'foo',
'principaluri' => 'principals/user1',
],
[
- 'uri' => 'card1',
+ 'uri' => 'card1',
'addressbookid' => 'foo',
]
);
$result = $this->card->get();
$this->assertEquals("BEGIN:VCARD\nVERSION:3.0\nUID:12345\nEND:VCARD", $result);
-
}
-
/**
* @depends testGet
*/
- function testPut() {
-
+ public function testPut()
+ {
$file = fopen('php://memory', 'r+');
fwrite($file, 'newdata');
rewind($file);
$this->card->put($file);
$result = $this->card->get();
$this->assertEquals('newdata', $result);
-
}
-
- function testDelete() {
-
+ public function testDelete()
+ {
$this->card->delete();
$this->assertEquals(1, count($this->backend->cards['foo']));
-
}
- function testGetContentType() {
-
+ public function testGetContentType()
+ {
$this->assertEquals('text/vcard; charset=utf-8', $this->card->getContentType());
-
}
- function testGetETag() {
-
- $this->assertEquals('"' . md5('card') . '"', $this->card->getETag());
-
+ public function testGetETag()
+ {
+ $this->assertEquals('"'.md5('card').'"', $this->card->getETag());
}
- function testGetETag2() {
-
+ public function testGetETag2()
+ {
$card = new Card(
$this->backend,
[
- 'uri' => 'book1',
- 'id' => 'foo',
+ 'uri' => 'book1',
+ 'id' => 'foo',
'principaluri' => 'principals/user1',
],
[
- 'uri' => 'card1',
+ 'uri' => 'card1',
'addressbookid' => 'foo',
- 'carddata' => 'card',
- 'etag' => '"blabla"',
+ 'carddata' => 'card',
+ 'etag' => '"blabla"',
]
);
$this->assertEquals('"blabla"', $card->getETag());
-
}
- function testGetLastModified() {
-
+ public function testGetLastModified()
+ {
$this->assertEquals(null, $this->card->getLastModified());
-
}
- function testGetSize() {
-
+ public function testGetSize()
+ {
$this->assertEquals(4, $this->card->getSize());
$this->assertEquals(4, $this->card->getSize());
-
}
- function testGetSize2() {
-
+ public function testGetSize2()
+ {
$card = new Card(
$this->backend,
[
- 'uri' => 'book1',
- 'id' => 'foo',
+ 'uri' => 'book1',
+ 'id' => 'foo',
'principaluri' => 'principals/user1',
],
[
- 'uri' => 'card1',
+ 'uri' => 'card1',
'addressbookid' => 'foo',
- 'etag' => '"blabla"',
- 'size' => 4,
+ 'etag' => '"blabla"',
+ 'size' => 4,
]
);
$this->assertEquals(4, $card->getSize());
-
}
- function testACLMethods() {
-
+ public function testACLMethods()
+ {
$this->assertEquals('principals/user1', $this->card->getOwner());
$this->assertNull($this->card->getGroup());
$this->assertEquals([
@@ -156,22 +146,22 @@ class CardTest extends \PHPUnit_Framework_TestCase {
'protected' => true,
],
], $this->card->getACL());
-
}
- function testOverrideACL() {
+ public function testOverrideACL()
+ {
$card = new Card(
$this->backend,
[
- 'uri' => 'book1',
- 'id' => 'foo',
+ 'uri' => 'book1',
+ 'id' => 'foo',
'principaluri' => 'principals/user1',
],
[
- 'uri' => 'card1',
+ 'uri' => 'card1',
'addressbookid' => 'foo',
- 'carddata' => 'card',
- 'acl' => [
+ 'carddata' => 'card',
+ 'acl' => [
[
'privilege' => '{DAV:}read',
'principal' => 'principals/user1',
@@ -187,24 +177,20 @@ class CardTest extends \PHPUnit_Framework_TestCase {
'protected' => true,
],
], $card->getACL());
-
}
/**
- * @expectedException Sabre\DAV\Exception\Forbidden
+ * @expectedException \Sabre\DAV\Exception\Forbidden
*/
- function testSetACL() {
-
- $this->card->setACL([]);
-
+ public function testSetACL()
+ {
+ $this->card->setACL([]);
}
- function testGetSupportedPrivilegeSet() {
-
+ public function testGetSupportedPrivilegeSet()
+ {
$this->assertNull(
$this->card->getSupportedPrivilegeSet()
);
-
}
-
}
diff --git a/vendor/sabre/dav/tests/Sabre/CardDAV/IDirectoryTest.php b/vendor/sabre/dav/tests/Sabre/CardDAV/IDirectoryTest.php
index 4796a131f..760749f6c 100644
--- a/vendor/sabre/dav/tests/Sabre/CardDAV/IDirectoryTest.php
+++ b/vendor/sabre/dav/tests/Sabre/CardDAV/IDirectoryTest.php
@@ -1,15 +1,17 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CardDAV;
use Sabre\DAV;
-class IDirectoryTest extends \PHPUnit_Framework_TestCase {
-
- function testResourceType() {
-
+class IDirectoryTest extends \PHPUnit\Framework\TestCase
+{
+ public function testResourceType()
+ {
$tree = [
- new DirectoryMock('directory')
+ new DirectoryMock('directory'),
];
$server = new DAV\Server($tree);
@@ -17,14 +19,10 @@ class IDirectoryTest extends \PHPUnit_Framework_TestCase {
$server->addPlugin($plugin);
$props = $server->getProperties('directory', ['{DAV:}resourcetype']);
- $this->assertTrue($props['{DAV:}resourcetype']->is('{' . Plugin::NS_CARDDAV . '}directory'));
-
+ $this->assertTrue($props['{DAV:}resourcetype']->is('{'.Plugin::NS_CARDDAV.'}directory'));
}
-
}
-class DirectoryMock extends DAV\SimpleCollection implements IDirectory {
-
-
-
+class DirectoryMock extends DAV\SimpleCollection implements IDirectory
+{
}
diff --git a/vendor/sabre/dav/tests/Sabre/CardDAV/MultiGetTest.php b/vendor/sabre/dav/tests/Sabre/CardDAV/MultiGetTest.php
index 2d57c6ae7..4e3276ed3 100644
--- a/vendor/sabre/dav/tests/Sabre/CardDAV/MultiGetTest.php
+++ b/vendor/sabre/dav/tests/Sabre/CardDAV/MultiGetTest.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CardDAV;
use Sabre\DAV;
@@ -7,13 +9,13 @@ use Sabre\HTTP;
require_once 'Sabre/HTTP/ResponseMock.php';
-class MultiGetTest extends AbstractPluginTest {
-
- function testMultiGet() {
-
+class MultiGetTest extends AbstractPluginTest
+{
+ public function testMultiGet()
+ {
$request = HTTP\Sapi::createFromServerArray([
'REQUEST_METHOD' => 'REPORT',
- 'REQUEST_URI' => '/addressbooks/user1/book1',
+ 'REQUEST_URI' => '/addressbooks/user1/book1',
]);
$request->setBody(
@@ -34,7 +36,7 @@ class MultiGetTest extends AbstractPluginTest {
$this->server->exec();
- $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:' . $response->body);
+ $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:'.$response->body);
// using the client for parsing
$client = new DAV\Client(['baseUri' => '/']);
@@ -44,19 +46,18 @@ class MultiGetTest extends AbstractPluginTest {
$this->assertEquals([
'/addressbooks/user1/book1/card1' => [
200 => [
- '{DAV:}getetag' => '"' . md5("BEGIN:VCARD\nVERSION:3.0\nUID:12345\nEND:VCARD") . '"',
+ '{DAV:}getetag' => '"'.md5("BEGIN:VCARD\nVERSION:3.0\nUID:12345\nEND:VCARD").'"',
'{urn:ietf:params:xml:ns:carddav}address-data' => "BEGIN:VCARD\nVERSION:3.0\nUID:12345\nEND:VCARD",
- ]
- ]
+ ],
+ ],
], $result);
-
}
- function testMultiGetVCard4() {
-
+ public function testMultiGetVCard4()
+ {
$request = HTTP\Sapi::createFromServerArray([
'REQUEST_METHOD' => 'REPORT',
- 'REQUEST_URI' => '/addressbooks/user1/book1',
+ 'REQUEST_URI' => '/addressbooks/user1/book1',
]);
$request->setBody(
@@ -77,23 +78,22 @@ class MultiGetTest extends AbstractPluginTest {
$this->server->exec();
- $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:' . $response->body);
+ $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:'.$response->body);
// using the client for parsing
$client = new DAV\Client(['baseUri' => '/']);
$result = $client->parseMultiStatus($response->body);
- $prodId = "PRODID:-//Sabre//Sabre VObject " . \Sabre\VObject\Version::VERSION . "//EN";
+ $prodId = 'PRODID:-//Sabre//Sabre VObject '.\Sabre\VObject\Version::VERSION.'//EN';
$this->assertEquals([
'/addressbooks/user1/book1/card1' => [
200 => [
- '{DAV:}getetag' => '"' . md5("BEGIN:VCARD\nVERSION:3.0\nUID:12345\nEND:VCARD") . '"',
+ '{DAV:}getetag' => '"'.md5("BEGIN:VCARD\nVERSION:3.0\nUID:12345\nEND:VCARD").'"',
'{urn:ietf:params:xml:ns:carddav}address-data' => "BEGIN:VCARD\r\nVERSION:4.0\r\n$prodId\r\nUID:12345\r\nEND:VCARD\r\n",
- ]
- ]
+ ],
+ ],
], $result);
-
}
}
diff --git a/vendor/sabre/dav/tests/Sabre/CardDAV/PluginTest.php b/vendor/sabre/dav/tests/Sabre/CardDAV/PluginTest.php
index 6962e7830..b5a68dc48 100644
--- a/vendor/sabre/dav/tests/Sabre/CardDAV/PluginTest.php
+++ b/vendor/sabre/dav/tests/Sabre/CardDAV/PluginTest.php
@@ -1,102 +1,101 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CardDAV;
use Sabre\DAV;
-class PluginTest extends AbstractPluginTest {
-
- function testConstruct() {
-
- $this->assertEquals('{' . Plugin::NS_CARDDAV . '}addressbook', $this->server->resourceTypeMapping['Sabre\\CardDAV\\IAddressBook']);
+class PluginTest extends AbstractPluginTest
+{
+ public function testConstruct()
+ {
+ $this->assertEquals('{'.Plugin::NS_CARDDAV.'}addressbook', $this->server->resourceTypeMapping['Sabre\\CardDAV\\IAddressBook']);
$this->assertTrue(in_array('addressbook', $this->plugin->getFeatures()));
$this->assertEquals('carddav', $this->plugin->getPluginInfo()['name']);
-
}
- function testSupportedReportSet() {
-
+ public function testSupportedReportSet()
+ {
$this->assertEquals([
- '{' . Plugin::NS_CARDDAV . '}addressbook-multiget',
- '{' . Plugin::NS_CARDDAV . '}addressbook-query',
+ '{'.Plugin::NS_CARDDAV.'}addressbook-multiget',
+ '{'.Plugin::NS_CARDDAV.'}addressbook-query',
], $this->plugin->getSupportedReportSet('addressbooks/user1/book1'));
-
}
- function testSupportedReportSetEmpty() {
-
+ public function testSupportedReportSetEmpty()
+ {
$this->assertEquals([
], $this->plugin->getSupportedReportSet(''));
-
}
- function testAddressBookHomeSet() {
-
- $result = $this->server->getProperties('principals/user1', ['{' . Plugin::NS_CARDDAV . '}addressbook-home-set']);
+ public function testAddressBookHomeSet()
+ {
+ $result = $this->server->getProperties('principals/user1', ['{'.Plugin::NS_CARDDAV.'}addressbook-home-set']);
$this->assertEquals(1, count($result));
- $this->assertTrue(isset($result['{' . Plugin::NS_CARDDAV . '}addressbook-home-set']));
- $this->assertEquals('addressbooks/user1/', $result['{' . Plugin::NS_CARDDAV . '}addressbook-home-set']->getHref());
-
+ $this->assertTrue(isset($result['{'.Plugin::NS_CARDDAV.'}addressbook-home-set']));
+ $this->assertEquals('addressbooks/user1/', $result['{'.Plugin::NS_CARDDAV.'}addressbook-home-set']->getHref());
}
- function testDirectoryGateway() {
-
- $result = $this->server->getProperties('principals/user1', ['{' . Plugin::NS_CARDDAV . '}directory-gateway']);
+ public function testDirectoryGateway()
+ {
+ $result = $this->server->getProperties('principals/user1', ['{'.Plugin::NS_CARDDAV.'}directory-gateway']);
$this->assertEquals(1, count($result));
- $this->assertTrue(isset($result['{' . Plugin::NS_CARDDAV . '}directory-gateway']));
- $this->assertEquals(['directory'], $result['{' . Plugin::NS_CARDDAV . '}directory-gateway']->getHrefs());
-
+ $this->assertTrue(isset($result['{'.Plugin::NS_CARDDAV.'}directory-gateway']));
+ $this->assertEquals(['directory'], $result['{'.Plugin::NS_CARDDAV.'}directory-gateway']->getHrefs());
}
- function testReportPassThrough() {
-
+ public function testReportPassThrough()
+ {
$this->assertNull($this->plugin->report('{DAV:}foo', new \DomDocument(), ''));
-
}
- function testHTMLActionsPanel() {
-
+ public function testHTMLActionsPanel()
+ {
$output = '';
$r = $this->server->emit('onHTMLActionsPanel', [$this->server->tree->getNodeForPath('addressbooks/user1'), &$output]);
$this->assertFalse($r);
- $this->assertTrue(!!strpos($output, 'Display name'));
-
+ $this->assertTrue((bool) strpos($output, 'Display name'));
}
- function testAddressbookPluginProperties() {
-
- $ns = '{' . Plugin::NS_CARDDAV . '}';
+ public function testAddressbookPluginProperties()
+ {
+ $ns = '{'.Plugin::NS_CARDDAV.'}';
$propFind = new DAV\PropFind('addressbooks/user1/book1', [
- $ns . 'supported-address-data',
- $ns . 'supported-collation-set',
+ $ns.'supported-address-data',
+ $ns.'supported-collation-set',
]);
$node = $this->server->tree->getNodeForPath('addressbooks/user1/book1');
$this->plugin->propFindEarly($propFind, $node);
$this->assertInstanceOf(
'Sabre\\CardDAV\\Xml\\Property\\SupportedAddressData',
- $propFind->get($ns . 'supported-address-data')
+ $propFind->get($ns.'supported-address-data')
);
$this->assertInstanceOf(
'Sabre\\CardDAV\\Xml\\Property\\SupportedCollationSet',
- $propFind->get($ns . 'supported-collation-set')
+ $propFind->get($ns.'supported-collation-set')
);
-
-
}
- function testGetTransform() {
-
- $request = new \Sabre\HTTP\Request('GET', '/addressbooks/user1/book1/card1', ['Accept: application/vcard+json']);
+ public function testGetTransform()
+ {
+ $request = new \Sabre\HTTP\Request('GET', '/addressbooks/user1/book1/card1', ['Accept' => 'application/vcard+json']);
$response = new \Sabre\HTTP\ResponseMock();
$this->server->invokeMethod($request, $response);
$this->assertEquals(200, $response->getStatus());
-
}
+ public function testGetWithoutContentType()
+ {
+ $request = new \Sabre\HTTP\Request('GET', '/');
+ $response = new \Sabre\HTTP\ResponseMock();
+ $this->plugin->httpAfterGet($request, $response);
+ $this->assertTrue(true);
+ }
}
diff --git a/vendor/sabre/dav/tests/Sabre/CardDAV/SogoStripContentTypeTest.php b/vendor/sabre/dav/tests/Sabre/CardDAV/SogoStripContentTypeTest.php
index d4bc48098..8d045569c 100644
--- a/vendor/sabre/dav/tests/Sabre/CardDAV/SogoStripContentTypeTest.php
+++ b/vendor/sabre/dav/tests/Sabre/CardDAV/SogoStripContentTypeTest.php
@@ -1,17 +1,19 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CardDAV;
use Sabre\DAV\PropFind;
use Sabre\HTTP;
-class SogoStripContentTypeTest extends \Sabre\DAVServerTest {
-
+class SogoStripContentTypeTest extends \Sabre\DAVServerTest
+{
protected $setupCardDAV = true;
protected $carddavAddressBooks = [
[
- 'id' => 1,
- 'uri' => 'book1',
+ 'id' => 1,
+ 'uri' => 'book1',
'principaluri' => 'principals/user1',
],
];
@@ -21,27 +23,27 @@ class SogoStripContentTypeTest extends \Sabre\DAVServerTest {
],
];
- function testDontStrip() {
-
+ public function testDontStrip()
+ {
$result = $this->server->getProperties('addressbooks/user1/book1/card1.vcf', ['{DAV:}getcontenttype']);
$this->assertEquals([
- '{DAV:}getcontenttype' => 'text/vcard; charset=utf-8'
+ '{DAV:}getcontenttype' => 'text/vcard; charset=utf-8',
], $result);
-
}
- function testStrip() {
- $this->server->httpRequest = HTTP\Sapi::createFromServerArray([
- 'HTTP_USER_AGENT' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2 Lightning/1.2.1',
+ public function testStrip()
+ {
+ $this->server->httpRequest = new HTTP\Request('GET', '/', [
+ 'User-Agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2 Lightning/1.2.1',
]);
$result = $this->server->getProperties('addressbooks/user1/book1/card1.vcf', ['{DAV:}getcontenttype']);
$this->assertEquals([
- '{DAV:}getcontenttype' => 'text/x-vcard'
+ '{DAV:}getcontenttype' => 'text/x-vcard',
], $result);
-
}
- function testDontTouchOtherMimeTypes() {
+ public function testDontTouchOtherMimeTypes()
+ {
$this->server->httpRequest = new HTTP\Request('GET', '/addressbooks/user1/book1/card1.vcf', [
'User-Agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2 Lightning/1.2.1',
]);
@@ -50,7 +52,16 @@ class SogoStripContentTypeTest extends \Sabre\DAVServerTest {
$propFind->set('{DAV:}getcontenttype', 'text/plain');
$this->carddavPlugin->propFindLate($propFind, new \Sabre\DAV\SimpleCollection('foo'));
$this->assertEquals('text/plain', $propFind->get('{DAV:}getcontenttype'));
-
}
+ public function testStripWithoutGetContentType()
+ {
+ $this->server->httpRequest = new HTTP\Request('GET', '/addressbooks/user1/book1/card1.vcf', [
+ 'User-Agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2 Lightning/1.2.1',
+ ]);
+
+ $propFind = new PropFind('hello', ['{DAV:}getcontenttype']);
+ $this->carddavPlugin->propFindLate($propFind, new \Sabre\DAV\SimpleCollection('foo'));
+ $this->assertEquals(null, $propFind->get('{DAV:}getcontenttype')); // Property not present
+ }
}
diff --git a/vendor/sabre/dav/tests/Sabre/CardDAV/TestUtil.php b/vendor/sabre/dav/tests/Sabre/CardDAV/TestUtil.php
index ec8a3501e..0bdf07df5 100644
--- a/vendor/sabre/dav/tests/Sabre/CardDAV/TestUtil.php
+++ b/vendor/sabre/dav/tests/Sabre/CardDAV/TestUtil.php
@@ -1,18 +1,20 @@
<?php
-namespace Sabre\CardDAV;
-
-class TestUtil {
+declare(strict_types=1);
- static function getBackend() {
+namespace Sabre\CardDAV;
+class TestUtil
+{
+ public static function getBackend()
+ {
$backend = new Backend\PDO(self::getSQLiteDB());
- return $backend;
+ return $backend;
}
- static function getSQLiteDB() {
-
+ public static function getSQLiteDB()
+ {
$pdo = Backend\PDOSqliteTest::getSQLite();
// Inserting events through a backend class.
@@ -21,7 +23,7 @@ class TestUtil {
'principals/user1',
'UUID-123467',
[
- '{DAV:}displayname' => 'user1 addressbook',
+ '{DAV:}displayname' => 'user1 addressbook',
'{urn:ietf:params:xml:ns:carddav}addressbook-description' => 'AddressBook description',
]
);
@@ -29,22 +31,23 @@ class TestUtil {
'principals/user1',
'UUID-123468',
[
- '{DAV:}displayname' => 'user1 addressbook2',
+ '{DAV:}displayname' => 'user1 addressbook2',
'{urn:ietf:params:xml:ns:carddav}addressbook-description' => 'AddressBook description',
]
);
$backend->createCard($addressbookId, 'UUID-2345', self::getTestCardData());
- return $pdo;
+ return $pdo;
}
- static function deleteSQLiteDB() {
+ public static function deleteSQLiteDB()
+ {
$sqliteTest = new Backend\PDOSqliteTest();
$pdo = $sqliteTest->tearDown();
}
- static function getTestCardData() {
-
+ public static function getTestCardData()
+ {
$addressbookData = 'BEGIN:VCARD
VERSION:3.0
PRODID:-//Acme Inc.//RoadRunner 1.0//EN
@@ -56,7 +59,5 @@ REV:2012-06-20T07:00:39+00:00
END:VCARD';
return $addressbookData;
-
}
-
}
diff --git a/vendor/sabre/dav/tests/Sabre/CardDAV/VCFExportTest.php b/vendor/sabre/dav/tests/Sabre/CardDAV/VCFExportTest.php
index 82d82fadd..d8acc3c14 100644
--- a/vendor/sabre/dav/tests/Sabre/CardDAV/VCFExportTest.php
+++ b/vendor/sabre/dav/tests/Sabre/CardDAV/VCFExportTest.php
@@ -1,43 +1,44 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CardDAV;
use Sabre\HTTP;
-class VCFExportTest extends \Sabre\DAVServerTest {
-
+class VCFExportTest extends \Sabre\DAVServerTest
+{
protected $setupCardDAV = true;
protected $autoLogin = 'user1';
protected $setupACL = true;
protected $carddavAddressBooks = [
[
- 'id' => 'book1',
- 'uri' => 'book1',
+ 'id' => 'book1',
+ 'uri' => 'book1',
'principaluri' => 'principals/user1',
- ]
+ ],
];
protected $carddavCards = [
'book1' => [
- "card1" => "BEGIN:VCARD\r\nFN:Person1\r\nEND:VCARD\r\n",
- "card2" => "BEGIN:VCARD\r\nFN:Person2\r\nEND:VCARD",
- "card3" => "BEGIN:VCARD\r\nFN:Person3\r\nEND:VCARD\r\n",
- "card4" => "BEGIN:VCARD\nFN:Person4\nEND:VCARD\n",
- ]
+ 'card1' => "BEGIN:VCARD\r\nFN:Person1\r\nEND:VCARD\r\n",
+ 'card2' => "BEGIN:VCARD\r\nFN:Person2\r\nEND:VCARD",
+ 'card3' => "BEGIN:VCARD\r\nFN:Person3\r\nEND:VCARD\r\n",
+ 'card4' => "BEGIN:VCARD\nFN:Person4\nEND:VCARD\n",
+ ],
];
- function setUp() {
-
+ public function setUp()
+ {
parent::setUp();
$plugin = new VCFExportPlugin();
$this->server->addPlugin(
$plugin
);
-
}
- function testSimple() {
-
+ public function testSimple()
+ {
$plugin = $this->server->getPlugin('vcf-export');
$this->assertInstanceOf('Sabre\\CardDAV\\VCFExportPlugin', $plugin);
@@ -45,21 +46,20 @@ class VCFExportTest extends \Sabre\DAVServerTest {
'vcf-export',
$plugin->getPluginInfo()['name']
);
-
}
- function testExport() {
-
+ public function testExport()
+ {
$request = HTTP\Sapi::createFromServerArray([
- 'REQUEST_URI' => '/addressbooks/user1/book1?export',
- 'QUERY_STRING' => 'export',
+ 'REQUEST_URI' => '/addressbooks/user1/book1?export',
+ 'QUERY_STRING' => 'export',
'REQUEST_METHOD' => 'GET',
]);
$response = $this->request($request);
$this->assertEquals(200, $response->status, $response->body);
- $expected = "BEGIN:VCARD
+ $expected = 'BEGIN:VCARD
FN:Person1
END:VCARD
BEGIN:VCARD
@@ -71,26 +71,24 @@ END:VCARD
BEGIN:VCARD
FN:Person4
END:VCARD
-";
+';
// We actually expected windows line endings
$expected = str_replace("\n", "\r\n", $expected);
$this->assertEquals($expected, $response->body);
-
}
- function testBrowserIntegration() {
-
+ public function testBrowserIntegration()
+ {
$plugin = $this->server->getPlugin('vcf-export');
$actions = '';
$addressbook = new AddressBook($this->carddavBackend, []);
$this->server->emit('browserButtonActions', ['/foo', $addressbook, &$actions]);
$this->assertContains('/foo?export', $actions);
-
}
- function testContentDisposition() {
-
+ public function testContentDisposition()
+ {
$request = new HTTP\Request(
'GET',
'/addressbooks/user1/book1?export'
@@ -99,14 +97,13 @@ END:VCARD
$response = $this->request($request, 200);
$this->assertEquals('text/directory', $response->getHeader('Content-Type'));
$this->assertEquals(
- 'attachment; filename="book1-' . date('Y-m-d') . '.vcf"',
+ 'attachment; filename="book1-'.date('Y-m-d').'.vcf"',
$response->getHeader('Content-Disposition')
);
-
}
- function testContentDispositionBadChars() {
-
+ public function testContentDispositionBadChars()
+ {
$this->carddavBackend->createAddressBook(
'principals/user1',
'book-b_ad"(ch)ars',
@@ -126,10 +123,8 @@ END:VCARD
$response = $this->request($request, 200);
$this->assertEquals('text/directory', $response->getHeader('Content-Type'));
$this->assertEquals(
- 'attachment; filename="book-b_adchars-' . date('Y-m-d') . '.vcf"',
+ 'attachment; filename="book-b_adchars-'.date('Y-m-d').'.vcf"',
$response->getHeader('Content-Disposition')
);
-
}
-
}
diff --git a/vendor/sabre/dav/tests/Sabre/CardDAV/ValidateFilterTest.php b/vendor/sabre/dav/tests/Sabre/CardDAV/ValidateFilterTest.php
index 03c468f86..753efc73d 100644
--- a/vendor/sabre/dav/tests/Sabre/CardDAV/ValidateFilterTest.php
+++ b/vendor/sabre/dav/tests/Sabre/CardDAV/ValidateFilterTest.php
@@ -1,31 +1,32 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CardDAV;
require_once 'Sabre/CardDAV/AbstractPluginTest.php';
-class ValidateFilterTest extends AbstractPluginTest {
-
+class ValidateFilterTest extends AbstractPluginTest
+{
/**
- * @param string $input
- * @param array $filters
- * @param string $test
- * @param bool $result
+ * @param string $input
+ * @param array $filters
+ * @param string $test
+ * @param bool $result
* @param string|null $message
* @dataProvider data
*/
- function testFilter($input, $filters, $test, $result, $message = null) {
-
+ public function testFilter($input, $filters, $test, $result, $message = null)
+ {
if ($result) {
$this->assertTrue($this->plugin->validateFilters($input, $filters, $test), $message);
} else {
$this->assertFalse($this->plugin->validateFilters($input, $filters, $test), $message);
}
-
}
- function data() {
-
+ public function data()
+ {
$body1 = <<<HELLO
BEGIN:VCARD
VERSION:3.0
@@ -70,14 +71,14 @@ HELLO;
// Check if TEL[TYPE] is defined
$filter5 =
[
- 'name' => 'tel',
+ 'name' => 'tel',
'is-not-defined' => false,
- 'test' => 'anyof',
- 'param-filters' => [
+ 'test' => 'anyof',
+ 'param-filters' => [
[
- 'name' => 'type',
+ 'name' => 'type',
'is-not-defined' => false,
- 'text-match' => null
+ 'text-match' => null,
],
],
'text-matches' => [],
@@ -107,16 +108,16 @@ HELLO;
// Check if URL contains 'google'
$filter11 =
[
- 'name' => 'url',
+ 'name' => 'url',
'is-not-defined' => false,
- 'test' => 'anyof',
- 'param-filters' => [],
- 'text-matches' => [
+ 'test' => 'anyof',
+ 'param-filters' => [],
+ 'text-matches' => [
[
- 'match-type' => 'contains',
- 'value' => 'google',
+ 'match-type' => 'contains',
+ 'value' => 'google',
'negate-condition' => false,
- 'collation' => 'i;octet',
+ 'collation' => 'i;octet',
],
],
];
@@ -137,22 +138,21 @@ HELLO;
// Param filter with text
$filter15 = $filter5;
$filter15['param-filters'][0]['text-match'] = [
- 'match-type' => 'contains',
- 'value' => 'WORK',
- 'collation' => 'i;octet',
+ 'match-type' => 'contains',
+ 'value' => 'WORK',
+ 'collation' => 'i;octet',
'negate-condition' => false,
];
$filter16 = $filter15;
$filter16['param-filters'][0]['text-match']['negate-condition'] = true;
-
// Param filter + text filter
$filter17 = $filter5;
$filter17['test'] = 'anyof';
$filter17['text-matches'][] = [
- 'match-type' => 'contains',
- 'value' => '444',
- 'collation' => 'i;octet',
+ 'match-type' => 'contains',
+ 'value' => '444',
+ 'collation' => 'i;octet',
'negate-condition' => false,
];
@@ -162,20 +162,19 @@ HELLO;
$filter18['test'] = 'allof';
return [
-
// Basic filters
- [$body1, [$filter1], 'anyof',true],
- [$body1, [$filter2], 'anyof',false],
- [$body1, [$filter3], 'anyof',false],
- [$body1, [$filter4], 'anyof',true],
+ [$body1, [$filter1], 'anyof', true],
+ [$body1, [$filter2], 'anyof', false],
+ [$body1, [$filter3], 'anyof', false],
+ [$body1, [$filter4], 'anyof', true],
// Combinations
- [$body1, [$filter1, $filter2], 'anyof',true],
- [$body1, [$filter1, $filter2], 'allof',false],
- [$body1, [$filter1, $filter4], 'anyof',true],
- [$body1, [$filter1, $filter4], 'allof',true],
- [$body1, [$filter2, $filter3], 'anyof',false],
- [$body1, [$filter2, $filter3], 'allof',false],
+ [$body1, [$filter1, $filter2], 'anyof', true],
+ [$body1, [$filter1, $filter2], 'allof', false],
+ [$body1, [$filter1, $filter4], 'anyof', true],
+ [$body1, [$filter1, $filter4], 'allof', true],
+ [$body1, [$filter2, $filter3], 'anyof', false],
+ [$body1, [$filter2, $filter3], 'allof', false],
// Basic parameters
[$body1, [$filter5], 'anyof', true, 'TEL;TYPE is defined, so this should return true'],
@@ -203,7 +202,5 @@ HELLO;
[$body1, [$filter18], 'anyof', false],
[$body1, [$filter18], 'anyof', false],
];
-
}
-
}
diff --git a/vendor/sabre/dav/tests/Sabre/CardDAV/ValidateVCardTest.php b/vendor/sabre/dav/tests/Sabre/CardDAV/ValidateVCardTest.php
index acba2cfc8..2317b86cc 100644
--- a/vendor/sabre/dav/tests/Sabre/CardDAV/ValidateVCardTest.php
+++ b/vendor/sabre/dav/tests/Sabre/CardDAV/ValidateVCardTest.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CardDAV;
use Sabre\DAV;
@@ -8,19 +10,19 @@ use Sabre\HTTP;
require_once 'Sabre/HTTP/ResponseMock.php';
-class ValidateVCardTest extends \PHPUnit_Framework_TestCase {
-
+class ValidateVCardTest extends \PHPUnit\Framework\TestCase
+{
protected $server;
protected $cardBackend;
- function setUp() {
-
+ public function setUp()
+ {
$addressbooks = [
[
- 'id' => 'addressbook1',
+ 'id' => 'addressbook1',
'principaluri' => 'principals/admin',
- 'uri' => 'addressbook1',
- ]
+ 'uri' => 'addressbook1',
+ ],
];
$this->cardBackend = new Backend\Mock($addressbooks, []);
@@ -39,21 +41,19 @@ class ValidateVCardTest extends \PHPUnit_Framework_TestCase {
$response = new HTTP\ResponseMock();
$this->server->httpResponse = $response;
-
}
- function request(HTTP\Request $request, $expectedStatus = null) {
-
+ public function request(HTTP\Request $request, $expectedStatus = null)
+ {
$this->server->httpRequest = $request;
$this->server->exec();
if ($expectedStatus) {
-
$realStatus = $this->server->httpResponse->getStatus();
$msg = '';
if ($realStatus !== $expectedStatus) {
- $msg = 'Response body: ' . $this->server->httpResponse->getBodyAsString();
+ $msg = 'Response body: '.$this->server->httpResponse->getBodyAsString();
}
$this->assertEquals(
$expectedStatus,
@@ -63,24 +63,22 @@ class ValidateVCardTest extends \PHPUnit_Framework_TestCase {
}
return $this->server->httpResponse;
-
}
- function testCreateFile() {
-
+ public function testCreateFile()
+ {
$request = HTTP\Sapi::createFromServerArray([
'REQUEST_METHOD' => 'PUT',
- 'REQUEST_URI' => '/addressbooks/admin/addressbook1/blabla.vcf',
+ 'REQUEST_URI' => '/addressbooks/admin/addressbook1/blabla.vcf',
]);
$response = $this->request($request);
$this->assertEquals(415, $response->status);
-
}
- function testCreateFileValid() {
-
+ public function testCreateFileValid()
+ {
$request = new HTTP\Request(
'PUT',
'/addressbooks/admin/addressbook1/blabla.vcf'
@@ -104,20 +102,18 @@ VCF;
);
// Valid, non-auto-fixed responses should contain an ETag.
$this->assertTrue(
- $response->getHeader('ETag') !== null,
+ null !== $response->getHeader('ETag'),
'We did not receive an etag'
);
-
$expected = [
- 'uri' => 'blabla.vcf',
+ 'uri' => 'blabla.vcf',
'carddata' => $vcard,
- 'size' => strlen($vcard),
- 'etag' => '"' . md5($vcard) . '"',
+ 'size' => strlen($vcard),
+ 'etag' => '"'.md5($vcard).'"',
];
$this->assertEquals($expected, $this->cardBackend->getCard('addressbook1', 'blabla.vcf'));
-
}
/**
@@ -126,8 +122,8 @@ VCF;
*
* @depends testCreateFileValid
*/
- function testCreateVCardAutoFix() {
-
+ public function testCreateVCardAutoFix()
+ {
$request = new HTTP\Request(
'PUT',
'/addressbooks/admin/addressbook1/blabla.vcf'
@@ -168,14 +164,13 @@ END:VCARD\r
VCF;
$expected = [
- 'uri' => 'blabla.vcf',
+ 'uri' => 'blabla.vcf',
'carddata' => $expectedVCard,
- 'size' => strlen($expectedVCard),
- 'etag' => '"' . md5($expectedVCard) . '"',
+ 'size' => strlen($expectedVCard),
+ 'etag' => '"'.md5($expectedVCard).'"',
];
$this->assertEquals($expected, $this->cardBackend->getCard('addressbook1', 'blabla.vcf'));
-
}
/**
@@ -187,8 +182,8 @@ VCF;
*
* @depends testCreateFileValid
*/
- function testCreateVCardStrictFail() {
-
+ public function testCreateVCardStrictFail()
+ {
$request = new HTTP\Request(
'PUT',
'/addressbooks/admin/addressbook1/blabla.vcf',
@@ -209,11 +204,10 @@ VCF;
$request->setBody($vcard);
$this->request($request, 415);
-
}
- function testCreateFileNoUID() {
-
+ public function testCreateFileNoUID()
+ {
$request = new HTTP\Request(
'PUT',
'/addressbooks/admin/addressbook1/blabla.vcf'
@@ -231,13 +225,13 @@ VCF;
$foo = $this->cardBackend->getCard('addressbook1', 'blabla.vcf');
$this->assertTrue(
- strpos($foo['carddata'], 'UID') !== false,
+ false !== strpos($foo['carddata'], 'UID'),
print_r($foo, true)
);
}
- function testCreateFileJson() {
-
+ public function testCreateFileJson()
+ {
$request = new HTTP\Request(
'PUT',
'/addressbooks/admin/addressbook1/blabla.vcf'
@@ -246,29 +240,27 @@ VCF;
$response = $this->request($request);
- $this->assertEquals(201, $response->status, 'Incorrect status returned! Full response body: ' . $response->body);
+ $this->assertEquals(201, $response->status, 'Incorrect status returned! Full response body: '.$response->body);
$foo = $this->cardBackend->getCard('addressbook1', 'blabla.vcf');
$this->assertEquals("BEGIN:VCARD\r\nVERSION:4.0\r\nUID:foo\r\nFN:FirstName LastName\r\nEND:VCARD\r\n", $foo['carddata']);
-
}
- function testCreateFileVCalendar() {
-
+ public function testCreateFileVCalendar()
+ {
$request = HTTP\Sapi::createFromServerArray([
'REQUEST_METHOD' => 'PUT',
- 'REQUEST_URI' => '/addressbooks/admin/addressbook1/blabla.vcf',
+ 'REQUEST_URI' => '/addressbooks/admin/addressbook1/blabla.vcf',
]);
$request->setBody("BEGIN:VCALENDAR\r\nEND:VCALENDAR\r\n");
$response = $this->request($request);
- $this->assertEquals(415, $response->status, 'Incorrect status returned! Full response body: ' . $response->body);
-
+ $this->assertEquals(415, $response->status, 'Incorrect status returned! Full response body: '.$response->body);
}
- function testUpdateFile() {
-
+ public function testUpdateFile()
+ {
$this->cardBackend->createCard('addressbook1', 'blabla.vcf', 'foo');
$request = new HTTP\Request(
'PUT',
@@ -276,11 +268,10 @@ VCF;
);
$response = $this->request($request, 415);
-
}
- function testUpdateFileParsableBody() {
-
+ public function testUpdateFileParsableBody()
+ {
$this->cardBackend->createCard('addressbook1', 'blabla.vcf', 'foo');
$request = new HTTP\Request(
'PUT',
@@ -293,13 +284,12 @@ VCF;
$response = $this->request($request, 204);
$expected = [
- 'uri' => 'blabla.vcf',
+ 'uri' => 'blabla.vcf',
'carddata' => $body,
- 'size' => strlen($body),
- 'etag' => '"' . md5($body) . '"',
+ 'size' => strlen($body),
+ 'etag' => '"'.md5($body).'"',
];
$this->assertEquals($expected, $this->cardBackend->getCard('addressbook1', 'blabla.vcf'));
-
}
}