diff options
author | Mario <mario@mariovavti.com> | 2021-02-15 18:35:40 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2021-02-15 18:35:40 +0000 |
commit | 0cd4c3410121b9b584dc1b108e555832843b2576 (patch) | |
tree | adcac187c383120a255396d19a010f359c58e614 | |
parent | 02401ea9fd5d53f590305c0f9834685cda58723d (diff) | |
download | volse-hubzilla-0cd4c3410121b9b584dc1b108e555832843b2576.tar.gz volse-hubzilla-0cd4c3410121b9b584dc1b108e555832843b2576.tar.bz2 volse-hubzilla-0cd4c3410121b9b584dc1b108e555832843b2576.zip |
compser update sabre/dav /vobject
195 files changed, 173 insertions, 24294 deletions
diff --git a/composer.lock b/composer.lock index 293d93d3d..18d2cd586 100644 --- a/composer.lock +++ b/composer.lock @@ -891,16 +891,16 @@ }, { "name": "sabre/dav", - "version": "4.1.3", + "version": "4.1.5", "source": { "type": "git", "url": "https://github.com/sabre-io/dav.git", - "reference": "b903eeedfbdcd6cab7935661ec6dc2d90cdf8a1e" + "reference": "c1afdc77a95efea6ee40c03c45f57c3c0c80ec22" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sabre-io/dav/zipball/b903eeedfbdcd6cab7935661ec6dc2d90cdf8a1e", - "reference": "b903eeedfbdcd6cab7935661ec6dc2d90cdf8a1e", + "url": "https://api.github.com/repos/sabre-io/dav/zipball/c1afdc77a95efea6ee40c03c45f57c3c0c80ec22", + "reference": "c1afdc77a95efea6ee40c03c45f57c3c0c80ec22", "shasum": "" }, "require": { @@ -924,7 +924,7 @@ }, "require-dev": { "evert/phpdoc-md": "~0.1.0", - "friendsofphp/php-cs-fixer": "^2.16.7", + "friendsofphp/php-cs-fixer": "^2.17.1", "monolog/monolog": "^1.18", "phpstan/phpstan": "^0.12", "phpunit/phpunit": "^7.5 || ^8.5 || ^9.0" @@ -973,7 +973,7 @@ "issues": "https://github.com/sabre-io/dav/issues", "source": "https://github.com/fruux/sabre-dav" }, - "time": "2020-11-09T07:48:35+00:00" + "time": "2021-02-12T07:54:23+00:00" }, { "name": "sabre/event", @@ -1163,16 +1163,16 @@ }, { "name": "sabre/vobject", - "version": "4.3.3", + "version": "4.3.5", "source": { "type": "git", "url": "https://github.com/sabre-io/vobject.git", - "reference": "58f9f9b46a1080c0130bd86f4df9a568aacb9c79" + "reference": "d8a0a9ae215a8acfb51afc29101c7344670b9c83" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sabre-io/vobject/zipball/58f9f9b46a1080c0130bd86f4df9a568aacb9c79", - "reference": "58f9f9b46a1080c0130bd86f4df9a568aacb9c79", + "url": "https://api.github.com/repos/sabre-io/vobject/zipball/d8a0a9ae215a8acfb51afc29101c7344670b9c83", + "reference": "d8a0a9ae215a8acfb51afc29101c7344670b9c83", "shasum": "" }, "require": { @@ -1181,8 +1181,9 @@ "sabre/xml": "^2.1" }, "require-dev": { - "friendsofphp/php-cs-fixer": "~2.16.7", + "friendsofphp/php-cs-fixer": "~2.17.1", "phpstan/phpstan": "^0.12", + "phpunit/php-invoker": "^2.0 || ^3.1", "phpunit/phpunit": "^7.5 || ^8.5 || ^9.0" }, "suggest": { @@ -1262,7 +1263,7 @@ "issues": "https://github.com/sabre-io/vobject/issues", "source": "https://github.com/fruux/sabre-vobject" }, - "time": "2020-11-09T04:31:38+00:00" + "time": "2021-02-12T06:28:04+00:00" }, { "name": "sabre/xml", diff --git a/vendor/composer/InstalledVersions.php b/vendor/composer/InstalledVersions.php index fd17711f2..88cdba06c 100644 --- a/vendor/composer/InstalledVersions.php +++ b/vendor/composer/InstalledVersions.php @@ -29,7 +29,7 @@ private static $installed = array ( 'aliases' => array ( ), - 'reference' => '18c8f1b903e90ca3632520b90d21ec3770bf6e0b', + 'reference' => '02401ea9fd5d53f590305c0f9834685cda58723d', 'name' => 'zotlabs/hubzilla', ), 'versions' => @@ -169,12 +169,12 @@ private static $installed = array ( ), 'sabre/dav' => array ( - 'pretty_version' => '4.1.3', - 'version' => '4.1.3.0', + 'pretty_version' => '4.1.5', + 'version' => '4.1.5.0', 'aliases' => array ( ), - 'reference' => 'b903eeedfbdcd6cab7935661ec6dc2d90cdf8a1e', + 'reference' => 'c1afdc77a95efea6ee40c03c45f57c3c0c80ec22', ), 'sabre/event' => array ( @@ -205,12 +205,12 @@ private static $installed = array ( ), 'sabre/vobject' => array ( - 'pretty_version' => '4.3.3', - 'version' => '4.3.3.0', + 'pretty_version' => '4.3.5', + 'version' => '4.3.5.0', 'aliases' => array ( ), - 'reference' => '58f9f9b46a1080c0130bd86f4df9a568aacb9c79', + 'reference' => 'd8a0a9ae215a8acfb51afc29101c7344670b9c83', ), 'sabre/xml' => array ( @@ -271,7 +271,7 @@ private static $installed = array ( 'aliases' => array ( ), - 'reference' => '18c8f1b903e90ca3632520b90d21ec3770bf6e0b', + 'reference' => '02401ea9fd5d53f590305c0f9834685cda58723d', ), ), ); diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 91d335ca0..ab8f9899a 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -896,17 +896,17 @@ }, { "name": "sabre/dav", - "version": "4.1.3", - "version_normalized": "4.1.3.0", + "version": "4.1.5", + "version_normalized": "4.1.5.0", "source": { "type": "git", "url": "https://github.com/sabre-io/dav.git", - "reference": "b903eeedfbdcd6cab7935661ec6dc2d90cdf8a1e" + "reference": "c1afdc77a95efea6ee40c03c45f57c3c0c80ec22" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sabre-io/dav/zipball/b903eeedfbdcd6cab7935661ec6dc2d90cdf8a1e", - "reference": "b903eeedfbdcd6cab7935661ec6dc2d90cdf8a1e", + "url": "https://api.github.com/repos/sabre-io/dav/zipball/c1afdc77a95efea6ee40c03c45f57c3c0c80ec22", + "reference": "c1afdc77a95efea6ee40c03c45f57c3c0c80ec22", "shasum": "" }, "require": { @@ -930,7 +930,7 @@ }, "require-dev": { "evert/phpdoc-md": "~0.1.0", - "friendsofphp/php-cs-fixer": "^2.16.7", + "friendsofphp/php-cs-fixer": "^2.17.1", "monolog/monolog": "^1.18", "phpstan/phpstan": "^0.12", "phpunit/phpunit": "^7.5 || ^8.5 || ^9.0" @@ -940,7 +940,7 @@ "ext-imap": "*", "ext-pdo": "*" }, - "time": "2020-11-09T07:48:35+00:00", + "time": "2021-02-12T07:54:23+00:00", "bin": [ "bin/sabredav", "bin/naturalselection" @@ -1180,17 +1180,17 @@ }, { "name": "sabre/vobject", - "version": "4.3.3", - "version_normalized": "4.3.3.0", + "version": "4.3.5", + "version_normalized": "4.3.5.0", "source": { "type": "git", "url": "https://github.com/sabre-io/vobject.git", - "reference": "58f9f9b46a1080c0130bd86f4df9a568aacb9c79" + "reference": "d8a0a9ae215a8acfb51afc29101c7344670b9c83" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sabre-io/vobject/zipball/58f9f9b46a1080c0130bd86f4df9a568aacb9c79", - "reference": "58f9f9b46a1080c0130bd86f4df9a568aacb9c79", + "url": "https://api.github.com/repos/sabre-io/vobject/zipball/d8a0a9ae215a8acfb51afc29101c7344670b9c83", + "reference": "d8a0a9ae215a8acfb51afc29101c7344670b9c83", "shasum": "" }, "require": { @@ -1199,14 +1199,15 @@ "sabre/xml": "^2.1" }, "require-dev": { - "friendsofphp/php-cs-fixer": "~2.16.7", + "friendsofphp/php-cs-fixer": "~2.17.1", "phpstan/phpstan": "^0.12", + "phpunit/php-invoker": "^2.0 || ^3.1", "phpunit/phpunit": "^7.5 || ^8.5 || ^9.0" }, "suggest": { "hoa/bench": "If you would like to run the benchmark scripts" }, - "time": "2020-11-09T04:31:38+00:00", + "time": "2021-02-12T06:28:04+00:00", "bin": [ "bin/vobject", "bin/generate_vcards" diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index 7cad9b54b..2b6305c54 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -6,7 +6,7 @@ 'aliases' => array ( ), - 'reference' => '18c8f1b903e90ca3632520b90d21ec3770bf6e0b', + 'reference' => '02401ea9fd5d53f590305c0f9834685cda58723d', 'name' => 'zotlabs/hubzilla', ), 'versions' => @@ -146,12 +146,12 @@ ), 'sabre/dav' => array ( - 'pretty_version' => '4.1.3', - 'version' => '4.1.3.0', + 'pretty_version' => '4.1.5', + 'version' => '4.1.5.0', 'aliases' => array ( ), - 'reference' => 'b903eeedfbdcd6cab7935661ec6dc2d90cdf8a1e', + 'reference' => 'c1afdc77a95efea6ee40c03c45f57c3c0c80ec22', ), 'sabre/event' => array ( @@ -182,12 +182,12 @@ ), 'sabre/vobject' => array ( - 'pretty_version' => '4.3.3', - 'version' => '4.3.3.0', + 'pretty_version' => '4.3.5', + 'version' => '4.3.5.0', 'aliases' => array ( ), - 'reference' => '58f9f9b46a1080c0130bd86f4df9a568aacb9c79', + 'reference' => 'd8a0a9ae215a8acfb51afc29101c7344670b9c83', ), 'sabre/xml' => array ( @@ -248,7 +248,7 @@ 'aliases' => array ( ), - 'reference' => '18c8f1b903e90ca3632520b90d21ec3770bf6e0b', + 'reference' => '02401ea9fd5d53f590305c0f9834685cda58723d', ), ), ); diff --git a/vendor/sabre/dav/.gitignore b/vendor/sabre/dav/.gitignore deleted file mode 100644 index f287cca1a..000000000 --- a/vendor/sabre/dav/.gitignore +++ /dev/null @@ -1,40 +0,0 @@ -# Unit tests -tests/temp -tests/.sabredav -tests/cov - -# Custom settings for tests -tests/config.user.php - -# PHPUnit test Cache -.phpunit.result.cache - -# ViM -*.swp - -# Composer -composer.lock -vendor - -# Composer binaries -bin/vobject -bin/generate_vcards -bin/phpdocmd - -# Assuming every .php file in the root is for testing -/*.php - -# Other testing stuff -/tmpdata -/data -/public - -# Build -build -build.properties - -# Docs -docs/api -docs/wikidocs - -.php_cs.cache diff --git a/vendor/sabre/dav/.travis.yml b/vendor/sabre/dav/.travis.yml index 95331ac0d..6214d80b3 100644 --- a/vendor/sabre/dav/.travis.yml +++ b/vendor/sabre/dav/.travis.yml @@ -27,7 +27,7 @@ matrix: include: - name: 'PHP8' dist: bionic - php: nightly + php: 8.0 env: - RUN_PHPCSFIXER="FALSE" - REPORT_COVERAGE="FALSE" diff --git a/vendor/sabre/dav/CHANGELOG.md b/vendor/sabre/dav/CHANGELOG.md deleted file mode 100644 index 9db36f927..000000000 --- a/vendor/sabre/dav/CHANGELOG.md +++ /dev/null @@ -1,2526 +0,0 @@ -ChangeLog -========= - -4.1.3 (2020-11-09) -------------------------- -* #1306: Return 409 when trying to PUT a file into a non-existent collection - -4.1.2 (2020-10-04) -------------------------- -* #1296: Add experimental support for PHP 8.0 - -4.1.1 (2020-07-13) -------------------------- -* Fix PHPdoc of Tree:move method -* Allow using custom SAPI implementations -* Include baseUri in lock responses - -4.1.0 (2020-03-20) -------------------------- -* Support PHP 7.4 -* Drop support for PHP 7.0 -* CalDAV: send MIME-Version header in scheduling emails - -4.0.3 (2020-01-10) -------------------------- -* DAV: Streaming PROPFIND server implementation -* DAVACL: Fix uppercase of NotAuthenticated class -* CalDAV: Return only calendar objects owned by principal itself -* CalDAV: Convert scheduling object data from resource to string -* Browser Plugin: Fix content type guessing if setBaseUri is set to a folder - - -4.0.2 (2019-10-18) -------------------------- -* Fix error with PHP 7.4 -* CardDAV: Fix content-type for Thunderbird - - -4.0.1 (2019-08-20) -------------------------- -* TemporaryFileFilterPlugin: Fix Strict Error -* CalDAV\Plugin: Fix null path - - -4.0.0 (2019-07-01) -------------------------- -* Lock: Support lock timeout value Infinity -* Lock: Hide lock token in lock discovery when not set -* BrowserPlugin: Show display name of nodes -* FSExt: Fix folder (file) move issue if rename fails -* IMipPlugin: Add sender name in invite mail headers -* IMipPlugin: Fix email subject and recipient -* Fix issues with empty content-type header -* Apply new code style -* Fix for litmus test suite - test case: props propfind_invalid2 -* Depend on sabre/xml 2.0.1 -* Depend on sabre/http 5.0 -* Now supports PHP 7.3 -* Now requires PHP 7. -* Using `strict_types` in every php file. -* #896: Using the [sabre/event][evnt] `WildcardEmitter`. This allows event - handlers to listen to events using a wildcard. -* #896: Event listeners that in the past listened to `beforeMethod` or `method` - no longer get called. They must listen to `beforeMethod:*` and `method:*` now. -* #322: Imap authentication backend. (@c0d3z3r0). -* #889: Support for selective property querying in CardDAV's addressbook-query. - (@DeepDiver1975). -* #982: Make sure that files that are siblings of directories, are reported - as files (@nickvergessen) - - -4.0.0-beta1 (2019-05-08) -------------------------- -* Lock: Support lock timeout value Infinity -* Lock: Hide lock token in lock discovery when not set -* BrowserPlugin: Show display name of nodes -* FSExt: Fix folder (file) move issue if rename fails -* IMipPlugin: Add sender name in invite mail headers -* IMipPlugin: Fix email subject and recipient - - -4.0.0-alpha5 (2018-10-15) -------------------------- -* Fix issues with empty content-type header - - -4.0.0-alpha4 (2018-10-12) -------------------------- -* Apply new code style -* Fix for litmus test suite - test case: props propfind_invalid2 -* Depend on sabre/xml 2.0.1 - - -4.0.0-alpha3 (2018-10-05) -------------------------- -* Fixes for PHP 7.3 -* Depend on sabre/http 5.0 - - -4.0.0-alpha2 (2018-09-27) -------------------------- -* Now supports PHP 7.3 - - -4.0.0-alpha1 (2018-06-05) -------------------------- - -* Now requires PHP 7. -* Using `strict_types` in every php file. -* #896: Using the [sabre/event][evnt] `WildcardEmitter`. This allows event - handlers to listen to events using a wildcard. -* #896: Event listeners that in the past listened to `beforeMethod` or `method` - no longer get called. They must listen to `beforeMethod:*` and `method:*` now. -* #322: Imap authentication backend. (@c0d3z3r0). -* #889: Support for selective property querying in CardDAV's addressbook-query. - (@DeepDiver1975). -* #982: Make sure that files that are siblings of directories, are reported - as files (@nickvergessen) - - -3.3.0-alpha1 (2018-06-04) -------------------------- - -* SimpleCollection can now take arrays and strings as argument for super - simple tree creation. -* Added `Sabre\DAV\Server::start()`. This replaces `::exec()`. `::exec()` - is now deprecated, but we're keeping it around for a year or two to make - the transition easier. -* `getChildren()` function in any collection may now return an iterator - instead of an array. This can result in memory savings for large - collections. -* `Tree::getChildren()` now returns an Iterator instead of an array. -* Added `$overrideName` to all `Sabre\DAV\FS` and `Sabre\DAV\FSExt` classes, - so users can specify under what name these nodes show up in the tree. -* #889 Added support for filtering vCard properties in the addressbook-query - REPORT (@DeepDiver1975). -* #918: Add a lot of sqlite indexes. This should speed up sqlite-based - installations quite a bit. -* #982: Make sure that files that are siblings of directories, are reported - as files (@nickvergessen) -* #1058: Don't open file resource on HEAD request (@icewind1991) -* #1031: Fix copyNode for case of file named 0 (@phil-davis) - - -3.2.3 (????-??-??) ------------------- - -* #982: Make sure that files that are siblings of directories, are reported - as files (@nickvergessen) - - -3.2.2 (2017-02-14) ------------------- - -* #943: Fix CardDAV XML reporting bug, which was affecting several CardDAV - clients. Bug was introduced in 3.2.1. -* The zip release ships with [sabre/vobject 4.1.2][vobj], - [sabre/http 4.2.2][http], [sabre/event 3.0.0][evnt], - [sabre/uri 1.2.0][uri] and [sabre/xml 1.5.0][xml]. - - -3.2.1 (2017-01-28) ------------------- - -* #877: Fix for syncing large calendars when using the Sqlite PDO backend. - (@theseer). -* #889 Added support for filtering vCard properties in the addressbook-query - REPORT (@DeepDiver1975). -* The zip release ships with [sabre/vobject 4.1.2][vobj], - [sabre/http 4.2.2][http], [sabre/event 3.0.0][evnt], - [sabre/uri 1.2.0][uri] and [sabre/xml 1.5.0][xml]. - - -3.2.0 (2016-06-27) ------------------- - -* The default ACL rules allow an unauthenticated user to read information - about nodes that don't have their own ACL defined. This was a security - problem. -* The zip release ships with [sabre/vobject 4.1.0][vobj], - [sabre/http 4.2.1][http], [sabre/event 3.0.0][evnt], - [sabre/uri 1.1.0][uri] and [sabre/xml 1.4.2][xml]. - - -3.2.0-beta1 (2016-05-20) ------------------------- - -* #833: Calendars throw exceptions when the sharing plugin is not enabled. -* #834: Return vCards exactly as they were stored if we don't need to convert - in between versions. -* The zip release ships with [sabre/vobject 4.1.0][vobj], - [sabre/http 4.2.1][http], [sabre/event 3.0.0][evnt], - [sabre/uri 1.1.0][uri] and [sabre/xml 1.4.1][xml]. - - -3.2.0-alpha1 (2016-05-09) -------------------------- - -* Database changes for CalDAV. If you are using the CalDAV PDO backends, you - must migrate. Run `./bin/migrateto32.php` for more info. -* Support for WebDAV Resource Sharing, an upcoming standard. -* Added support for sharing in the CalDAV PDO backend! Users can now invite - others to their calendar and give them read/read-write access! -* #397: Support for PSR-3. You can now log exceptions with your favourite - psr3-compatible logging tool. -* #825: Actual proper, tested support for PostgreSQL. We require version 9.5. -* Removed database migration script for sabre/dav 1.7. To update from that - version you now first need to update to sabre/dav 3.1. -* Removed deprecated function: `Sabre\DAV\Auth\Plugin::getCurrentUser()`. -* #774: Fixes for getting free disk space on Windows. -* #803: Major changes in the sharing API. If you were using an old sabre/dav - sharing api, head to the website for more detailed migration notes. -* #657: Support for optional auth using `{DAV:}unauthorized` and `{DAV:}all` - privileges. This allows you to assign a privilege to a resource, allowing - non-authenticated users to access it. For instance, this could allow you - to create a public read-only collection. -* #812 #814: ICS/VCF exporter now includes a more useful filename in its - `Content-Disposition` header. (@Xenopathic). -* #801: BC break: If you were using the `Href` object before, it's behavior - now changed a bit, and `LocalHref` was added to replace the old, default - behavior of `Href`. See the migration doc for more info. -* Removed `Sabre\DAVACL\Plugin::$allowAccessToNodesWithoutACL` setting. - Instead, you can provide a set of default ACL rules with - `Sabre\DAVACL\Plugin::setDefaultAcl()`. -* Introduced `Sabre\DAVACL\ACLTrait` which contains a default implementation - of `Sabre\DAV\IACL` with some sane defaults. We're using this trait all over - the place now, reducing the amount of boilerplate. -* Plugins can now control the "Supported Privilege Set". -* Added Sharing, ICSExport and VCFExport plugins to `groupwareserver.php` - example. -* The `{DAV:}all` privilege is now no longer abstract, so it can be assigned - directly. We're using the `{DAV:}all` privilege now in a lot of cases where - we before assigned both `{DAV:}read` and `{DAV:}write`. -* Resources that are not collections no longer support the `{DAV:}bind` and - `{DAV:}unbind` privileges. -* Corrected the CalDAV-scheduling related privileges. -* Doing an `UNLOCK` no longer requires the `{DAV:}write-content` privilege. -* Added a new `getPrincipalByUri` plugin event. Allowing plugins to request - quickly where a principal lives on a server. -* Renamed `phpunit.xml` to `phpunit.xml.dist` to make local modifications easy. -* Functionality from `IShareableCalendar` is merged into `ISharedCalendar`. -* #751: Fixed XML responses from failing `MKCOL` requests. -* #600: Support for `principal-match` ACL `REPORT`. -* #599: Support for `acl-principal-prop-set` ACL `REPORT`. -* #798: Added an index on `firstoccurence` field in MySQL CalDAV backend. This - should speed up common calendar-query requests. -* #759: DAV\Client is now able to actually correctly resolve relative urls. -* #671: We are no longer checking the `read-free-busy` privilege on individual - calendars during freebusy operations in the scheduling plugin. Instead, we - check the `schedule-query-freebusy` privilege on the target users' inbox, - which validates access for the entire account, per the spec. -* The zip release ships with [sabre/vobject 4.1.0][vobj], - [sabre/http 4.2.1][http], [sabre/event 3.0.0][evnt], - [sabre/uri 1.1.0][uri] and [sabre/xml 1.4.1][xml]. - - -3.1.5 (2018-10-19) ------------------- - -* Fixed: Creating a new calendar on some MySQL configurations caused an error. -* #889 Added support for filtering vCard properties in the addressbook-query - REPORT (@DeepDiver1975). - - - -3.1.4 (2016-05-28) ------------------- - -* #834: Backport from `master`: Return vCards exactly as they were stored if - we don't need to convert in between versions. This should speed up many - large addressbook syncs sometimes up to 50%. -* The zip release ships with [sabre/vobject 4.1.0][vobj], - [sabre/http 4.2.1][http], [sabre/event 3.0.0][evnt], - [sabre/uri 1.1.0][uri] and [sabre/xml 1.4.2][xml]. - - -3.1.3 (2016-04-06) ------------------- - -* Set minimum libxml version to 2.7.0 in `composer.json`. -* #805: It wasn't possible to create calendars that hold events, journals and - todos using MySQL, because the `components` column was 1 byte too small. -* The zip release ships with [sabre/vobject 4.1.0][vobj], - [sabre/http 4.2.1][http], [sabre/event 3.0.0][evnt], - [sabre/uri 1.1.0][uri] and [sabre/xml 1.4.1][xml]. - - -3.1.2 (2016-03-12) ------------------- - -* #784: Sync logs for address books were not correctly cleaned up after - deleting them. -* #787: Cannot use non-seekable stream-wrappers with range requests. -* Faster XML parsing and generating due to sabre/xml update. -* #793: The Sqlite schema is now more strict and more similar to the MySQL - schema. This solves a problem within Baikal. -* The zip release ships with [sabre/vobject 4.0.3][vobj], - [sabre/http 4.2.1][http], [sabre/event 3.0.0][evnt], - [sabre/uri 1.1.0][uri] and [sabre/xml 1.4.1][xml]. - - -3.1.1 (2016-01-25) ------------------- - -* #755: The brower plugin and some operations would break when scheduling and - delegation would both be enabled. -* #757: A bunch of unittest improvements (@jakobsack). -* The zip release ships with [sabre/vobject 4.0.2][vobj], - [sabre/http 4.2.1][http], [sabre/event 3.0.0][evnt], - [sabre/uri 1.0.1][uri] and [sabre/xml 1.3.0][xml]. - - -3.1.0 (2016-01-06) ------------------- - -* Better error message when the browser plugin is not enabled. -* Added a super minimal server example. -* #730: Switched all mysql tables to `utf8mb4` character set, allowing you to - use emoji in some tables where you couldn't before. -* #710: Provide an Auth backend that acts as a helper for people implementing - OAuth2 Bearer token. (@fkooman). -* #729: Not all calls to `Sabre\DAV\Tree::getChildren()` were properly cached. -* #727: Added another workaround to make CalDAV work for Windows 10 clients. -* #742: Fixes to make sure that vobject 4 is correctly supported. -* #726: Better error reporting in `Client::propPatch`. We're now throwing - exceptions. -* #608: When a HTTP error is triggered during `Client:propFind`, we're now - throwing `Sabre\HTTP\ClientHttpException` instead of `Sabre\DAV\Exception`. - This new exception contains a LOT more information about the problem. -* #721: Events are now handled in the correct order for `COPY` requests. - Before this subtle bugs could appear that could cause data-loss. -* #747: Now throwing exceptions and setting the HTTP status to 500 in subtle - cases where no other plugin set a correct HTTP status. -* #686: Corrected PDO principal backend's findByURI for email addresses that - don't match the exact capitalization. -* #512: The client now has it's own `User-Agent`. -* #720: Some browser improvements. -* The zip release ships with [sabre/vobject 4.0.1][vobj], - [sabre/http 4.2.1][http], [sabre/event 3.0.0][evnt], - [sabre/uri 1.0.1][uri] and [sabre/xml 1.3.0][xml]. - - -3.1.0-alpha2 (2015-09-05) -------------------------- - -* Massive calendars and addressbooks should see a big drop in peak memory - usage. -* Fixed a privilege bug in the availability system. -* #697: Added a "tableName" member to the PropertyStorage PDO backend. (@Frzk). -* #699: PostgreSQL fix for the Locks PDO backend. (@TCKnet) -* Removed the `simplefsserver.php` example file. It's not simple enough. -* #703: PropPatch in client is not correctly encoded. -* #709: Throw exception when running into empty - `supported-calendar-component-set`. -* #711: Don't trigger deserializers for empty elements in `{DAV:}prop`. This - fixes issues when using sabre/dav as a client. -* The zip release ships with [sabre/vobject 4.0.0-alpha2][vobj], - [sabre/http 4.1.0][http], [sabre/event 2.0.2][evnt], - [sabre/uri 1.0.1][uri] and [sabre/xml 1.2.0][xml]. - - -3.1.0-alpha1 (2015-07-19) -------------------------- - -* Now requires PHP 5.5 -* Upgraded to vobject 4, which is a lot faster. -* Support for PHP 7. -* #690: Support for `calendar-availability`, draft 05. - [reference][calendar-availability]. -* #691: Workaround for broken Windows Phone client. -* The zip release ships with [sabre/vobject 4.0.0-alpha1][vobj], - [sabre/http 4.0.0][http], [sabre/event 2.0.2][evnt], - [sabre/uri 1.0.1][uri] and [sabre/xml 1.1.0][xml]. - - -3.0.10 (2016-??-??) ------------------- - -* #889 Added support for filtering vCard properties in the addressbook-query - REPORT (@DeepDiver1975). - - -3.0.9 (2016-04-06) ------------------- - -* Set minimum libxml version to 2.7.0 in `composer.json`. -* #727: Added another workaround to make CalDAV work for Windows 10 clients. -* #805: It wasn't possible to create calendars that hold events, journals and - todos using MySQL, because the `components` column was 1 byte too small. -* The zip release ships with [sabre/vobject 3.5.1][vobj], - [sabre/http 4.2.1][http], [sabre/event 2.0.2][evnt], - [sabre/uri 1.1.0][uri] and [sabre/xml 1.4.1][xml]. - - -3.0.8 (2016-03-12) ------------------- - -* #784: Sync logs for address books were not correctly cleaned up after - deleting them. -* #787: Cannot use non-seekable stream-wrappers with range requests. -* Faster XML parsing and generating due to sabre/xml update. -* The zip release ships with [sabre/vobject 3.5.0][vobj], - [sabre/http 4.2.1][http], [sabre/event 2.0.2][evnt], - [sabre/uri 1.1.0][uri] and [sabre/xml 1.4.1][xml]. - - -3.0.7 (2016-01-12) ------------------- - -* #752: PHP 7 support for 3.0 branch. (@DeepDiver1975) -* The zip release ships with [sabre/vobject 3.5.0][vobj], - [sabre/http 4.2.1][http], [sabre/event 2.0.2][evnt], - [sabre/uri 1.0.1][uri] and [sabre/xml 1.3.0][xml]. - - -3.0.6 (2016-01-04) ------------------- - -* #730: Switched all mysql tables to `utf8mb4` character set, allowing you to - use emoji in some tables where you couldn't before. -* #729: Not all calls to `Sabre\DAV\Tree::getChildren()` were properly cached. -* #734: Return `418 I'm a Teapot` when generating a multistatus response that - has resources with no returned properties. -* #740: Bugs in `migrate20.php` script. -* The zip release ships with [sabre/vobject 3.4.8][vobj], - [sabre/http 4.1.0][http], [sabre/event 2.0.2][evnt], - [sabre/uri 1.0.1][uri] and [sabre/xml 1.3.0][xml]. - - -3.0.5 (2015-09-15) ------------------- - -* #704: Fixed broken uri encoding in multistatus responses. This affected - at least CyberDuck, but probably also others. -* The zip release ships with [sabre/vobject 3.4.7][vobj], -* The zip release ships with [sabre/vobject 3.4.7][vobj], - [sabre/http 4.1.0][http], [sabre/event 2.0.2][evnt], - [sabre/uri 1.0.1][uri] and [sabre/xml 1.2.0][xml]. - - -3.0.4 (2015-09-06) ------------------- - -* #703: PropPatch in client is not correctly encoded. -* #709: Throw exception when running into empty - `supported-calendar-component-set`. -* #711: Don't trigger deserializers for empty elements in `{DAV:}prop`. This - fixes issues when using sabre/dav as a client. -* #705: A `MOVE` request that gets prevented from deleting the source resource - will still remove the target resource. Now all events are triggered before - any destructive operations. -* The zip release ships with [sabre/vobject 3.4.7][vobj], - [sabre/http 4.1.0][http], [sabre/event 2.0.2][evnt], - [sabre/uri 1.0.1][uri] and [sabre/xml 1.2.0][xml]. - - -3.0.3 (2015-08-06) ------------------- - -* #700: Digest Auth fails on `HEAD` requests. -* Fixed example files to no longer use now-deprecated realm argument. -* The zip release ships with [sabre/vobject 3.4.6][vobj], - [sabre/http 4.0.0][http], [sabre/event 2.0.2][evnt], - [sabre/uri 1.0.1][uri] and [sabre/xml 1.1.0][xml]. - - -3.0.2 (2015-07-21) ------------------- - -* #657: Migration script would break when coming a cross an iCalendar object - with no UID. -* #691: Workaround for broken Windows Phone client. -* Fixed a whole bunch of incorrect php docblocks. -* The zip release ships with [sabre/vobject 3.4.5][vobj], - [sabre/http 4.0.0][http], [sabre/event 2.0.2][evnt], - [sabre/uri 1.0.1][uri] and [sabre/xml 1.1.0][xml]. - - -3.0.1 (2015-07-02) ------------------- - -* #674: Postgres sql file fixes. (@davesouthey) -* #677: Resources with the name '0' would not get retrieved when using - `Depth: infinity` in a `PROPFIND` request. -* #680: Fix 'autoprefixing' of dead `{DAV:}href` properties. -* #675: NTLM support in DAV\Client. (@k42b3) -* The zip release ships with [sabre/vobject 3.4.5][vobj], - [sabre/http 4.0.0][http], [sabre/event 2.0.2][evnt], - [sabre/uri 1.0.1][uri] and [sabre/xml 1.1.0][xml]. - - -3.0.0 (2015-06-02) ------------------- - -* No changes since last beta. -* The zip release ships with [sabre/vobject 3.4.5][vobj], - [sabre/http 4.0.0][http], [sabre/event 2.0.2][evnt], - [sabre/uri 1.0.1][uri] and [sabre/xml 1.0.0][xml]. - - -3.0.0-beta3 (2015-05-29) ------------------------- - -* Fixed deserializing href properties with no value. -* Fixed deserializing `{DAV:}propstat` without a `{DAV:}prop`. -* #668: More information about vcf-export-plugin in browser plugin. -* #669: Add export button to browser plugin for address books. (@mgee) -* #670: multiget report hrefs were not decoded. -* The zip release ships with [sabre/vobject 3.4.4][vobj], - [sabre/http 4.0.0][http], [sabre/event 2.0.2][evnt], - [sabre/uri 1.0.1][uri] and [sabre/xml 1.0.0][xml]. - - -3.0.0-beta2 (2015-05-27) ------------------------- - -* A node's properties should not overwrite properties that were already set. -* Some uris were not correctly encoded in notifications. -* The zip release ships with [sabre/vobject 3.4.4][vobj], - [sabre/http 4.0.0][http], [sabre/event 2.0.2][evnt], - [sabre/uri 1.0.1][uri] and [sabre/xml 1.0.0][xml]. - - -3.0.0-beta1 (2015-05-25) ------------------------- - -* `migrate22.php` is now called `migrate30.php`. -* Using php-cs-fixer for automated coding standards enforcement and fixing. -* #660: principals could break html output. -* #662: Fixed several bugs in the `share` request parser. -* #665: Fix a bug in serialization of complex properties in the proppatch - request in the client. -* #666: expand-property report did not correctly prepend the base uri when - generating uris, this caused delegation to break. -* #659: Don't throw errors when when etag-related checks are done on - collections. -* Fully supporting the updated `Prefer` header syntax, as defined in - [rfc7240][rfc7240]. -* The zip release ships with [sabre/vobject 3.4.3][vobj], - [sabre/http 4.0.0][http], [sabre/event 2.0.2][evnt], - [sabre/uri 1.0.1][uri] and [sabre/xml 1.0.0][xml]. - - -3.0.0-alpha1 (2015-05-19) -------------------------- - -* It's now possible to get all property information from files using the - browser plugin. -* Browser plugin will now show a 'calendar export' button when the - ics-export plugin is enabled. -* Some nodes that by default showed the current time as their last - modification time, now no longer has a last modification time. -* CardDAV namespace was missing from default namespaceMap. -* #646: Properties can now control their own HTML output in the browser plugin. -* #646: Nicer HTML output for the `{DAV:}acl` property. -* Browser plugin no longer shows a few properties that take up a lot of space, - but are likely not really interesting for most users. -* #654: Added a collection, `Sabre\DAVACL\FS\HomeCollection` for automatically - creating a private home collection per-user. -* Changed all MySQL columns from `VARCHAR` to `VARBINARY` where possible. -* Improved older migration scripts a bit to allow easier testing. -* The zip release ships with [sabre/vobject 3.4.3][vobj], - [sabre/http 4.0.0-alpha3][http], [sabre/event 2.0.2][evnt], - [sabre/uri 1.0.1][uri] and [sabre/xml 0.4.3][xml]. - - -2.2.0-alpha4 (2015-04-13) -------------------------- - -* Complete rewrite of the XML system. We now use our own [sabre/xml][xml], - which has a much smarter XML Reader and Writer. -* BC Break: It's no longer possible to instantiate the Locks plugin without - a locks backend. I'm not sure why this ever made sense. -* Simplified the Locking system and fixed a bug related to if tokens checking - locks unrelated to the current request. -* `FSExt` Directory and File no longer do custom property storage. This - functionality is already covered pretty well by the `PropertyStorage` plugin, - so please switch. -* Renamed `Sabre\CardDAV\UserAddressBooks` to `Sabre\CardDAV\AddressBookHome` - to be more consistent with `CalendarHome` as well as the CardDAV - specification. -* `Sabre\DAV\IExtendedCollection` now receives a `Sabre\DAV\MkCol` object as - its second argument, and no longer receives seperate properties and - resourcetype arguments. -* `MKCOL` now integrates better with propertystorage plugins. -* #623: Remove need of temporary files when working with Range requests. - (@dratini0) -* The zip release ships with [sabre/vobject 3.4.2][vobj], - [sabre/http 4.0.0-alpha1][http], [sabre/event 2.0.1][evnt], - [sabre/uri 1.0.0][uri] and [sabre/xml 0.4.3][xml]. - - -2.2.0-alpha3 (2015-02-25) -------------------------- - -* Contains all the changes introduced between 2.1.2 and 2.1.3. -* The zip release ships with [sabre/vobject 3.4.2][vobj], - [sabre/http 4.0.0-alpha1][http], [sabre/event 2.0.1][evnt] and - [sabre/uri 1.0.0][uri]. - - -2.2.0-alpha2 (2015-01-09) -------------------------- - -* Renamed `Sabre\DAV\Auth\Backend\BackendInterface::requireAuth` to - `challenge`, which is a more correct and better sounding name. -* The zip release ships with [sabre/vobject 3.3.5][vobj], - [sabre/http 3.0.4][http], [sabre/event 2.0.1][evnt]. - - -2.2.0-alpha1 (2014-12-10) -------------------------- - -* The browser plugin now has a new page with information about your sabredav - server, and shows information about every plugin that's loaded in the - system. -* #191: The Authentication system can now support multiple authentication - backends. -* Removed: all `$tableName` arguments from every PDO backend. This was already - deprecated, but has now been fully removed. All of these have been replaced - with public properties. -* Deleted several classes that were already deprecated much earlier: - * `Sabre\CalDAV\CalendarRootNode` - * `Sabre\CalDAV\UserCalendars` - * `Sabre\DAV\Exception\FileNotFound` - * `Sabre\DAV\Locks\Backend\FS` - * `Sabre\DAV\PartialUpdate\IFile` - * `Sabre\DAV\URLUtil` -* Removed: `Sabre\DAV\Client::addTrustedCertificates` and - `Sabre\DAV\Client::setVerifyPeer`. -* Removed: `Sabre\DAV\Plugin::getPlugin()` can now no longer return plugins - based on its class name. -* Removed: `Sabre\DAVACL\Plugin::getPrincipalByEmail()`. -* #560: GuessContentType plugin will now set content-type to - `application/octet-stream` if a better content-type could not be determined. -* #568: Added a `componentType` argument to `ICSExportPlugin`, allowing you to - specifically fetch `VEVENT`, `VTODO` or `VJOURNAL`. -* #582: Authentication backend interface changed to be stateless. If you - implemented your own authentication backend, make sure you upgrade your class - to the latest API! -* #582: `Sabre\DAV\Auth\Plugin::getCurrentUser()` is now deprecated. Use - `Sabre\DAV\Auth\Plugin::getCurrentPrincipal()` instead. -* #193: Fix `Sabre\DAV\FSExt\Directory::getQuotaInfo()` on windows. - - -2.1.11 (2016-10-06) -------------------- - -* #805: It wasn't possible to create calendars that hold events, journals and - todos using MySQL, because the `components` column was 1 byte too small. -* The zip release ships with [sabre/vobject 3.5.3][vobj], - [sabre/http 3.0.5][http], and [sabre/event 2.0.2][evnt]. - - -2.1.10 (2016-03-10) -------------------- - -* #784: Sync logs for address books were not correctly cleaned up after - deleting them. -* The zip release ships with [sabre/vobject 3.5.0][vobj], - [sabre/http 3.0.5][http], and [sabre/event 2.0.2][evnt]. - - -2.1.9 (2016-01-25) ------------------- - -* #674: PHP7 support (@DeepDiver1975). -* The zip release ships with [sabre/vobject 3.5.0][vobj], - [sabre/http 3.0.5][http], and [sabre/event 2.0.2][evnt]. - - -2.1.8 (2016-01-04) ------------------- - -* #729: Fixed a caching problem in the Tree object. -* #740: Bugs in `migrate20.php` script. -* The zip release ships with [sabre/vobject 3.4.8][vobj], - [sabre/http 3.0.5][http], and [sabre/event 2.0.2][evnt]. - - -2.1.7 (2015-09-05) ------------------- - -* #705: A `MOVE` request that gets prevented from deleting the source resource - will still remove the target resource. Now all events are triggered before - any destructive operations. -* The zip release ships with [sabre/vobject 3.4.7][vobj], - [sabre/http 3.0.5][http], and [sabre/event 2.0.2][evnt]. - - -2.1.6 (2015-07-21) ------------------- - -* #657: Migration script would break when coming a cross an iCalendar object - with no UID. -* #691: Workaround for broken Windows Phone client. -* The zip release ships with [sabre/vobject 3.4.5][vobj], - [sabre/http 3.0.5][http], and [sabre/event 2.0.2][evnt]. - - -2.1.5 (2015-07-11) ------------------- - -* #677: Resources with the name '0' would not get retrieved when using - `Depth: infinity` in a `PROPFIND` request. -* The zip release ships with [sabre/vobject 3.4.5][vobj], - [sabre/http 3.0.5][http], and [sabre/event 2.0.2][evnt]. - - -2.1.4 (2015-05-25) ------------------- - -* #651: Double-encoded path in the browser plugin. Should fix a few broken - links in some setups. -* #650: Correctly cleaning up change info after deleting calendars (@ErrOrnAmE). -* #658: Updating `schedule-calendar-default-URL` does not work well, so we're - disabling it until there's a better fix. -* The zip release ships with [sabre/vobject 3.4.3][vobj], - [sabre/http 3.0.5][http], and [sabre/event 2.0.2][evnt]. - - -2.1.3 (2015-02-25) ------------------- - -* #586: `SCHEDULE-STATUS` should not contain a reason-phrase. -* #539: Fixed a bug related to scheduling in shared calendars. -* #595: Support for calendar-timezone in iCalendar exports. -* #581: findByUri would send empty prefixes to the principal backend (@soydeedo) -* #611: Escaping a bit more HTML output in the browser plugin. (@LukasReschke) -* #610: Don't allow discovery of arbitrary files using `..` in the browser - plugin (@LukasReschke). -* Browser plugin now shows quota properties. -* #612: PropertyStorage didn't delete properties from nodes when a node's - parents get deleted. -* #581: Fixed problems related to finding attendee information during - scheduling. -* The zip release ships with [sabre/vobject 3.4.2][vobj], - [sabre/http 3.0.4][http], and [sabre/event 2.0.1][evnt]. - - -2.1.2 (2014-12-10) ------------------- - -* #566: Another issue related to the migration script, which would cause - scheduling to not work well for events that were already added before the - migration. -* #567: Doing freebusy requests on accounts that had 0 calendars would throw - a `E_NOTICE`. -* #572: `HEAD` requests trigger a PHP warning. -* #579: Browser plugin can throw exception for a few resourcetypes that didn't - have an icon defined. -* The zip release ships with [sabre/vobject 3.3.4][vobj], - [sabre/http 3.0.4][http], and [sabre/event 2.0.1][evnt]. - - -2.1.1 (2014-11-22) ------------------- - -* #561: IMip Plugin didn't strip mailto: from email addresses. -* #566: Migration process had 2 problems related to adding the `uid` field - to the `calendarobjects` table. -* The zip release ships with [sabre/vobject 3.3.4][vobj], - [sabre/http 3.0.2][http], and [sabre/event 2.0.1][evnt]. - - -2.1.0 (2014-11-19) ------------------- - -* #541: CalDAV PDO backend didn't respect overridden PDO table names. -* #550: Scheduling invites are no longer delivered into shared calendars. -* #554: `calendar-multiget` `REPORT` did not work on inbox items. -* #555: The `calendar-timezone` property is now respected for floating times - and all-day events in the `calendar-query`, `calendar-multiget` and - `free-busy-query` REPORTs. -* #555: The `calendar-timezone` property is also respected for scheduling - free-busy requests. -* #547: CalDAV system too aggressively 'corrects' incoming iCalendar data, and - as a result doesn't return an etag for common cases. -* The zip release ships with [sabre/vobject 3.3.4][vobj], - [sabre/http 3.0.2][http], and [sabre/event 2.0.1][evnt]. - - -2.1.0-alpha2 (2014-10-23) -------------------------- - -* Added: calendar-user-address-set to default principal search properties - list. This should fix iOS attendee autocomplete support. -* Changed: Moved all 'notifications' functionality from `Sabre\CalDAV\Plugin` - to a new plugin: `Sabre\CalDAV\Notifications\Plugin`. If you want to use - notifications-related functionality, just add this plugin. -* Changed: Accessing the caldav inbox, outbox or notification collection no - longer triggers getCalendarsForUser() on backends. -* #533: New invites are no longer delivered to taks-only calendars. -* #538: Added `calendarObjectChange` event. -* Scheduling speedups. -* #539: added `afterResponse` event. (@joserobleda) -* Deprecated: All the "tableName" constructor arguments for all the PDO - backends are now deprecated. They still work, but will be removed in the - next major sabredav version. Every argument that is now deprecated can now - be accessed as a public property on the respective backends. -* #529: Added getCalendarObjectByUID to PDO backend, speeding up scheduling - operations on large calendars. -* The zip release ships with [sabre/vobject 3.3.3][vobj], - [sabre/http 3.0.2][http], and [sabre/event 2.0.1][evnt]. - - -2.1.0-alpha1 (2014-09-23) -------------------------- - -* Added: Support for [rfc6638][rfc6638], also known as CalDAV Scheduling. -* Added: Automatically converting between vCard 3, 4 and jCard using the - `Accept:` header, in CardDAV reports, and automatically converting from - jCard to vCard upon `PUT`. It's important to note that your backends _may_ - now receive both vCard 3.0 and 4.0. -* Added: #444. Collections can now opt-in to support high-speed `MOVE`. -* Changed: PropertyStorage backends now have a `move` method. -* Added: `beforeMove`, and `afterMove` events. -* Changed: A few database changes for the CalDAV PDO backend. Make sure you - run `bin/migrate21.php` to upgrade your database schema. -* Changed: CalDAV backends have a new method: `getCalendarObjectByUID`. This - method MUST be implemented by all backends, but the `AbstractBackend` has a - simple default implementation for this. -* Changed: `Sabre\CalDAV\UserCalendars` has been renamed to - `Sabre\CalDAV\CalendarHome`. -* Changed: `Sabre\CalDAV\CalendarRootNode` has been renamed to - `Sabre\CalDAV\CalendarRoot`. -* Changed: The IMipHandler has been completely removed. With CalDAV scheduling - support, it is no longer needed. It's functionality has been replaced by - `Sabre\CalDAV\Schedule\IMipPlugin`, which can now send emails for clients - other than iCal. -* Removed: `Sabre\DAV\ObjectTree` and `Sabre\DAV\Tree\FileSystem`. All this - functionality has been merged into `Sabre\DAV\Tree`. -* Changed: PrincipalBackend now has a findByUri method. -* Changed: `PrincipalBackend::searchPrincipals` has a new optional `test` - argument. -* Added: Support for the `{http://calendarserver.org/ns/}email-address-set` - property. -* #460: PropertyStorage must move properties during `MOVE` requests. -* Changed: Restructured the zip distribution to be a little bit more lean - and consistent. -* #524: Full support for the `test="anyof"` attribute in principal-search - `REPORT`. -* #472: Always returning lock tokens in the lockdiscovery property. -* Directory entries in the Browser plugin are sorted by type and name. - (@aklomp) -* #486: It's now possible to return additional properties when an 'allprop' - PROPFIND request is being done. (@aklomp) -* Changed: Now return HTTP errors when an addressbook-query REPORT is done - on a uri that's not a vcard. This should help with debugging this common - mistake. -* Changed: `PUT` requests with a `Content-Range` header now emit a 400 status - instead of 501, as per RFC7231. -* Added: Browser plugin can now display the contents of the - `{DAV:}supported-privilege-set` property. -* Added: Now reporting `CALDAV:max-resource-size`, but we're not actively - restricting it yet. -* Changed: CalDAV plugin is now responsible for reporting - `CALDAV:supported-collation-set` and `CALDAV:supported-calendar-data` - properties. -* Added: Now reporting `CARDDAV:max-resource-size`, but we're not actively - restricting it yet. -* Added: Support for `CARDDAV:supported-collation-set`. -* Changed: CardDAV plugin is now responsible for reporting - `CARDDAV:supported-address-data`. This functionality has been removed from - the CardDAV PDO backend. -* When a REPORT is not supported, we now emit HTTP error 415, instead of 403. -* #348: `HEAD` requests now work wherever `GET` also works. -* Changed: Lower priority for the iMip plugins `schedule` event listener. -* Added: #523 Custom CalDAV backends can now mark any calendar as read-only. -* The zip release ships with [sabre/vobject 3.3.3][vobj], - [sabre/http 3.0.0][http], and [sabre/event 2.0.0][evnt]. - - -2.0.9 (2015-09-04) ------------------- - -* #705: A `MOVE` request that gets prevented from deleting the source resource - will still remove the target resource. Now all events are triggered before - any destructive operations. -* The zip release ships with [sabre/vobject 3.4.6][vobj], - [sabre/http 2.0.4][http], and [sabre/event 1.0.1][evnt]. - - - -2.0.8 (2015-07-11) ------------------- - -* #677: Resources with the name '0' would not get retrieved when using - `Depth: infinity` in a `PROPFIND` request. -* The zip release ships with [sabre/vobject 3.3.5][vobj], - [sabre/http 2.0.4][http], and [sabre/event 1.0.1][evnt]. - - -2.0.7 (2015-05-25) ------------------- - -* #650: Correctly cleaning up change info after deleting calendars (@ErrOrnAmE). -* The zip release ships with [sabre/vobject 3.3.4][vobj], - [sabre/http 2.0.4][http], and [sabre/event 1.0.1][evnt]. - - -2.0.6 (2014-12-10) ------------------- - -* Added `Sabre\CalDAV\CalendarRoot` as an alias for - `Sabre\CalDAV\CalendarRootNode`. The latter is going to be deprecated in 2.1, - so this makes it slightly easier to write code that works in both branches. -* #497: Making sure we're initializing the sync-token field with a value after - migration. -* The zip release ships with [sabre/vobject 3.3.4][vobj], - [sabre/http 2.0.4][http], and [sabre/event 1.0.1][evnt]. - - -2.0.5 (2014-10-14) ------------------- - -* #514: CalDAV PDO backend didn't work when overriding the 'calendar changes' - database table name. -* #515: 304 status code was not being sent when checking preconditions. -* The zip release ships with [sabre/vobject 3.3.3][vobj], - [sabre/http 2.0.4][http], and [sabre/event 1.0.1][evnt]. - - -2.0.4 (2014-08-27) ------------------- - -* #483: typo in calendars creation for PostgreSQL. -* #487: Locks are now automatically removed after a node has been deleted. -* #496: Improve CalDAV and CardDAV sync when there is no webdav-sync support. -* Added: Automatically mapping internal sync-tokens to getctag. -* The zip release ships with [sabre/vobject 3.3.1][vobj], - [sabre/http 2.0.4][http], and [sabre/event 1.0.1][evnt]. - - -2.0.3 (2014-07-14) ------------------- - -* #474: Fixed PropertyStorage `pathFilter()`. -* #476: CSP policy incorrect, causing stylesheets to not load in the browser - plugin. -* #475: Href properties in the browser plugin sometimes included a backslash. -* #478: `TooMuchMatches` exception never worked. This was fixed, and we also - took this opportunity to rename it to `TooManyMatches`. -* The zip release ships with [sabre/vobject 3.2.4][vobj], - [sabre/http 2.0.4][http], and [sabre/event 1.0.1][evnt]. - - -2.0.2 (2014-06-12) ------------------- - -* #470: Fixed compatibility with PHP < 5.4.14. -* #467: Fixed a problem in `examples/calendarserver.php`. -* #466: All the postgresql sample files have been updated. -* Fixed: An error would be thrown if a client did a propfind on a node the - user didn't have access to. -* Removed: Old and broken example code from the `examples/` directory. -* The zip release ships with [sabre/vobject 3.2.3][vobj], - [sabre/http 2.0.3][http], and [sabre/event 1.0.1][evnt]. - - -2.0.1 (2014-05-28) ------------------- - -* #459: PROPFIND requests on Files with no Depth header would return a fatal - error. -* #464: A PROPFIND allprops request should not return properties with status - 404. -* The zip release ships with [sabre/vobject 3.2.2][vobj], - [sabre/http 2.0.3][http], and [sabre/event 1.0.0][evnt]. - - -2.0.0 (2014-05-22) ------------------- - -* The zip release ships with [sabre/vobject 3.2.2][vobj], - [sabre/http 2.0.3][http], and [sabre/event 1.0.0][evnt]. -* Fixed: #456: Issue in sqlite migration script. -* Updated: MySQL database schema optimized by using more efficient column types. -* Cleaned up browser design. - - -2.0.0-beta1 (2014-05-15) -------------------------- - -* The zip release ships with [sabre/vobject 3.2.2][vobj], - [sabre/http 2.0.3][http], and [sabre/event 1.0.0][evnt]. -* BC Break: Property updating and fetching got refactored. Read the [migration - document][mi20] for more information. This allows for creation of a generic - property storage, and other property-related functionality that was not - possible before. -* BC Break: Removed `propertyUpdate`, `beforeGetProperties` and - `afterGetProperties` events. -* Fixed: #413: Memory optimizations for the CardDAV PDO backend. -* Updated: Brand new browser plugin with more debugging features and a design - that is slightly less painful. -* Added: Support for the `{DAV:}supported-method-set` property server-wide. -* Making it easier for implementors to override how the CardDAV addressbook - home is located. -* Fixed: Issue #422 Preconditions were not being set on PUT on non-existent - files. Not really a chance for data-loss, but incorrect nevertheless. -* Fixed: Issue #428: Etag check with `If:` fails if the target is a collection. -* Fixed: Issues #430, #431, #433: Locks plugin didn't not properly release - filesystem based locks. -* Fixed: #443. Support for creating new calendar subscriptions for OS X 10.9.2 - and up. -* Removed: `Sabre\DAV\Server::NODE_*` constants. -* Moved all precondition checking into a central place, instead of having to - think about it on a per-method basis. -* jCal transformation for calendar-query REPORT now works again. -* Switched to PSR-4 -* Fixed: #175. Returning ETag header upon a failed `If-Match` or - `If-None-Match` check. -* Removed: `lib/Sabre/autoload.php`. Use `vendor/autoload.php` instead. -* Removed: all the rfc documentation from the sabre/dav source. This made the - package needlessly larger. -* Updated: Issue #439. Lots of updates in PATCH support. The - Sabre_DAV_PartialUpdate_IFile interface is now deprecated and will be - removed in a future version. -* Added: `Sabre\DAV\Exception\LengthRequired`. - -1.9.0-alpha2 (2014-01-14) -------------------------- - -* The zip release ships with sabre/vobject 3.1.3, sabre/http 2.0.1, and - sabre/event 1.0.0. -* Added: Browser can now inspect any node, if ?sabreaction=browser is appended. -* Fixed: Issue #178. Support for multiple items in the Timeout header. -* Fixed: Issue #382. Stricter checking if calendar-query is allowed to run. -* Added: Depth: Infinity support for PROPFIND request. Thanks Thomas Müller and - Markus Goetz. - - -1.9.0-alpha1 (2013-11-07) -------------------------- - -* The zip release ships with sabre/vobject 3.1.3, sabre/http 2.0.0alpha5, and - sabre/event 1.0.0. -* BC Break: The CardDAV and CalDAV BackendInterface each have a new method: - getMultipleCards and getMultipleCalendarObjects. The Abstract and PDO backends - have default implementations, but if you implement that interface directly, - this method is now required. -* BC Break: XML property classes now receive an extra argument in their - unserialize method ($propertyMap). This allows for recursively parsing - properties, if needed. -* BC Break: Now using sabre/event for event emitting/subscription. For plugin - authors this means Server::subscribeEvent is now Server::on, and - Server::broadcastEvent is now Server::emit. -* BC Break: Almost all core functionality moved into a CorePlugin. -* BC Break: Most events triggered by the server got an overhaul. -* Changed: Sabre\HTTP now moved into a dedicated sabre/http package. -* Added: Support for WebDAV-sync (rfc6578). -* Added: Support for caldav-subscriptions, which is an easy way for caldav - clients to manage a list of subscriptions on the server. -* Added: Support for emitting and receiving jCal instead of iCalendar for - CalDAV. -* Added: BasicCallback authenticaton backend, for creating simple authentication - systems without having to define any classes. -* Added: A $transactionType property on the server class. This can be used for - logging and performance measuring purposes. -* Fixed: If event handlers modify the request body from a PUT request, an ETag - is no longer sent back. -* Added: Sabre\DAV\IMultiGet to optimize requests that retrieve information - about lists of resources. -* Added: MultiGet support to default CalDAV and CardDAV backends, speeding up - the multiget and sync reports quite a bit! -* Added: ICSExportPlugin can now generate jCal, filter on time-ranges and expand - recurrences. -* Fixed: Read-only access to calendars still allows the sharee to modify basic - calendar properties, such as the displayname and color. -* Changed: The default supportedPrivilegeSet has changed. Most privileges are no - longer marked as abstract. -* Changed: More elegant ACL management for CalendarObject and Card nodes. -* Added: Browser plugin now marks a carddav directory as type Directory, and a - shared calendar as 'Shared'. -* Added: When debugExceptions is turned on, all previous exceptions are also - traversed. -* Removed: Got rid of the Version classes for CalDAV, CardDAV, HTTP, and DAVACL. - Now that there's no separate packages anymore, this makes a bit more sense. -* Added: Generalized the multistatus response parser a bit more, for better - re-use. -* Added: Sabre\DAV\Client now has support for complex properties for PROPPATCH. - (Issue #299). -* Added: Sabre\DAV\Client has support for gzip and deflate encoding. -* Added: Sabre\DAV\Client now has support for sending objects as streams. -* Added: Deserializer for {DAV:}current-user-privilege-set. -* Added: Addressbooks or backends can now specify custom acl rules when creating - cards. -* Added: The ability for plugins to validate custom tokens in If: headers. -* Changed: Completely refactored the Lock plugin to deal with the new If: header - system. -* Added: Checking preconditions for MOVE, COPY, DELETE and PROPPATCH methods. -* Added: has() method on DAV\Property\SupportedReportSet. -* Added: If header now gets checked (with ETag) all the time. Before the dealing - with the If-header was a responsibility of the Locking plugin. -* Fixed: Outbox access for delegates. -* Added: Issue 333: It's now possible to override the calendar-home in the - CalDAV plugin. -* Added: A negotiateContentType to HTTP\Request. A convenience method. -* Fixed: Issue 349: Denying copying or moving a resource into it's own subtree. -* Fixed: SabreDAV catches every exception again. -* Added: Issue #358, adding a component=vevent parameter to the content-types - for calendar objects, if the caldav backend provides this info. - - -1.8.12-stable (2015-01-21) --------------------------- - -* The zip release ships with sabre/vobject 2.1.7. -* #568: Support empty usernames and passwords in basic auth. - - -1.8.11 (2014-12-10) -------------------- - -* The zip release ships with sabre/vobject 2.1.6. -* Updated: MySQL database schema optimized by using more efficient column types. -* #516: The DAV client will now only redirect to HTTP and HTTPS urls. - - -1.8.10 (2014-05-15) -------------------- - -* The zip release ships with sabre/vobject 2.1.4. -* includes changes from version 1.7.12. - - -1.8.9 (2014-02-26) ------------------- - -* The zip release ships with sabre/vobject 2.1.3. -* includes changes from version 1.7.11. - - -1.8.8 (2014-02-09) ------------------- - -* includes changes from version 1.7.10. -* The zip release ships with sabre/vobject 2.1.3. - -1.8.7 (2013-10-02) ------------------- - -* the zip release ships with sabre/vobject 2.1.3. -* includes changes from version 1.7.9. - - -1.8.6 (2013-06-18) ------------------- - -* The zip release ships with sabre/vobject 2.1.0. -* Includes changes from version 1.7.8. - - -1.8.5 (2013-04-11) ------------------- - -* The zip release ships with sabre/vobject 2.0.7. -* Includes changes from version 1.7.7. - - -1.8.4 (2013-04-08) ------------------- - -* The zip release ships with sabre/vobject 2.0.7. -* Includes changes from version 1.7.6. - - -1.8.3 (2013-03-01) ------------------- - -* The zip release ships with sabre/vobject 2.0.6. -* Includes changes from version 1.7.5. -* Fixed: organizer email-address for shared calendars is now prefixed with - mailto:, as it should. - - -1.8.2 (2013-01-19) ------------------- - -* The zip release ships with sabre/vobject 2.0.5. -* Includes changes from version 1.7.4. - - -1.8.1 (2012-12-01) ------------------- - -* The zip release ships with sabre/vobject 2.0.5. -* Includes changes from version 1.7.3. -* Fixed: Typo in 1.7 migration script caused it to fail. - - -1.8.0 (2012-11-08) ------------------- - -* The zip release ships with sabre/vobject 2.0.5. -* BC Break: Moved the entire codebase to PHP namespaces. -* BC Break: Every backend package (CalDAV, CardDAV, Auth, Locks, Principals) now - has consistent naming conventions. There's a BackendInterface, and an - AbstractBackend class. -* BC Break: Changed a bunch of constructor signatures in the CalDAV package, to - reduce dependencies on the ACL package. -* BC Break: Sabre_CalDAV_ISharedCalendar now also has a getShares method, so - sharees can figure out who is also on a shared calendar. -* Added: Sabre_DAVACL_IPrincipalCollection interface, to advertise support for - principal-property-search on any node. -* Added: Simple console script to fire up a fileserver in the current directory - using PHP 5.4's built-in webserver. -* Added: Sharee's can now also read out the list of invites for a shared - calendar. -* Added: The Proxy principal classes now both implement an interface, for - greater flexibility. - - -1.7.13 (2014-07-28) -------------------- - -* The zip release ships with sabre/vobject 2.1.4. -* Changed: Removed phing and went with a custom build script for now. - - -1.7.12 (2014-05-15) -------------------- - -* The zip release ships with sabre/vobject 2.1.4. -* Updated: Issue #439. Lots of updates in PATCH support. The - Sabre_DAV_PartialUpdate_IFile interface is now deprecated and will be removed - in a future version. -* Fixed: Restoring old setting after changing libxml_disable_entity_loader. -* Fixed: Issue #422: Preconditions were not being set on PUT on non-existent - files. Not really a chance for data-loss, but incorrect nevertheless. -* Fixed: Issue #427: Now checking preconditions on DELETE requests. -* Fixed: Issue #428: Etag check with If: fails if the target is a collection. -* Fixed: Issue #393: PATCH request with missing end-range was handled - incorrectly. -* Added: Sabre_DAV_Exception_LengthRequired to omit 411 errors. - - -1.7.11 (2014-02-26) -------------------- - -* The zip release ships with sabre/vobject 2.1.3. -* Fixed: Issue #407: large downloads failed. -* Fixed: Issue #414: XXE security problem on older PHP versions. - - -1.7.10 (2014-02-09) -------------------- - -* Fixed: Issue #374: Don't urlescape colon (:) when it's not required. -* Fixed: Potential security vulnerability in the http client. - - -1.7.9 (2013-10-02) ------------------- - -* The zip release ships with sabre/vobject 2.1.3. -* Fixed: Issue #365. Incorrect output when principal urls have spaces in them. -* Added: Issue #367: Automatically adding a UID to vcards that don't have them. - - -1.7.8 (2013-06-17) ------------------- - -* The zip release ships with sabre/vobject 2.1.0. -* Changed: Sabre\DAV\Client::verifyPeer is now a protected property (instead of - private). -* Fixed: Text was incorrectly escaped in the Href and HrefList properties, - disallowing urls with ampersands (&) in them. -* Added: deserializer for Sabre\DAVACL\Property\CurrentUserPrivilegeSet. -* Fixed: Issue 335: Client only deserializes properties with status 200. -* Fixed: Issue 341: Escaping xml in 423 Locked error responses. -* Added: Issue 339: beforeGetPropertiesForPath event. - - -1.7.7 (2013-04-11) ------------------- - -* The zip release ships with sabre/vobject 2.0.7. -* Fixed: Assets in the browser plugins were not being served on windows - machines. - - -1.7.6 (2013-04-08) ------------------- - -* The zip release ships with sabre/vobject 2.0.7. -* Fixed: vcardurl in database schema can now hold 255 characters instead of 80 - (which is often way to small). -* Fixed: The browser plugin potentially allowed people to open any arbitrary - file on windows servers (CVE-2013-1939). - - -1.7.5 (2013-03-01) ------------------- - -* The zip release ships with sabre/vobject 2.0.6. -* Change: No longer advertising support for 4.0 vcards. iOS and OS X address - book don't handle this well, and just advertising 3.0 support seems like the - most logical course of action. -* Added: ->setVerifyPeers to Sabre_DAV_Client (greatly resisting against it, - don't use this..). - - -1.7.4 (2013-01-19) ------------------- - -* The zip release ships with sabre/vobject 2.0.5. -* Changed: To be compatible with MS Office 2011 for Mac, a workaround was - removed that was added to support old versions of Windows XP (pre-SP3). - Indeed! We needed a crazy workaround to work with one MS product in the past, - and we can't keep that workaround to be compatible with another MS product. -* Fixed: expand-properties REPORT had incorrect values for the href element. -* Fixed: Range requests now work for non-seekable streams. (Thanks Alfred - Klomp). -* Fixed: Changed serialization of {DAV:}getlastmodified and {DAV:}supportedlock - to improve compatibility with MS Office 2011 for Mac. -* Changed: reverted the automatic translation of 'DAV:' xml namespaces to - 'urn:DAV' when parsing files. Issues were reported with libxml 2.6.32, on a - relatively recent debian release, so we'll wait till 2015 to take this one out - again. -* Added: Sabre_DAV_Exception_ServiceUnavailable, for emitting 503's. - - -1.7.3 (2012-12-01) ------------------- - -* The zip release ships with sabre/vobject 2.0.5. -* Fixed: Removing double slashes from getPropertiesForPath. -* Change: Marked a few more properties in the CardDAV as protected, instead of - private. -* Fixed: SharingPlugin now plays nicer with other plugins with similar - functionality. -* Fixed: Issue 174. Sending back HTTP/1.0 for requests with this version. - - -1.7.2 (2012-11-08) ------------------- - -* The zip release ships with sabre/vobject 2.0.5. -* Added: ACL plugin advertises support for 'calendarserver-principal- - property-search'. -* Fixed: [#153] Allowing for relative http principals in iMip requests. -* Added: Support for cs:first-name and cs:last-name properties in sharing - invites. -* Fixed: Made a bunch of properties protected, where they were private before. -* Added: Some non-standard properties for sharing to improve compatibility. -* Fixed: some bugfixes in postgres sql script. -* Fixed: When requesting some properties using PROPFIND, they could show up as - both '200 Ok' and '403 Forbidden'. -* Fixed: calendar-proxy principals were not checked for deeper principal - membership than 1 level. -* Fixed: setGroupMemberSet argument now correctly receives relative principal - urls, instead of the absolute ones. -* Fixed: Server class will filter out any bonus properties if any extra were - returned. This means the implementor of the IProperty class can be a bit - lazier when implementing. Note: bug numbers after this line refer to Google - Code tickets. We're using github now. - - -1.7.1 (2012-10-07) ------------------- - -* Fixed: include path problem in the migration script. - - -1.7.0 (2012-10-06) ------------------- - -* BC Break: The calendarobjects database table has a bunch of new fields, and a - migration script is required to ensure everything will keep working. Read the - wiki for more details. -* BC Break: The ICalendar interface now has a new method: calendarQuery. -* BC Break: In this version a number of classes have been deleted, that have - been previously deprecated. Namely: - Sabre_DAV_Directory (now: - Sabre_DAV_Collection) - Sabre_DAV_SimpleDirectory (now: - Sabre_DAV_SimpleCollection) -* BC Break: Sabre_CalDAV_Schedule_IMip::sendMessage now has an extra argument. - If you extended this class, you should fix this method. It's only used for - informational purposes. -* BC Break: The DAV: namespace is no longer converted to urn:DAV. This was a - workaround for a bug in older PHP versions (pre-5.3). -* Removed: Sabre.includes.php was deprecated, and is now removed. -* Removed: Sabre_CalDAV_Server was deprecated, and is now removed. Please use - Sabre_DAV_Server and check the examples in the examples/ directory. -* Changed: The Sabre_VObject library now spawned into it's own project! The - VObject library is still included in the SabreDAV zip package. -* Added: Experimental interfaces to allow implementation of caldav-sharing. Note - that no implementation is provided yet, just the api hooks. -* Added: Free-busy reporting compliant with the caldav-scheduling standard. This - allows iCal and other clients to fetch other users' free-busy data. -* Added: Experimental NotificationSupport interface to add caldav notifications. -* Added: VCF Export plugin. If enabled, it can generate an export of an entire - addressbook. -* Added: Support for PATCH using a SabreDAV format, to live-patch files. -* Added: Support for Prefer: return-minimal and Brief: t headers for PROPFIND - and PROPPATCH requests. -* Changed: Responsibility for dealing with the calendar-query is now moved from - the CalDAV plugin to the CalDAV backends. This allows for heavy optimizations. -* Changed: The CalDAV PDO backend is now a lot faster for common calendar - queries. -* Changed: We are now using the composer autoloader. -* Changed: The CalDAV backend now all implement an interface. -* Changed: Instead of Sabre_DAV_Property, Sabre_DAV_PropertyInterface is now the - basis of every property class. -* Update: Caching results for principal lookups. This should cut down queries - and performance for a number of heavy requests. -* Update: ObjectTree caches lookups much more aggresively, which will help - especially speeding up a bunch of REPORT queries. -* Added: Support for the schedule-calendar-transp property. -* Fixed: Marking both the text/calendar and text/x-vcard as UTF-8 encoded. -* Fixed: Workaround for the SOGO connector, as it doesn't understand receiving - "text/x-vcard; charset=utf-8" for a contenttype. -* Added: Sabre_DAV_Client now throws more specific exceptions in cases where we - already has an exception class. -* Added: Sabre_DAV_PartialUpdate. This plugin allows you to use the PATCH method - to update parts of a file. -* Added: Tons of timezone name mappings for Microsoft Exchange. -* Added: Support for an 'exception' event in the server class. -* Fixed: Uploaded VCards without a UID are now rejected. (thanks Dominik!) -* Fixed: Rejecting calendar objects if they are not in the - supported-calendar-component list. (thanks Armin!) -* Fixed: Issue 219: serialize() now reorders correctly. -* Fixed: Sabre_DAV_XMLUtil no longer returns empty $dom->childNodes if there is - whitespace in $dom. -* Fixed: Returning 409 Conflict instead of 500 when an attempt is made to create - a file as a child of something that's not a collection. -* Fixed: Issue 237: xml-encoding values in SabreDAV error responses. -* Fixed: Returning 403, instead of 501 when an unknown REPORT is requested. -* Fixed: Postfixing slash on {DAV:}owner properties. -* Fixed: Several embarrassing spelling mistakes in docblocks. - - -1.6.10 (2013-06-17) -------------------- - -* Fixed: Text was incorrectly escaped in the Href and HrefList properties, - disallowing urls with ampersands (&) in them. -* Fixed: Issue 341: Escaping xml in 423 Locked error responses. - - -1.6.9 (2013-04-11) ------------------- - -* Fixed: Assets in the browser plugins were not being served on windows - machines. - - -1.6.8 (2013-04-08) ------------------- - -* Fixed: vcardurl in database schema can now hold 255 characters instead of 80 - (which is often way to small). -* Fixed: The browser plugin potentially allowed people to open any arbitrary - file on windows servers. (CVE-2013-1939). - - -1.6.7 (2013-03-01) ------------------- - -* Change: No longer advertising support for 4.0 vcards. iOS and OS X address - book don't handle this well, and just advertising 3.0 support seems like the - most logical course of action. -* Added: ->setVerifyPeers to Sabre_DAV_Client (greatly resisting against it, - don't use this..). - - -1.6.6 (2013-01-19) ------------------- - -* Fixed: Backported a fix for broken XML serialization in error responses. - (Thanks @DeepDiver1975!) - - -1.6.5 (2012-10-04) ------------------- - -* Fixed: Workaround for line-ending bug OS X 10.8 addressbook has. -* Added: Ability to allow users to set SSL certificates for the Client class. - (Thanks schiesbn!). -* Fixed: Directory indexes with lots of nodes should be a lot faster. -* Fixed: Issue 235: E_NOTICE thrown when doing a propfind request with - Sabre_DAV_Client, and no valid properties are returned. -* Fixed: Issue with filtering on alarms in tasks. - - -1.6.4 (2012-08-02) ------------------- - -* Fixed: Issue 220: Calendar-query filters may fail when filtering on alarms, if - an overridden event has it's alarm removed. -* Fixed: Compatibility for OS/X 10.8 iCal in the IMipHandler. -* Fixed: Issue 222: beforeWriteContent shouldn't be called for lock requests. -* Fixed: Problem with POST requests to the outbox if mailto: was not lower - cased. -* Fixed: Yearly recurrence rule expansion on leap-days no behaves correctly. -* Fixed: Correctly checking if recurring, all-day events with no dtstart fall in - a timerange if the start of the time-range exceeds the start of the instance - of an event, but not the end. -* Fixed: All-day recurring events wouldn't match if an occurence ended exactly - on the start of a time-range. -* Fixed: HTTP basic auth did not correctly deal with passwords containing colons - on some servers. -* Fixed: Issue 228: DTEND is now non-inclusive for all-day events in the - calendar-query REPORT and free-busy calculations. - - -1.6.3 (2012-06-12) ------------------- - -* Added: It's now possible to specify in Sabre_DAV_Client which type of - authentication is to be used. -* Fixed: Issue 206: Sabre_DAV_Client PUT requests are fixed. -* Fixed: Issue 205: Parsing an iCalendar 0-second date interval. -* Fixed: Issue 112: Stronger validation of iCalendar objects. Now making sure - every iCalendar object only contains 1 component, and disallowing vcards, - forcing every component to have a UID. -* Fixed: Basic validation for vcards in the CardDAV plugin. -* Fixed: Issue 213: Workaround for an Evolution bug, that prevented it from - updating events. -* Fixed: Issue 211: A time-limit query on a non-relative alarm trigger in a - recurring event could result in an endless loop. -* Fixed: All uri fields are now a maximum of 200 characters. The Bynari outlook - plugin used much longer strings so this should improve compatibility. -* Fixed: Added a workaround for a bug in KDE 4.8.2 contact syncing. See - https://bugs.kde.org/show_bug.cgi?id=300047 -* Fixed: Issue 217: Sabre_DAV_Tree_FileSystem was pretty broken. - - -1.6.2 (2012-04-16) ------------------- - -* Fixed: Sabre_VObject_Node::$parent should have been public. -* Fixed: Recurrence rules of events are now taken into consideration when doing - time-range queries on alarms. -* Fixed: Added a workaround for the fact that php's DateInterval cannot parse - weeks and days at the same time. -* Added: Sabre_DAV_Server::$exposeVersion, allowing you to hide SabreDAV's - version number from various outputs. -* Fixed: DTSTART values would be incorrect when expanding events. -* Fixed: DTSTART and DTEND would be incorrect for expansion of WEEKLY BYDAY - recurrences. -* Fixed: Issue 203: A problem with overridden events hitting the exact date and - time of a subsequent event in the recurrence set. -* Fixed: There was a problem with recurrence rules, for example the 5th tuesday - of the month, if this day did not exist. -* Added: New HTTP status codes from draft-nottingham-http-new-status-04. - - -1.6.1 (2012-03-05) ------------------- - -* Added: createFile and put() can now return an ETag. -* Added: Sending back an ETag on for operations on CardDAV backends. This should - help with OS X 10.6 Addressbook compatibility. -* Fixed: Fixed a bug where an infinite loop could occur in the recurrence - iterator if the recurrence was YEARLY, with a BYMONTH rule, and either BYDAY - or BYMONTHDAY match the first day of the month. -* Fixed: Events that are excluded using EXDATE are still counted in the COUNT= - parameter in the RRULE property. -* Added: Support for time-range filters on VALARM components. -* Fixed: Correctly filtering all-day events. -* Fixed: Sending back correct mimetypes from the browser plugin (thanks - Jürgen). -* Fixed: Issue 195: Sabre_CardDAV pear package had an incorrect dependency. -* Fixed: Calendardata would be destroyed when performing a MOVE request. - - -1.6.0 (2012-02-22) ------------------- - -* BC Break: Now requires PHP 5.3 -* BC Break: Any node that implemented Sabre_DAVACL_IACL must now also implement - the getSupportedPrivilegeSet method. See website for details. -* BC Break: Moved functions from Sabre_CalDAV_XMLUtil to - Sabre_VObject_DateTimeParser. -* BC Break: The Sabre_DAVACL_IPrincipalCollection now has two new methods: - 'searchPrincipals' and 'updatePrincipal'. -* BC Break: Sabre_DAV_ILockable is removed and all related per-node locking - functionality. -* BC Break: Sabre_DAV_Exception_FileNotFound is now deprecated in favor of - Sabre_DAV_Exception_NotFound. The former will be removed in a later version. -* BC Break: Removed Sabre_CalDAV_ICalendarUtil, use Sabre_VObject instead. -* BC Break: Sabre_CalDAV_Server is now deprecated, check out the documentation - on how to setup a caldav server with just Sabre_DAV_Server. -* BC Break: Default Principals PDO backend now needs a new field in the - 'principals' table. See the website for details. -* Added: Ability to create new calendars and addressbooks from within the - browser plugin. -* Added: Browser plugin: icons for various nodes. -* Added: Support for FREEBUSY reports! -* Added: Support for creating principals with admin-level privileges. -* Added: Possibility to let server send out invitation emails on behalf of - CalDAV client, using Sabre_CalDAV_Schedule_IMip. -* Changed: beforeCreateFile event now passes data argument by reference. -* Changed: The 'propertyMap' property from Sabre_VObject_Reader, must now be - specified in Sabre_VObject_Property::$classMap. -* Added: Ability for plugins to tell the ACL plugin which principal plugins are - searchable. -* Added: [DAVACL] Per-node overriding of supported privileges. This allows for - custom privileges where needed. -* Added: [DAVACL] Public 'principalSearch' method on the DAVACL plugin, which - allows for easy searching for principals, based on their properties. -* Added: Sabre_VObject_Component::getComponents() to return a list of only - components and not properties. -* Added: An includes.php file in every sub-package (CalDAV, CardDAV, DAV, - DAVACL, HTTP, VObject) as an alternative to the autoloader. This often works - much faster. -* Added: Support for the 'Me card', which allows Addressbook.app users specify - which vcard is their own. -* Added: Support for updating principal properties in the DAVACL principal - backends. -* Changed: Major refactoring in the calendar-query REPORT code. Should make - things more flexible and correct. -* Changed: The calendar-proxy-[read|write] principals will now only appear in - the tree, if they actually exist in the Principal backend. This should reduce - some problems people have been having with this. -* Changed: Sabre_VObject_Element_* classes are now renamed to - Sabre_VObject_Property. Old classes are retained for backwards compatibility, - but this will be removed in the future. -* Added: Sabre_VObject_FreeBusyGenerator to generate free-busy reports based on - lists of events. -* Added: Sabre_VObject_RecurrenceIterator to find all the dates and times for - recurring events. -* Fixed: Issue 97: Correctly handling RRULE for the calendar-query REPORT. -* Fixed: Issue 154: Encoding of VObject parameters with no value was incorrect. -* Added: Support for {DAV:}acl-restrictions property from RFC3744. -* Added: The contentlength for calendar objects can now be supplied by a CalDAV - backend, allowing for more optimizations. -* Fixed: Much faster implementation of Sabre_DAV_URLUtil::encodePath. -* Fixed: {DAV:}getcontentlength may now be not specified. -* Fixed: Issue 66: Using rawurldecode instead of urldecode to decode paths from - clients. This means that + will now be treated as a literal rather than a - space, and this should improve compatibility with the Windows built-in client. -* Added: Sabre_DAV_Exception_PaymentRequired exception, to emit HTTP 402 status - codes. -* Added: Some mysql unique constraints to example files. -* Fixed: Correctly formatting HTTP dates. -* Fixed: Issue 94: Sending back Last-Modified header for 304 responses. -* Added: Sabre_VObject_Component_VEvent, Sabre_VObject_Component_VJournal, - Sabre_VObject_Component_VTodo and Sabre_VObject_Component_VCalendar. -* Changed: Properties are now also automatically mapped to their appropriate - classes, if they are created using the add() or __set() methods. -* Changed: Cloning VObject objects now clones the entire tree, rather than just - the default shallow copy. -* Added: Support for recurrence expansion in the CALDAV:calendar-multiget and - CALDAV:calendar-query REPORTS. -* Changed: CalDAV PDO backend now sorts calendars based on the internal - 'calendarorder' field. -* Added: Issue 181: Carddav backends may no optionally not supply the carddata - in getCards, if etag and size are specified. This may speed up certain - requests. -* Added: More arguments to beforeWriteContent and beforeCreateFile (see - WritingPlugins wiki document). -* Added: Hook for iCalendar validation. This allows us to validate iCalendar - objects when they're uploaded. At the moment we're just validating syntax. -* Added: VObject now support Windows Timezone names correctly (thanks mrpace2). -* Added: If a timezonename could not be detected, we fall back on the default - PHP timezone. -* Added: Now a Composer package (thanks willdurand). -* Fixed: Support for \N as a newline character in the VObject reader. -* Added: afterWriteContent, afterCreateFile and afterUnbind events. -* Added: Postgresql example files. Not part of the unittests though, so use at - your own risk. -* Fixed: Issue 182: Removed backticks from sql queries, so it will work with - Postgres. - - -1.5.9 (2012-04-16) ------------------- - -* Fixed: Issue with parsing timezone identifiers that were surrounded by quotes. - (Fixes emClient compatibility). - - -1.5.8 (2012-02-22) ------------------- - -* Fixed: Issue 95: Another timezone parsing issue, this time in calendar-query. - - -1.5.7 (2012-02-19) ------------------- - -* Fixed: VObject properties are now always encoded before components. -* Fixed: Sabre_DAVACL had issues with multiple levels of privilege aggregration. -* Changed: Added 'GuessContentType' plugin to fileserver.php example. -* Fixed: The Browser plugin will now trigger the correct events when creating - files. -* Fixed: The ICSExportPlugin now considers ACL's. -* Added: Made it optional to supply carddata from an Addressbook backend when - requesting getCards. This can make some operations much faster, and could - result in much lower memory use. -* Fixed: Issue 187: Sabre_DAV_UUIDUtil was missing from includes file. -* Fixed: Issue 191: beforeUnlock was triggered twice. - - -1.5.6 (2012-01-07) ------------------- - -* Fixed: Issue 174: VObject could break UTF-8 characters. -* Fixed: pear package installation issues. - - -1.5.5 (2011-12-16) ------------------- - -* Fixed: CalDAV time-range filter workaround for recurring events. -* Fixed: Bug in Sabre_DAV_Locks_Backend_File that didn't allow multiple files to - be locked at the same time. - - -1.5.4 (2011-10-28) ------------------- - -* Fixed: GuessContentType plugin now supports mixed case file extensions. -* Fixed: DATE-TIME encoding was wrong in VObject. (we used 'DATETIME'). -* Changed: Sending back HTTP 204 after a PUT request on an existing resource - instead of HTTP 200. This should fix Evolution CardDAV client compatibility. -* Fixed: Issue 95: Parsing X-LIC-LOCATION if it's available. -* Added: All VObject elements now have a reference to their parent node. - - -1.5.3 (2011-09-28) ------------------- - -* Fixed: Sabre_DAV_Collection was missing from the includes file. -* Fixed: Issue 152. iOS 1.4.2 apparantly requires HTTP/1.1 200 OK to be in - uppercase. -* Fixed: Issue 153: Support for files with mixed newline styles in - Sabre_VObject. -* Fixed: Issue 159: Automatically converting any vcard and icalendardata to - UTF-8. -* Added: Sabre_DAV_SimpleFile class for easy static file creation. -* Added: Issue 158: Support for the CARDDAV:supported-address-data property. - - -1.5.2 (2011-09-21) ------------------- - -* Fixed: carddata and calendardata MySQL fields are now of type 'mediumblob'. - 'TEXT' was too small sometimes to hold all the data. -* Fixed: {DAV:}supported-report-set is now correctly reporting the reports for - IAddressBook. -* Added: Sabre_VObject_Property::add() to add duplicate parameters to - properties. -* Added: Issue 151: Sabre_CalDAV_ICalendar and Sabre_CalDAV_ICalendarObject - interfaces. -* Fixed: Issue 140: Not returning 201 Created if an event cancelled the creation - of a file. -* Fixed: Issue 150: Faster URLUtil::encodePath() implementation. -* Fixed: Issue 144: Browser plugin could interfere with - TemporaryFileFilterPlugin if it was loaded first. -* Added: It's not possible to specify more 'alternate uris' in principal - backends. - - -1.5.1 (2011-08-24) ------------------- - -* Fixed: Issue 137. Hiding action interface in HTML browser for non-collections. -* Fixed: addressbook-query is now correctly returned from the - {DAV:}supported-report-set property. -* Fixed: Issue 142: Bugs in groupwareserver.php example. -* Fixed: Issue 139: Rejecting PUT requests with Content-Range. - - -1.5.0 (2011-08-12) ------------------- - -* Added: CardDAV support. -* Added: An experimental WebDAV client. -* Added: MIME-Directory grouping support in the VObject library. This is very - useful for people attempting to parse vcards. -* BC Break: Adding parameters with the VObject libraries now overwrites the - previous parameter, rather than just add it. This makes more sense for 99% of - the cases. -* BC Break: lib/Sabre.autoload.php is now removed in favor of - lib/Sabre/autoload.php. -* Deprecated: Sabre_DAV_Directory is now deprecated and will be removed in a - future version. Use Sabre_DAV_Collection instead. -* Deprecated: Sabre_DAV_SimpleDirectory is now deprecated and will be removed in - a future version. Use Sabre_DAV_SimpleCollection instead. -* Fixed: Problem with overriding tablenames for the CalDAV backend. -* Added: Clark-notation parser to XML utility. -* Added: unset() support to VObject components. -* Fixed: Refactored CalDAV property fetching to be faster and simpler. -* Added: Central string-matcher for CalDAV and CardDAV plugins. -* Added: i;unicode-casemap support -* Fixed: VObject bug: wouldn't parse parameters if they weren't specified in - uppercase. -* Fixed: VObject bug: Parameters now behave more like Properties. -* Fixed: VObject bug: Parameters with no value are now correctly parsed. -* Changed: If calendars don't specify which components they allow, 'all' - components are assumed (e.g.: VEVENT, VTODO, VJOURNAL). -* Changed: Browser plugin now uses POST variable 'sabreAction' instead of - 'action' to reduce the chance of collisions. - - -1.4.4 (2011-07-07) ------------------- - -* Fixed: Issue 131: Custom CalDAV backends could break in certain cases. -* Added: The option to override the default tablename all PDO backends use. - (Issue 60). -* Fixed: Issue 124: 'File' authentication backend now takes realm into - consideration. -* Fixed: Sabre_DAV_Property_HrefList now properly deserializes. This allows - users to update the {DAV:}group-member-set property. -* Added: Helper functions for DateTime-values in Sabre_VObject package. -* Added: VObject library can now automatically map iCalendar properties to - custom classes. - - -1.4.3 (2011-04-25) ------------------- - -* Fixed: Issue 123: Added workaround for Windows 7 UNLOCK bug. -* Fixed: datatype of lastmodified field in mysql.calendars.sql. Please change - the DATETIME field to an INT to ensure this field will work correctly. -* Change: Sabre_DAV_Property_Principal is now renamed to - Sabre_DAVACL_Property_Principal. -* Added: API level support for ACL HTTP method. -* Fixed: Bug in serializing {DAV:}acl property. -* Added: deserializer for {DAV:}resourcetype property. -* Added: deserializer for {DAV:}acl property. -* Added: deserializer for {DAV:}principal property. - - -1.4.2-beta (2011-04-01) ------------------------ - -* Added: It's not possible to disable listing of nodes that are denied read - access by ACL. -* Fixed: Changed a few properties in CalDAV classes from private to protected. -* Fixed: Issue 119: Terrible things could happen when relying on guessBaseUri, - the server was running on the root of the domain and a user tried to access a - file ending in .php. This is a slight BC break. -* Fixed: Issue 118: Lock tokens in If headers without a uri should be treated as - the request uri, not 'all relevant uri's. -* Fixed: Issue 120: PDO backend was incorrectly fetching too much locks in cases - where there were similar named locked files in a directory. - - -1.4.1-beta (2011-02-26) ------------------------ - -* Fixed: Sabre_DAV_Locks_Backend_PDO returned too many locks. -* Fixed: Sabre_HTTP_Request::getHeader didn't return Content-Type when running - on apache, so a few workarounds were added. -* Change: Slightly changed CalDAV Backend API's, to allow for heavy - optimizations. This is non-bc breaking. - - -1.4.0-beta (2011-02-12) ------------------------ - -* Added: Partly RFC3744 ACL support. -* Added: Calendar-delegation (caldav-proxy) support. -* BC break: In order to fix Issue 99, a new argument had to be added to - Sabre_DAV_Locks_Backend_*::getLocks classes. Consult the classes for details. -* Deprecated: Sabre_DAV_Locks_Backend_FS is now deprecated and will be removed - in a later version. Use PDO or the new File class instead. -* Deprecated: The Sabre_CalDAV_ICalendarUtil class is now marked deprecated, and - will be removed in a future version. Please use Sabre_VObject instead. -* Removed: All principal-related functionality has been removed from the - Sabre_DAV_Auth_Plugin, and moved to the Sabre_DAVACL_Plugin. -* Added: VObject library, for easy vcard/icalendar parsing using a natural - interface. -* Added: Ability to automatically generate full .ics feeds off calendars. To - use: Add the Sabre_CalDAV_ICSExportPlugin, and add ?export to your calendar - url. -* Added: Plugins can now specify a pluginname, for easy access using - Sabre_DAV_Server::getPlugin(). -* Added: beforeGetProperties event. -* Added: updateProperties event. -* Added: Principal listings and calendar-access can now be done privately, - disallowing users from accessing or modifying other users' data. -* Added: You can now pass arrays to the Sabre_DAV_Server constructor. If it's an - array with node-objects, a Root collection will automatically be created, and - the nodes are used as top-level children. -* Added: The principal base uri is now customizable. It used to be hardcoded to - 'principals/[user]'. -* Added: getSupportedReportSet method in ServerPlugin class. This allows you to - easily specify which reports you're implementing. -* Added: A '..' link to the HTML browser. -* Fixed: Issue 99: Locks on child elements were ignored when their parent nodes - were deleted. -* Fixed: Issue 90: lockdiscovery property and LOCK response now include a - {DAV}lockroot element. -* Fixed: Issue 96: support for 'default' collation in CalDAV text-match filters. -* Fixed: Issue 102: Ensuring that copy and move with identical source and - destination uri's fails. -* Fixed: Issue 105: Supporting MKCALENDAR with no body. -* Fixed: Issue 109: Small fixes in Sabre_HTTP_Util. -* Fixed: Issue 111: Properly catching the ownername in a lock (if it's a string) -* Fixed: Sabre_DAV_ObjectTree::nodeExist always returned false for the root - node. -* Added: Global way to easily supply new resourcetypes for certain node classes. -* Fixed: Issue 59: Allowing the user to override the authentication realm in - Sabre_CalDAV_Server. -* Update: Issue 97: Looser time-range checking if there's a recurrence rule in - an event. This fixes 'missing recurring events'. - - -1.3.0 (2010-10-14) ------------------- - -* Added: childExists method to Sabre_DAV_ICollection. This is an api break, so - if you implement Sabre_DAV_ICollection directly, add the method. -* Changed: Almost all HTTP method implementations now take a uri argument, - including events. This allows for internal rerouting of certain calls. If you - have custom plugins, make sure they use this argument. If they don't, they - will likely still work, but it might get in the way of future changes. -* Changed: All getETag methods MUST now surround the etag with double-quotes. - This was a mistake made in all previous SabreDAV versions. If you don't do - this, any If-Match, If-None-Match and If: headers using Etags will work - incorrectly. (Issue 85). -* Added: Sabre_DAV_Auth_Backend_AbstractBasic class, which can be used to easily - implement basic authentication. -* Removed: Sabre_DAV_PermissionDenied class. Use Sabre_DAV_Forbidden instead. -* Removed: Sabre_DAV_IDirectory interface, use Sabre_DAV_ICollection instead. -* Added: Browser plugin now uses {DAV:}displayname if this property is - available. -* Added: Cache layer in the ObjectTree. -* Added: Tree classes now have a delete and getChildren method. -* Fixed: If-Modified-Since and If-Unmodified-Since would be incorrect if the - date is an exact match. -* Fixed: Support for multiple ETags in If-Match and If-None-Match headers. -* Fixed: Improved baseUrl handling. -* Fixed: Issue 67: Non-seekable stream support in ::put()/::get(). -* Fixed: Issue 65: Invalid dates are now ignored. -* Updated: Refactoring in Sabre_CalDAV to make everything a bit more ledgable. -* Fixed: Issue 88, Issue 89: Fixed compatibility for running SabreDAV on - Windows. -* Fixed: Issue 86: Fixed Content-Range top-boundary from 'file size' to 'file - size'-1. - - -1.2.5 (2010-08-18) ------------------- - -* Fixed: Issue 73: guessBaseUrl fails for some servers. -* Fixed: Issue 67: SabreDAV works better with non-seekable streams. -* Fixed: If-Modified-Since and If-Unmodified-Since would be incorrect if - the date is an exact match. - - -1.2.4 (2010-07-13) ------------------- - -* Fixed: Issue 62: Guessing baseUrl fails when url contains a query-string. -* Added: Apache configuration sample for CGI/FastCGI setups. -* Fixed: Issue 64: Only returning calendar-data when it was actually requested. - - -1.2.3 (2010-06-26) ------------------- - -* Fixed: Issue 57: Supporting quotes around etags in If-Match and If-None-Match - - -1.2.2 (2010-06-21) ------------------- - -* Updated: SabreDAV now attempts to guess the BaseURI if it's not set. -* Updated: Better compatibility with BitKinex -* Fixed: Issue 56: Incorrect behaviour for If-None-Match headers and GET - requests. -* Fixed: Issue with certain encoded paths in Browser Plugin. - - -1.2.1 (2010-06-07) ------------------- - -* Fixed: Issue 50, patch by Mattijs Hoitink. -* Fixed: Issue 51, Adding windows 7 lockfiles to TemporaryFileFilter. -* Fixed: Issue 38, Allowing custom filters to be added to TemporaryFileFilter. -* Fixed: Issue 53, ETags in the If: header were always failing. This behaviour - is now corrected. -* Added: Apache Authentication backend, in case authentication through .htaccess - is desired. -* Updated: Small improvements to example files. - - -1.2.0 (2010-05-24) ------------------- - -* Fixed: Browser plugin now displays international characters. -* Changed: More properties in CalDAV classes are now protected instead of - private. - - -1.2.0beta3 (2010-05-14) ------------------------ - -* Fixed: Custom properties were not properly sent back for allprops requests. -* Fixed: Issue 49, incorrect parsing of PROPPATCH, affecting Office 2007. -* Changed: Removed CalDAV items from includes.php, and added a few missing ones. - - -1.2.0beta2 (2010-05-04) ------------------------ - -* Fixed: Issue 46: Fatal error for some non-existent nodes. -* Updated: some example sql to include email address. -* Added: 208 and 508 statuscodes from RFC5842. -* Added: Apache2 configuration examples - - -1.2.0beta1 (2010-04-28) ------------------------ - -* Fixed: redundant namespace declaration in resourcetypes. -* Fixed: 2 locking bugs triggered by litmus when no Sabre_DAV_ILockable - interface is used. -* Changed: using http://sabredav.org/ns for all custom xml properties. -* Added: email address property to principals. -* Updated: CalendarObject validation. - - -1.2.0alpha4 (2010-04-24) ------------------------- - -* Added: Support for If-Range, If-Match, If-None-Match, If-Modified-Since, - If-Unmodified-Since. -* Changed: Brand new build system. Functionality is split up between Sabre, - Sabre_HTTP, Sabre_DAV and Sabre_CalDAV packages. In addition to that a new - non-pear package will be created with all this functionality combined. -* Changed: Autoloader moved to Sabre/autoload.php. -* Changed: The Allow: header is now more accurate, with appropriate HTTP methods - per uri. -* Changed: Now throwing back Sabre_DAV_Exception_MethodNotAllowed on a few - places where Sabre_DAV_Exception_NotImplemented was used. - - -1.2.0alpha3 (2010-04-20) ------------------------- - -* Update: Complete rewrite of property updating. Now easier to use and atomic. -* Fixed: Issue 16, automatically adding trailing / to baseUri. -* Added: text/plain is used for .txt files in GuessContentType plugin. -* Added: support for principal-property-search and principal-search-property-set - reports. -* Added: Issue 31: Hiding exception information by default. Can be turned on - with the Sabre_DAV_Server::$debugExceptions property. - - -1.2.0alpha2 (2010-04-08) ------------------------- - -* Added: Calendars are now private and can only be read by the owner. -* Fixed: double namespace declaration in multistatus responses. -* Added: MySQL database dumps. MySQL is now also supported next to SQLite. -* Added: expand-properties REPORT from RFC 3253. -* Added: Sabre_DAV_Property_IHref interface for properties exposing urls. -* Added: Issue 25: Throwing error on broken Finder behaviour. -* Changed: Authentication backend is now aware of current user. - - -1.2.0alpha1 (2010-03-31) ------------------------- - -* Fixed: Issue 26: Workaround for broken GVFS behaviour with encoded special - characters. -* Fixed: Issue 34: Incorrect Lock-Token response header for LOCK. Fixes Office - 2010 compatibility. -* Added: Issue 35: SabreDAV version to header to OPTIONS response to ease - debugging. -* Fixed: Issue 36: Incorrect variable name, throwing error in some requests. -* Fixed: Issue 37: Incorrect smultron regex in temporary filefilter. -* Fixed: Issue 33: Converting ISO-8859-1 characters to UTF-8. -* Fixed: Issue 39 & Issue 40: Basename fails on non-utf-8 locales. -* Added: More unittests. -* Added: SabreDAV version to all error responses. -* Added: URLUtil class for decoding urls. -* Changed: Now using pear.sabredav.org pear channel. -* Changed: Sabre_DAV_Server::getCopyAndMoveInfo is now a public method. - - -1.1.2-alpha (2010-03-18) ------------------------- - -* Added: RFC5397 - current-user-principal support. -* Fixed: Issue 27: encoding entities in property responses. -* Added: naturalselection script now allows the user to specify a 'minimum - number of bytes' for deletion. This should reduce load due to less crawling -* Added: Full support for the calendar-query report. -* Added: More unittests. -* Added: Support for complex property deserialization through the static - ::unserialize() method. -* Added: Support for modifying calendar-component-set -* Fixed: Issue 29: Added TIMEOUT_INFINITE constant - - -1.1.1-alpha (2010-03-11) ------------------------- - -* Added: RFC5689 - Extended MKCOL support. -* Fixed: Evolution support for CalDAV. -* Fixed: PDO-locks backend was pretty much completely broken. This is 100% - unittested now. -* Added: support for ctags. -* Fixed: Comma's between HTTP methods in 'Allow' method. -* Changed: default argument for Sabre_DAV_Locks_Backend_FS. This means a - datadirectory must always be specified from now on. -* Changed: Moved Sabre_DAV_Server::parseProps to - Sabre_DAV_XMLUtil::parseProperties. -* Changed: Sabre_DAV_IDirectory is now Sabre_DAV_ICollection. -* Changed: Sabre_DAV_Exception_PermissionDenied is now - Sabre_DAV_Exception_Forbidden. -* Changed: Sabre_CalDAV_ICalendarCollection is removed. -* Added: Sabre_DAV_IExtendedCollection. -* Added: Many more unittests. -* Added: support for calendar-timezone property. - - -1.1.0-alpha (2010-03-01) ------------------------- - -* Note: This version is forked from version 1.0.5, so release dates may be out - of order. -* Added: CalDAV - RFC 4791 -* Removed: Sabre_PHP_Exception. PHP has a built-in ErrorException for this. -* Added: PDO authentication backend. -* Added: Example sql for auth, caldav, locks for sqlite. -* Added: Sabre_DAV_Browser_GuessContentType plugin -* Changed: Authentication plugin refactored, making it possible to implement - non-digest authentication. -* Fixed: Better error display in browser plugin. -* Added: Support for {DAV:}supported-report-set -* Added: XML utility class with helper functions for the WebDAV protocol. -* Added: Tons of unittests -* Added: PrincipalCollection and Principal classes -* Added: Sabre_DAV_Server::getProperties for easy property retrieval -* Changed: {DAV:}resourceType defaults to 0 -* Changed: Any non-null resourceType now gets a / appended to the href value. - Before this was just for {DAV:}collection's, but this is now also the case for - for example {DAV:}principal. -* Changed: The Href property class can now optionally create non-relative uri's. -* Changed: Sabre_HTTP_Response now returns false if headers are already sent and - header-methods are called. -* Fixed: Issue 19: HEAD requests on Collections -* Fixed: Issue 21: Typo in Sabre_DAV_Property_Response -* Fixed: Issue 18: Doesn't work with Evolution Contacts - - -1.0.15 (2010-05-28) -------------------- - -* Added: Issue 31: Hiding exception information by default. Can be turned on - with the Sabre_DAV_Server::$debugExceptions property. -* Added: Moved autoload from lib/ to lib/Sabre/autoload.php. This is also the - case in the upcoming 1.2.0, so it will improve future compatibility. - - -1.0.14 (2010-04-15) -------------------- - -* Fixed: double namespace declaration in multistatus responses. - - -1.0.13 (2010-03-30) -------------------- - -* Fixed: Issue 40: Last references to basename/dirname - - -1.0.12 (2010-03-30) -------------------- - -* Fixed: Issue 37: Incorrect smultron regex in temporary filefilter. -* Fixed: Issue 26: Workaround for broken GVFS behaviour with encoded special - characters. -* Fixed: Issue 33: Converting ISO-8859-1 characters to UTF-8. -* Fixed: Issue 39: Basename fails on non-utf-8 locales. -* Added: More unittests. -* Added: SabreDAV version to all error responses. -* Added: URLUtil class for decoding urls. -* Updated: Now using pear.sabredav.org pear channel. - - -1.0.11 (2010-03-23) -------------------- - -* Non-public release. This release is identical to 1.0.10, but it is used to - test releasing packages to pear.sabredav.org. - - -1.0.10 (2010-03-22) -------------------- - -* Fixed: Issue 34: Invalid Lock-Token header response. -* Added: Issue 35: Adding SabreDAV version to HTTP OPTIONS responses. - - -1.0.9 (2010-03-19) ------------------- - -* Fixed: Issue 27: Entities not being encoded in PROPFIND responses. -* Fixed: Issue 29: Added missing TIMEOUT_INFINITE constant. - - -1.0.8 (2010-03-03) ------------------- - -* Fixed: Issue 21: typos causing errors -* Fixed: Issue 23: Comma's between methods in Allow header. -* Added: Sabre_DAV_ICollection interface, to aid in future compatibility. -* Added: Sabre_DAV_Exception_Forbidden exception. This will replace - Sabre_DAV_Exception_PermissionDenied in the future, and can already be used to - ensure future compatibility. - - -1.0.7 (2010-02-24) ------------------- - -* Fixed: Issue 19 regression for MS Office - - -1.0.6 (2010-02-23) ------------------- - -* Fixed: Issue 19: HEAD requests on Collections - - -1.0.5 (2010-01-22) ------------------- - -* Fixed: Fatal error when a malformed url was used for unlocking, in conjuction - with Sabre.autoload.php due to a incorrect filename. -* Fixed: Improved unittests and build system - - -1.0.4 (2010-01-11) ------------------- - -* Fixed: needed 2 different releases. One for googlecode and one for pearfarm. - This is to retain the old method to install SabreDAV until pearfarm becomes - the standard installation method. - - -1.0.3 (2010-01-11) ------------------- - -* Added: RFC4709 support (davmount) -* Added: 6 unittests -* Added: naturalselection. A tool to keep cache directories below a specified - theshold. -* Changed: Now using pearfarm.org channel server. - - -1.0.1 (2009-12-22) ------------------- - -* Fixed: Issue 15: typos in examples -* Fixed: Minor pear installation issues - - -1.0.0 (2009-11-02) ------------------- - -* Added: SimpleDirectory class. This class allows creating static directory - structures with ease. -* Changed: Custom complex properties and exceptions now get an instance of - Sabre_DAV_Server as their first argument in serialize() -* Changed: Href complex property now prepends server's baseUri -* Changed: delete before an overwriting copy/move is now handles by server class - instead of tree classes -* Changed: events must now explicitly return false to stop execution. Before, - execution would be stopped by anything loosely evaluating to false. -* Changed: the getPropertiesForPath method now takes a different set of - arguments, and returns a different response. This allows plugin developers to - return statuses for properties other than 200 and 404. The hrefs are now also - always calculated relative to the baseUri, and not the uri of the request. -* Changed: generatePropFindResponse is renamed to generateMultiStatus, and now - takes a list of properties similar to the response of getPropertiesForPath. - This was also needed to improve flexibility for plugin development. -* Changed: Auth plugins are no longer included. They were not yet stable - quality, so they will probably be reintroduced in a later version. -* Changed: PROPPATCH also used generateMultiStatus now. -* Removed: unknownProperties event. This is replaced by the afterGetProperties - event, which should provide more flexibility. -* Fixed: Only calling getSize() on IFile instances in httpHead() -* Added: beforeBind event. This is invoked upon file or directory creation -* Added: beforeWriteContent event, this is invoked by PUT and LOCK on an - existing resource. -* Added: beforeUnbind event. This is invoked right before deletion of any - resource. -* Added: afterGetProperties event. This event can be used to make modifications - to property responses. -* Added: beforeLock and beforeUnlock events. -* Added: afterBind event. -* Fixed: Copy and Move could fail in the root directory. This is now fixed. -* Added: Plugins can now be retrieved by their classname. This is useful for - inter-plugin communication. -* Added: The Auth backend can now return usernames and user-id's. -* Added: The Auth backend got a getUsers method -* Added: Sabre_DAV_FSExt_Directory now returns quota info - - -0.12.1-beta (2009-09-11) ------------------------- - -* Fixed: UNLOCK bug. Unlock didn't work at all - - -0.12-beta (2009-09-10) ----------------------- - -* Updated: Browser plugin now shows multiple {DAV:}resourcetype values if - available. -* Added: Experimental PDO backend for Locks Manager -* Fixed: Sending Content-Length: 0 for every empty response. This improves NGinx - compatibility. -* Fixed: Last modification time is reported in UTC timezone. This improves - Finder compatibility. - - -0.11-beta (2009-08-11) ----------------------- - -* Updated: Now in Beta -* Updated: Pear package no longer includes docs/ directory. These just contained - rfc's, which are publicly available. This reduces the package from ~800k to - ~60k -* Added: generatePropfindResponse now takes a baseUri argument -* Added: ResourceType property can now contain multiple resourcetypes. -* Fixed: Issue 13. - - -0.10-alpha (2009-08-03) ------------------------ - -* Added: Plugin to automatically map GET requests to non-files to PROPFIND - (Sabre_DAV_Browser_MapGetToPropFind). This should allow easier debugging of - complicated WebDAV setups. -* Added: Sabre_DAV_Property_Href class. For future use. -* Added: Ability to choose to use auth-int, auth or both for HTTP Digest - authentication. (Issue 11) -* Changed: Made more methods in Sabre_DAV_Server public. -* Fixed: TemporaryFileFilter plugin now intercepts HTTP LOCK requests to - non-existent files. (Issue 12) -* Added: Central list of defined xml namespace prefixes. This can reduce - Bandwidth and legibility for xml bodies with user-defined namespaces. -* Added: now a PEAR-compatible package again, thanks to Michael Gauthier -* Changed: moved default copy and move logic from ObjectTree to Tree class - -0.9a-alpha (2009-07-21) ----------------------- - -* Fixed: Broken release - -0.9-alpha (2009-07-21) ----------------------- - -* Changed: Major refactoring, removed most of the logic from the Tree objects. - The Server class now directly works with the INode, IFile and IDirectory - objects. If you created your own Tree objects, this will most likely break in - this release. -* Changed: Moved all the Locking logic from the Tree and Server classes into a - separate plugin. -* Changed: TemporaryFileFilter is now a plugin. -* Added: Comes with an autoloader script. This can be used instead of the - includer script, and is preferred by some people. -* Added: AWS Authentication class. -* Added: simpleserversetup.py script. This will quickly get a fileserver up and - running. -* Added: When subscribing to events, it is now possible to supply a priority. - This is for example needed to ensure that the Authentication Plugin is used - before any other Plugin. -* Added: 22 new tests. -* Added: Users-manager plugin for .htdigest files. Experimental and subject to - change. -* Added: RFC 2324 HTTP 418 status code -* Fixed: Exclusive locks could in some cases be picked up as shared locks -* Fixed: Digest auth for non-apache servers had a bug (still not actually tested - this well). - - -0.8-alpha (2009-05-30) ----------------------- - -* Changed: Renamed all exceptions! This is a compatibility break. Every - Exception now follows Sabre_DAV_Exception_FileNotFound convention instead of - Sabre_DAV_FileNotFoundException. -* Added: Browser plugin now allows uploading and creating directories straight - from the browser. -* Added: 12 more unittests -* Fixed: Locking bug, which became prevalent on Windows Vista. -* Fixed: Netdrive support -* Fixed: TemporaryFileFilter filtered out too many files. Fixed some of the - regexes. -* Fixed: Added README and ChangeLog to package - - -0.7-alpha (2009-03-29) ----------------------- - -* Added: System to return complex properties from PROPFIND. -* Added: support for {DAV:}supportedlock. -* Added: support for {DAV:}lockdiscovery. -* Added: 6 new tests. -* Added: New plugin system. -* Added: Simple HTML directory plugin, for browser access. -* Added: Server class now sends back standard pre-condition error xml bodies. - This was new since RFC4918. -* Added: Sabre_DAV_Tree_Aggregate, which can 'host' multiple Tree objects into - one. -* Added: simple basis for HTTP REPORT method. This method is not used yet, but - can be used by plugins to add reports. -* Changed: ->getSize is only called for files, no longer for collections. r303 -* Changed: Sabre_DAV_FilterTree is now Sabre_DAV_Tree_Filter -* Changed: Sabre_DAV_TemporaryFileFilter is now called - Sabre_DAV_Tree_TemporaryFileFilter. -* Changed: removed functions (get(/set)HTTPRequest(/Response)) from Server - class, and using a public property instead. -* Fixed: bug related to parsing proppatch and propfind requests. Didn't show up - in most clients, but it needed fixing regardless. (r255) -* Fixed: auth-int is now properly supported within HTTP Digest. -* Fixed: Using application/xml for a mimetype vs. text/xml as per RFC4918 sec - 8.2. -* Fixed: TemporaryFileFilter now lets through GET's if they actually exist on - the backend. (r274) -* Fixed: Some methods didn't get passed through in the FilterTree (r283). -* Fixed: LockManager is now slightly more complex, Tree classes slightly less. - (r287) - - -0.6-alpha (2009-02-16) ----------------------- - -* Added: Now uses streams for files, instead of strings. This means it won't - require to hold entire files in memory, which can be an issue if you're - dealing with big files. Note that this breaks compatibility for put() and - createFile methods. -* Added: HTTP Digest Authentication helper class. -* Added: Support for HTTP Range header -* Added: Support for ETags within If: headers -* Added: The API can now return ETags and override the default Content-Type -* Added: starting with basic framework for unittesting, using PHPUnit. -* Added: 49 unittests. -* Added: Abstraction for the HTTP request. -* Updated: Using Clark Notation for tags in properties. This means tags are - serialized as {namespace}tagName instead of namespace#tagName -* Fixed: HTTP_BasicAuth class now works as expected. -* Fixed: DAV_Server uses / for a default baseUrl. -* Fixed: Last modification date is no longer ignored in PROPFIND. -* Fixed: PROPFIND now sends back information about the requestUri even when - "Depth: 1" is specified. - - -0.5-alpha (2009-01-14) ----------------------- - -* Added: Added a very simple example for implementing a mapping to PHP file - streams. This should allow easy implementation of for example a WebDAV to FTP - proxy. -* Added: HTTP Basic Authentication helper class. -* Added: Sabre_HTTP_Response class. This centralizes HTTP operations and will be - a start towards the creating of a testing framework. -* Updated: Backwards compatibility break: all require_once() statements are - removed from all the files. It is now recommended to use autoloading of - classes, or just including lib/Sabre.includes.php. This fix was made to allow - easier integration into applications not using this standard inclusion model. -* Updated: Better in-file documentation. -* Updated: Sabre_DAV_Tree can now work with Sabre_DAV_LockManager. -* Updated: Fixes a shared-lock bug. -* Updated: Removed ?> from the bottom of each php file. -* Updated: Split up some operations from Sabre_DAV_Server to - Sabre_HTTP_Response. -* Fixed: examples are now actually included in the pear package. - - -0.4-alpha (2008-11-05) ----------------------- - -* Passes all litmus tests! -* Added: more examples -* Added: Custom property support -* Added: Shared lock support -* Added: Depth support to locks -* Added: Locking on unmapped urls (non-existent nodes) -* Fixed: Advertising as WebDAV class 3 support - - -0.3-alpha (2008-06-29) ----------------------- - -* Fully working in MS Windows clients. -* Added: temporary file filter: support for smultron files. -* Added: Phing build scripts -* Added: PEAR package -* Fixed: MOVE bug identified using finder. -* Fixed: Using gzuncompress instead of gzdecode in the temporary file filter. - This seems more common. - - -0.2-alpha (2008-05-27) ----------------------- - -* Somewhat working in Windows clients -* Added: Working PROPPATCH method (doesn't support custom properties yet) -* Added: Temporary filename handling system -* Added: Sabre_DAV_IQuota to return quota information -* Added: PROPFIND now reads the request body and only supplies the requested - properties - - -0.1-alpha (2008-04-04) ----------------------- - -* First release! -* Passes litmus: basic, http and copymove test. -* Fully working in Finder and DavFS2. - -Project started: 2007-12-13 - -[vobj]: http://sabre.io/vobject/ -[evnt]: http://sabre.io/event/ -[http]: http://sabre.io/http/ -[uri]: http://sabre.io/uri/ -[xml]: http://sabre.io/xml/ -[mi20]: http://sabre.io/dav/upgrade/1.8-to-2.0/ -[rfc6638]: http://tools.ietf.org/html/rfc6638 "CalDAV Scheduling" -[rfc7240]: http://tools.ietf.org/html/rfc7240 -[calendar-availability]: https://tools.ietf.org/html/draft-daboo-calendar-availability-05 diff --git a/vendor/sabre/dav/CONTRIBUTING.md b/vendor/sabre/dav/CONTRIBUTING.md deleted file mode 100644 index b937db64f..000000000 --- a/vendor/sabre/dav/CONTRIBUTING.md +++ /dev/null @@ -1,109 +0,0 @@ -Contributing to sabre projects -============================== - -Want to contribute to sabre/dav? Here are some guidelines to ensure your patch -gets accepted. - - -Building a new feature? Contact us first ----------------------------------------- - -We may not want to accept every feature that comes our way. Sometimes -features are out of scope for our projects. - -We don't want to waste your time, so by having a quick chat with us first, -you may find out quickly if the feature makes sense to us, and we can give -some tips on how to best build the feature. - -If we don't accept the feature, it could be for a number of reasons. For -instance, we've rejected features in the past because we felt uncomfortable -assuming responsibility for maintaining the feature. - -In those cases, it's often possible to keep the feature separate from the -sabre projects. sabre/dav for instance has a plugin system, and there's no -reason the feature can't live in a project you own. - -In that case, definitely let us know about your plugin as well, so we can -feature it on [sabre.io][4]. - -We are often on [IRC][5], in the #sabredav channel on freenode. If there's -no one there, post a message on the [mailing list][6]. - - -Coding standards ----------------- - -sabre projects follow: - -1. [PSR-1][1] -2. [PSR-4][2] - -sabre projects don't follow [PSR-2][3]. - -In addition to that, here's a list of basic rules: - -1. PHP 5.4 array syntax must be used every where. This means you use `[` and - `]` instead of `array(` and `)`. -2. Use PHP namespaces everywhere. -3. Use 4 spaces for indentation. -4. Try to keep your lines under 80 characters. This is not a hard rule, as - there are many places in the source where it felt more sensibile to not - do so. In particular, function declarations are never split over multiple - lines. -5. Opening braces (`{`) are _always_ on the same line as the `class`, `if`, - `function`, etc. they belong to. -6. `public` must be omitted from method declarations. It must also be omitted - for static properties. -7. All files should use unix-line endings (`\n`). -8. Files must omit the closing php tag (`?>`). -9. `true`, `false` and `null` are always lower-case. -10. Constants are always upper-case. -11. Any of the rules stated before may be broken where this is the pragmatic - thing to do. - - -Unit test requirements ----------------------- - -Any new feature or change requires unittests. We use [PHPUnit][7] for all our -tests. - -Adding unittests will greatly increase the likelyhood of us quickly accepting -your pull request. If unittests are not included though for whatever reason, -we'd still _love_ your pull request. - -We may have to write the tests ourselves, which can increase the time it takes -to accept the patch, but we'd still really like your contribution! - -To run the testsuite jump into the directory `cd tests` and trigger `phpunit`. -Make sure you did a `composer install` beforehand. - -Release process ---------------- - -Generally, these are the steps taken to do releases. - -1. Update the changelog. Every repo will have a `CHANGELOG.md` file. This file - should have a new version, and contain all the changes since the last - release. I generally run a `git diff` to figure out if I missed any changes. - This file should also have the current date. -2. If there were BC breaks, this usually now means a major version bump. -3. Ensure that `lib/Version.php` or `lib/DAV/Version.php` also matches this - version number. -4. Tag the release (Example `git tag 3.0.1` and push the tag (`git push --tags`). -5. (only for the sabre/dav project), create a zip distribution. Run - `php bin/build.php`. -6. For the relevant project, go to github and click the 'releases' tab. On this - tab I create the release with the relevant version. I also set the - description of the release to the same information of the changelog. In the - case of the `sabre/dav` project I also upload the zip distribution here. -7. Write a blog post on sabre.io. This also automatically updates twitter. - - -[1]: http://www.php-fig.org/psr/psr-1/ -[2]: http://www.php-fig.org/psr/psr-4/ -[3]: http://www.php-fig.org/psr/psr-2/ -[4]: http://sabre.io/ -[5]: irc://freenode.net/#sabredav -[6]: http://groups.google.com/group/sabredav-discuss -[7]: http://phpunit.de/ diff --git a/vendor/sabre/dav/bin/build.php b/vendor/sabre/dav/bin/build.php index 54174a777..4dd25d9c9 100644..100755 --- a/vendor/sabre/dav/bin/build.php +++ b/vendor/sabre/dav/bin/build.php @@ -32,7 +32,7 @@ if ($argc > 2) { if (!isset($tasks[$currentTask])) { echo 'Task not found: ', $currentTask, "\n"; - die(1); + exit(1); } // Creating the dependency graph @@ -43,7 +43,7 @@ while (count($oldTaskList) > 0) { foreach ($oldTaskList as $task => $foo) { if (!isset($tasks[$task])) { echo 'Dependency not found: '.$task, "\n"; - die(1); + exit(1); } $dependencies = $tasks[$task]; @@ -107,7 +107,7 @@ function test() system(__DIR__.'/phpunit --configuration '.$baseDir.'/tests/phpunit.xml.dist --stop-on-failure', $code); if (0 != $code) { echo "PHPUnit reported error code $code\n"; - die(1); + exit(1); } } @@ -139,7 +139,7 @@ function buildzip() system('cd build/SabreDAV; composer install -n', $code); if (0 !== $code) { echo "Composer reported error code $code\n"; - die(1); + exit(1); } echo " Removing pointless files\n"; diff --git a/vendor/sabre/dav/bin/googlecode_upload.py b/vendor/sabre/dav/bin/googlecode_upload.py index caafd5ded..caafd5ded 100644..100755 --- a/vendor/sabre/dav/bin/googlecode_upload.py +++ b/vendor/sabre/dav/bin/googlecode_upload.py diff --git a/vendor/sabre/dav/bin/migrateto20.php b/vendor/sabre/dav/bin/migrateto20.php index c7a8d9e35..fb24fe599 100644..100755 --- a/vendor/sabre/dav/bin/migrateto20.php +++ b/vendor/sabre/dav/bin/migrateto20.php @@ -72,7 +72,7 @@ switch ($driver) { break; default: echo 'Error: unsupported driver: '.$driver."\n"; - die(-1); + exit(-1); } foreach (['calendar', 'addressbook'] as $itemType) { @@ -130,7 +130,6 @@ foreach (['calendar', 'addressbook'] as $itemType) { break; case 'sqlite': - $pdo->exec("ALTER TABLE $tableName RENAME TO $tableNameOld"); switch ($itemType) { @@ -370,7 +369,6 @@ CREATE TABLE cards ( break; case 'sqlite': - $pdo->exec(' CREATE TABLE cards ( id integer primary key asc, @@ -395,7 +393,6 @@ CREATE TABLE cards ( break; case 'sqlite': - $pdo->exec(' ALTER TABLE cards ADD etag text; ALTER TABLE cards ADD size integer; diff --git a/vendor/sabre/dav/bin/migrateto21.php b/vendor/sabre/dav/bin/migrateto21.php index 909643583..2c15b0a21 100644..100755 --- a/vendor/sabre/dav/bin/migrateto21.php +++ b/vendor/sabre/dav/bin/migrateto21.php @@ -73,7 +73,7 @@ switch ($driver) { break; default: echo 'Error: unsupported driver: '.$driver."\n"; - die(-1); + exit(-1); } echo "Upgrading 'calendarobjects'\n"; diff --git a/vendor/sabre/dav/bin/migrateto30.php b/vendor/sabre/dav/bin/migrateto30.php index 25e544c2a..9798cadd2 100644..100755 --- a/vendor/sabre/dav/bin/migrateto30.php +++ b/vendor/sabre/dav/bin/migrateto30.php @@ -72,7 +72,7 @@ switch ($driver) { break; default: echo 'Error: unsupported driver: '.$driver."\n"; - die(-1); + exit(-1); } echo "Upgrading 'propertystorage'\n"; diff --git a/vendor/sabre/dav/bin/migrateto32.php b/vendor/sabre/dav/bin/migrateto32.php index 57fd35507..09ac55d13 100644..100755 --- a/vendor/sabre/dav/bin/migrateto32.php +++ b/vendor/sabre/dav/bin/migrateto32.php @@ -75,7 +75,7 @@ switch ($driver) { break; default: echo 'Error: unsupported driver: '.$driver."\n"; - die(-1); + exit(-1); } echo "Creating 'calendarinstances'\n"; diff --git a/vendor/sabre/dav/bin/sabredav.php b/vendor/sabre/dav/bin/sabredav.php index 28341b587..71047b8f8 100644..100755 --- a/vendor/sabre/dav/bin/sabredav.php +++ b/vendor/sabre/dav/bin/sabredav.php @@ -20,7 +20,7 @@ class CliLog $log = new CliLog(); if ('cli-server' !== php_sapi_name()) { - die('This script is intended to run on the built-in php webserver'); + exit('This script is intended to run on the built-in php webserver'); } // Finding composer diff --git a/vendor/sabre/dav/composer.json b/vendor/sabre/dav/composer.json index fa912faf5..7c9596d21 100644 --- a/vendor/sabre/dav/composer.json +++ b/vendor/sabre/dav/composer.json @@ -33,7 +33,7 @@ "ext-json": "*" }, "require-dev" : { - "friendsofphp/php-cs-fixer": "^2.16.7", + "friendsofphp/php-cs-fixer": "^2.17.1", "phpstan/phpstan": "^0.12", "phpunit/phpunit" : "^7.5 || ^8.5 || ^9.0", "evert/phpdoc-md" : "~0.1.0", diff --git a/vendor/sabre/dav/lib/CalDAV/Backend/PDO.php b/vendor/sabre/dav/lib/CalDAV/Backend/PDO.php index 7a07724b3..0d5df3968 100644 --- a/vendor/sabre/dav/lib/CalDAV/Backend/PDO.php +++ b/vendor/sabre/dav/lib/CalDAV/Backend/PDO.php @@ -7,6 +7,7 @@ namespace Sabre\CalDAV\Backend; use Sabre\CalDAV; use Sabre\DAV; use Sabre\DAV\Exception\Forbidden; +use Sabre\DAV\PropPatch; use Sabre\DAV\Xml\Element\Sharee; use Sabre\VObject; @@ -289,7 +290,7 @@ SQL * * @param mixed $calendarId */ - public function updateCalendar($calendarId, \Sabre\DAV\PropPatch $propPatch) + public function updateCalendar($calendarId, PropPatch $propPatch) { if (!is_array($calendarId)) { throw new \InvalidArgumentException('The value passed to $calendarId is expected to be an array with a calendarId and an instanceId'); @@ -779,17 +780,20 @@ SQL $componentType = $filters['comp-filters'][0]['name']; // Checking if we need post-filters - if (!$filters['prop-filters'] && !$filters['comp-filters'][0]['comp-filters'] && !$filters['comp-filters'][0]['time-range'] && !$filters['comp-filters'][0]['prop-filters']) { + $has_time_range = array_key_exists('time-range', $filters['comp-filters'][0]) && $filters['comp-filters'][0]['time-range']; + if (!$filters['prop-filters'] && !$filters['comp-filters'][0]['comp-filters'] && !$has_time_range && !$filters['comp-filters'][0]['prop-filters']) { $requirePostFilter = false; } // There was a time-range filter - if ('VEVENT' == $componentType && isset($filters['comp-filters'][0]['time-range'])) { + if ('VEVENT' == $componentType && $has_time_range) { $timeRange = $filters['comp-filters'][0]['time-range']; // If start time OR the end time is not specified, we can do a // 100% accurate mysql query. - if (!$filters['prop-filters'] && !$filters['comp-filters'][0]['comp-filters'] && !$filters['comp-filters'][0]['prop-filters'] && (!$timeRange['start'] || !$timeRange['end'])) { - $requirePostFilter = false; + if (!$filters['prop-filters'] && !$filters['comp-filters'][0]['comp-filters'] && !$filters['comp-filters'][0]['prop-filters'] && $timeRange) { + if ((array_key_exists('start', $timeRange) && !$timeRange['start']) || (array_key_exists('end', $timeRange) && !$timeRange['end'])) { + $requirePostFilter = false; + } } } } @@ -809,11 +813,11 @@ SQL $values['componenttype'] = $componentType; } - if ($timeRange && $timeRange['start']) { + if ($timeRange && array_key_exists('start', $timeRange) && $timeRange['start']) { $query .= ' AND lastoccurence > :startdate'; $values['startdate'] = $timeRange['start']->getTimeStamp(); } - if ($timeRange && $timeRange['end']) { + if ($timeRange && array_key_exists('end', $timeRange) && $timeRange['end']) { $query .= ' AND firstoccurence < :enddate'; $values['enddate'] = $timeRange['end']->getTimeStamp(); } @@ -1153,10 +1157,9 @@ SQL; * * Read the PropPatch documentation for more info and examples. * - * @param mixed $subscriptionId - * @param \Sabre\DAV\PropPatch $propPatch + * @param mixed $subscriptionId */ - public function updateSubscription($subscriptionId, DAV\PropPatch $propPatch) + public function updateSubscription($subscriptionId, PropPatch $propPatch) { $supportedProperties = array_keys($this->subscriptionPropertyMap); $supportedProperties[] = '{http://calendarserver.org/ns/}source'; diff --git a/vendor/sabre/dav/lib/CalDAV/CalendarQueryValidator.php b/vendor/sabre/dav/lib/CalDAV/CalendarQueryValidator.php index 7ce1c05b7..ee525da7a 100644 --- a/vendor/sabre/dav/lib/CalDAV/CalendarQueryValidator.php +++ b/vendor/sabre/dav/lib/CalDAV/CalendarQueryValidator.php @@ -67,9 +67,17 @@ class CalendarQueryValidator return false; } - if ($filter['time-range']) { + if (array_key_exists('time-range', $filter) && $filter['time-range']) { foreach ($parent->{$filter['name']} as $subComponent) { - if ($this->validateTimeRange($subComponent, $filter['time-range']['start'], $filter['time-range']['end'])) { + $start = null; + $end = null; + if (array_key_exists('start', $filter['time-range'])) { + $start = $filter['time-range']['start']; + } + if (array_key_exists('end', $filter['time-range'])) { + $end = $filter['time-range']['end']; + } + if ($this->validateTimeRange($subComponent, $start, $end)) { continue 2; } } @@ -128,9 +136,17 @@ class CalendarQueryValidator return false; } - if ($filter['time-range']) { + if (array_key_exists('time-range', $filter) && $filter['time-range']) { foreach ($parent->{$filter['name']} as $subComponent) { - if ($this->validateTimeRange($subComponent, $filter['time-range']['start'], $filter['time-range']['end'])) { + $start = null; + $end = null; + if (array_key_exists('start', $filter['time-range'])) { + $start = $filter['time-range']['start']; + } + if (array_key_exists('end', $filter['time-range'])) { + $end = $filter['time-range']['end']; + } + if ($this->validateTimeRange($subComponent, $start, $end)) { continue 2; } } @@ -258,11 +274,9 @@ class CalendarQueryValidator case 'VEVENT': case 'VTODO': case 'VJOURNAL': - return $component->isInTimeRange($start, $end); case 'VALARM': - // If the valarm is wrapped in a recurring event, we need to // expand the recursions, and validate each. // diff --git a/vendor/sabre/dav/lib/CalDAV/Schedule/Plugin.php b/vendor/sabre/dav/lib/CalDAV/Schedule/Plugin.php index a1f8202ec..38a7ca96f 100644 --- a/vendor/sabre/dav/lib/CalDAV/Schedule/Plugin.php +++ b/vendor/sabre/dav/lib/CalDAV/Schedule/Plugin.php @@ -486,6 +486,7 @@ class Plugin extends ServerPlugin $currentObject = null; $objectNode = null; + $oldICalendarData = null; $isNewNode = false; $result = $home->getCalendarObjectByUID($uid); diff --git a/vendor/sabre/dav/lib/CalDAV/SharingPlugin.php b/vendor/sabre/dav/lib/CalDAV/SharingPlugin.php index 090cc34bf..f7dca9be6 100644 --- a/vendor/sabre/dav/lib/CalDAV/SharingPlugin.php +++ b/vendor/sabre/dav/lib/CalDAV/SharingPlugin.php @@ -213,7 +213,6 @@ class SharingPlugin extends DAV\ServerPlugin // Both the DAV:share-resource and CALENDARSERVER:share requests // behave identically. case '{'.Plugin::NS_CALENDARSERVER.'}share': - $sharingPlugin = $this->server->getPlugin('sharing'); $sharingPlugin->shareResource($path, $message->sharees); @@ -228,7 +227,6 @@ class SharingPlugin extends DAV\ServerPlugin // The invite-reply document is sent when the user replies to an // invitation of a calendar share. case '{'.Plugin::NS_CALENDARSERVER.'}invite-reply': - // This only works on the calendar-home-root node. if (!$node instanceof CalendarHome) { return; @@ -272,7 +270,6 @@ class SharingPlugin extends DAV\ServerPlugin return false; case '{'.Plugin::NS_CALENDARSERVER.'}publish-calendar': - // We can only deal with IShareableCalendar objects if (!$node instanceof ISharedCalendar) { return; @@ -300,7 +297,6 @@ class SharingPlugin extends DAV\ServerPlugin return false; case '{'.Plugin::NS_CALENDARSERVER.'}unpublish-calendar': - // We can only deal with IShareableCalendar objects if (!$node instanceof ISharedCalendar) { return; diff --git a/vendor/sabre/dav/lib/CalDAV/Xml/Filter/CalendarData.php b/vendor/sabre/dav/lib/CalDAV/Xml/Filter/CalendarData.php index baa4250ab..c9656d8a3 100644 --- a/vendor/sabre/dav/lib/CalDAV/Xml/Filter/CalendarData.php +++ b/vendor/sabre/dav/lib/CalDAV/Xml/Filter/CalendarData.php @@ -60,7 +60,6 @@ class CalendarData implements XmlDeserializable foreach ($elems as $elem) { switch ($elem['name']) { case '{'.Plugin::NS_CALDAV.'}expand': - $result['expand'] = [ 'start' => isset($elem['attributes']['start']) ? DateTimeParser::parseDateTime($elem['attributes']['start']) : null, 'end' => isset($elem['attributes']['end']) ? DateTimeParser::parseDateTime($elem['attributes']['end']) : null, diff --git a/vendor/sabre/dav/lib/CardDAV/Backend/PDO.php b/vendor/sabre/dav/lib/CardDAV/Backend/PDO.php index a33de48de..966d7ba09 100644 --- a/vendor/sabre/dav/lib/CardDAV/Backend/PDO.php +++ b/vendor/sabre/dav/lib/CardDAV/Backend/PDO.php @@ -6,6 +6,7 @@ namespace Sabre\CardDAV\Backend; use Sabre\CardDAV; use Sabre\DAV; +use Sabre\DAV\PropPatch; /** * PDO CardDAV backend. @@ -93,7 +94,7 @@ class PDO extends AbstractBackend implements SyncSupport * * @param string $addressBookId */ - public function updateAddressBook($addressBookId, \Sabre\DAV\PropPatch $propPatch) + public function updateAddressBook($addressBookId, PropPatch $propPatch) { $supportedProperties = [ '{DAV:}displayname', diff --git a/vendor/sabre/dav/lib/CardDAV/Plugin.php b/vendor/sabre/dav/lib/CardDAV/Plugin.php index 09d1f593d..c2d31d9df 100644 --- a/vendor/sabre/dav/lib/CardDAV/Plugin.php +++ b/vendor/sabre/dav/lib/CardDAV/Plugin.php @@ -587,14 +587,21 @@ class Plugin extends DAV\ServerPlugin 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']]->getValue(), $filter['text-match']['value'], $filter['text-match']['collation'], $filter['text-match']['match-type']); + if (isset($vProperty[$filter['name']])) { + $success = DAV\StringUtil::textMatch( + $vProperty[$filter['name']]->getValue(), + $filter['text-match']['value'], + $filter['text-match']['collation'], + $filter['text-match']['match-type'] + ); + if ($filter['text-match']['negate-condition']) { + $success = !$success; + } + } if ($success) { break; } } - if ($filter['text-match']['negate-condition']) { - $success = !$success; - } } // else // There are two conditions where we can already determine whether @@ -628,15 +635,15 @@ class Plugin extends DAV\ServerPlugin $success = false; foreach ($texts as $haystack) { $success = DAV\StringUtil::textMatch($haystack, $filter['value'], $filter['collation'], $filter['match-type']); + if ($filter['negate-condition']) { + $success = !$success; + } // Breaking on the first match if ($success) { break; } } - if ($filter['negate-condition']) { - $success = !$success; - } if ($success && 'anyof' === $test) { return true; diff --git a/vendor/sabre/dav/lib/CardDAV/Xml/Request/AddressBookQueryReport.php b/vendor/sabre/dav/lib/CardDAV/Xml/Request/AddressBookQueryReport.php index d3651ae61..e1096fe28 100644 --- a/vendor/sabre/dav/lib/CardDAV/Xml/Request/AddressBookQueryReport.php +++ b/vendor/sabre/dav/lib/CardDAV/Xml/Request/AddressBookQueryReport.php @@ -146,7 +146,6 @@ class AddressBookQueryReport implements XmlDeserializable } break; case '{'.Plugin::NS_CARDDAV.'}filter': - if (!is_null($newProps['filters'])) { throw new BadRequest('You can only include 1 {'.Plugin::NS_CARDDAV.'}filter element'); } diff --git a/vendor/sabre/dav/lib/DAV/Browser/Plugin.php b/vendor/sabre/dav/lib/DAV/Browser/Plugin.php index 915f2895b..2f155d9ea 100644 --- a/vendor/sabre/dav/lib/DAV/Browser/Plugin.php +++ b/vendor/sabre/dav/lib/DAV/Browser/Plugin.php @@ -157,6 +157,9 @@ class Plugin extends DAV\ServerPlugin public function httpPOST(RequestInterface $request, ResponseInterface $response) { $contentType = $request->getHeader('Content-Type'); + if (!\is_string($contentType)) { + return; + } list($contentType) = explode(';', $contentType); if ('application/x-www-form-urlencoded' !== $contentType && 'multipart/form-data' !== $contentType) { @@ -209,7 +212,6 @@ class Plugin extends DAV\ServerPlugin // @codeCoverageIgnoreStart case 'put': - if ($_FILES) { $file = current($_FILES); } else { diff --git a/vendor/sabre/dav/lib/DAV/Exception/MethodNotAllowed.php b/vendor/sabre/dav/lib/DAV/Exception/MethodNotAllowed.php index d1ac349bd..dbf42ed9f 100644 --- a/vendor/sabre/dav/lib/DAV/Exception/MethodNotAllowed.php +++ b/vendor/sabre/dav/lib/DAV/Exception/MethodNotAllowed.php @@ -5,6 +5,7 @@ declare(strict_types=1); namespace Sabre\DAV\Exception; use Sabre\DAV; +use Sabre\DAV\Server; /** * MethodNotAllowed. @@ -34,7 +35,7 @@ class MethodNotAllowed extends DAV\Exception * * @return array */ - public function getHTTPHeaders(\Sabre\DAV\Server $server) + public function getHTTPHeaders(Server $server) { $methods = $server->getAllowedMethods($server->getRequestUri()); diff --git a/vendor/sabre/dav/lib/DAV/FSExt/File.php b/vendor/sabre/dav/lib/DAV/FSExt/File.php index 060ef5a48..74849b564 100644 --- a/vendor/sabre/dav/lib/DAV/FSExt/File.php +++ b/vendor/sabre/dav/lib/DAV/FSExt/File.php @@ -41,7 +41,7 @@ class File extends Node implements DAV\PartialUpdate\IPatchSupport * * The second argument is the type of update we're doing. * This is either: - * * 1. append + * * 1. append (default) * * 2. update based on a start byte * * 3. update based on an end byte *; @@ -75,6 +75,9 @@ class File extends Node implements DAV\PartialUpdate\IPatchSupport $f = fopen($this->path, 'c'); fseek($f, $offset, SEEK_END); break; + default: + $f = fopen($this->path, 'a'); + break; } if (is_string($data)) { fwrite($f, $data); diff --git a/vendor/sabre/dav/lib/DAV/Server.php b/vendor/sabre/dav/lib/DAV/Server.php index 4c213c1bd..de663d0c1 100644 --- a/vendor/sabre/dav/lib/DAV/Server.php +++ b/vendor/sabre/dav/lib/DAV/Server.php @@ -25,8 +25,8 @@ use Sabre\Xml\Writer; */ class Server implements LoggerAwareInterface, EmitterInterface { - use WildcardEmitterTrait; use LoggerAwareTrait; + use WildcardEmitterTrait; /** * Infinity is used for some request supporting the HTTP Depth header and indicates that the operation should traverse the entire tree. diff --git a/vendor/sabre/dav/lib/DAV/Sharing/Plugin.php b/vendor/sabre/dav/lib/DAV/Sharing/Plugin.php index 3a41e67b4..e7adbeee6 100644 --- a/vendor/sabre/dav/lib/DAV/Sharing/Plugin.php +++ b/vendor/sabre/dav/lib/DAV/Sharing/Plugin.php @@ -179,7 +179,6 @@ class Plugin extends ServerPlugin switch ($documentType) { case '{DAV:}share-resource': - $this->shareResource($path, $message->sharees); $response->setStatus(200); // Adding this because sending a response body may cause issues, diff --git a/vendor/sabre/dav/lib/DAV/Tree.php b/vendor/sabre/dav/lib/DAV/Tree.php index aedc0155d..2417979a6 100644 --- a/vendor/sabre/dav/lib/DAV/Tree.php +++ b/vendor/sabre/dav/lib/DAV/Tree.php @@ -292,6 +292,8 @@ class Tree $destinationName = $source->getName(); } + $destination = null; + if ($source instanceof IFile) { $data = $source->get(); diff --git a/vendor/sabre/dav/lib/DAV/Version.php b/vendor/sabre/dav/lib/DAV/Version.php index 70948305e..b25d6c07a 100644 --- a/vendor/sabre/dav/lib/DAV/Version.php +++ b/vendor/sabre/dav/lib/DAV/Version.php @@ -16,5 +16,5 @@ class Version /** * Full version number. */ - public const VERSION = '4.1.3'; + public const VERSION = '4.1.5'; } diff --git a/vendor/sabre/dav/lib/DAV/Xml/Property/GetLastModified.php b/vendor/sabre/dav/lib/DAV/Xml/Property/GetLastModified.php index c6f6d421c..efc15c293 100644 --- a/vendor/sabre/dav/lib/DAV/Xml/Property/GetLastModified.php +++ b/vendor/sabre/dav/lib/DAV/Xml/Property/GetLastModified.php @@ -98,7 +98,6 @@ class GetLastModified implements Element */ public static function xmlDeserialize(Reader $reader) { - return - new self(new DateTime($reader->parseInnerTree())); + return new self(new DateTime($reader->parseInnerTree())); } } diff --git a/vendor/sabre/dav/lib/DAV/Xml/Property/Href.php b/vendor/sabre/dav/lib/DAV/Xml/Property/Href.php index 0ed14dcf3..f88ce814a 100644 --- a/vendor/sabre/dav/lib/DAV/Xml/Property/Href.php +++ b/vendor/sabre/dav/lib/DAV/Xml/Property/Href.php @@ -39,9 +39,6 @@ class Href implements Element, HtmlOutput * * You must either pass a string for a single href, or an array of hrefs. * - * If auto-prefix is set to false, the hrefs will be treated as absolute - * and not relative to the servers base uri. - * * @param string|string[] $hrefs */ public function __construct($hrefs) diff --git a/vendor/sabre/dav/lib/DAV/Xml/Property/ResourceType.php b/vendor/sabre/dav/lib/DAV/Xml/Property/ResourceType.php index 6532b70c9..75ddcba3f 100644 --- a/vendor/sabre/dav/lib/DAV/Xml/Property/ResourceType.php +++ b/vendor/sabre/dav/lib/DAV/Xml/Property/ResourceType.php @@ -94,8 +94,7 @@ class ResourceType extends Element\Elements implements HtmlOutput */ public static function xmlDeserialize(Reader $reader) { - return - new self(parent::xmlDeserialize($reader)); + return new self(parent::xmlDeserialize($reader)); } /** diff --git a/vendor/sabre/dav/phpstan.neon b/vendor/sabre/dav/phpstan.neon deleted file mode 100644 index 5335bc651..000000000 --- a/vendor/sabre/dav/phpstan.neon +++ /dev/null @@ -1,2 +0,0 @@ -parameters: - level: 0 diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/AbstractPDOTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/AbstractPDOTest.php deleted file mode 100644 index 9460b8922..000000000 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/AbstractPDOTest.php +++ /dev/null @@ -1,1397 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\CalDAV\Backend; - -use Sabre\CalDAV; -use Sabre\DAV; -use Sabre\DAV\PropPatch; -use Sabre\DAV\Xml\Element\Sharee; - -abstract class AbstractPDOTest extends \PHPUnit\Framework\TestCase -{ - use DAV\DbTestHelperTrait; - - protected $pdo; - - public function setup(): void - { - $this->dropTables([ - 'calendarobjects', - 'calendars', - 'calendarinstances', - 'calendarchanges', - 'calendarsubscriptions', - 'schedulingobjects', - ]); - $this->createSchema('calendars'); - - $this->pdo = $this->getDb(); - } - - public function testConstruct() - { - $backend = new PDO($this->pdo); - $this->assertTrue($backend instanceof PDO); - } - - /** - * @depends testConstruct - */ - public function testGetCalendarsForUserNoCalendars() - { - $backend = new PDO($this->pdo); - $calendars = $backend->getCalendarsForUser('principals/user2'); - $this->assertEquals([], $calendars); - } - - /** - * @depends testConstruct - */ - public function testCreateCalendarAndFetch() - { - $backend = new PDO($this->pdo); - $returnedId = $backend->createCalendar('principals/user2', 'somerandomid', [ - '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set' => new CalDAV\Xml\Property\SupportedCalendarComponentSet(['VEVENT']), - '{DAV:}displayname' => 'Hello!', - '{urn:ietf:params:xml:ns:caldav}schedule-calendar-transp' => new CalDAV\Xml\Property\ScheduleCalendarTransp('transparent'), - ]); - $calendars = $backend->getCalendarsForUser('principals/user2'); - - $elementCheck = [ - 'uri' => 'somerandomid', - '{DAV:}displayname' => 'Hello!', - '{urn:ietf:params:xml:ns:caldav}calendar-description' => '', - '{urn:ietf:params:xml:ns:caldav}schedule-calendar-transp' => new CalDAV\Xml\Property\ScheduleCalendarTransp('transparent'), - 'share-access' => \Sabre\DAV\Sharing\Plugin::ACCESS_SHAREDOWNER, - ]; - - $this->assertIsArray($calendars); - $this->assertEquals(1, count($calendars)); - - foreach ($elementCheck as $name => $value) { - $this->assertArrayHasKey($name, $calendars[0]); - $this->assertEquals($value, $calendars[0][$name]); - } - } - - /** - * @depends testConstruct - */ - public function testUpdateCalendarAndFetch() - { - $backend = new PDO($this->pdo); - - //Creating a new calendar - $newId = $backend->createCalendar('principals/user2', 'somerandomid', []); - - $propPatch = new PropPatch([ - '{DAV:}displayname' => 'myCalendar', - '{urn:ietf:params:xml:ns:caldav}schedule-calendar-transp' => new CalDAV\Xml\Property\ScheduleCalendarTransp('transparent'), - ]); - - // Updating the calendar - $backend->updateCalendar($newId, $propPatch); - $result = $propPatch->commit(); - - // Verifying the result of the update - $this->assertTrue($result); - - // Fetching all calendars from this user - $calendars = $backend->getCalendarsForUser('principals/user2'); - - // Checking if all the information is still correct - $elementCheck = [ - 'id' => $newId, - 'uri' => 'somerandomid', - '{DAV:}displayname' => 'myCalendar', - '{urn:ietf:params:xml:ns:caldav}calendar-description' => '', - '{urn:ietf:params:xml:ns:caldav}calendar-timezone' => '', - '{http://calendarserver.org/ns/}getctag' => 'http://sabre.io/ns/sync/2', - '{urn:ietf:params:xml:ns:caldav}schedule-calendar-transp' => new CalDAV\Xml\Property\ScheduleCalendarTransp('transparent'), - ]; - - $this->assertIsArray($calendars); - $this->assertEquals(1, count($calendars)); - - foreach ($elementCheck as $name => $value) { - $this->assertArrayHasKey($name, $calendars[0]); - $this->assertEquals($value, $calendars[0][$name]); - } - } - - /** - * @depends testConstruct - */ - public function testUpdateCalendarBadId() - { - $this->expectException('InvalidArgumentException'); - $backend = new PDO($this->pdo); - - //Creating a new calendar - $newId = $backend->createCalendar('principals/user2', 'somerandomid', []); - - $propPatch = new PropPatch([ - '{DAV:}displayname' => 'myCalendar', - '{urn:ietf:params:xml:ns:caldav}schedule-calendar-transp' => new CalDAV\Xml\Property\ScheduleCalendarTransp('transparent'), - ]); - - // Updating the calendar - $backend->updateCalendar('raaaa', $propPatch); - } - - /** - * @depends testUpdateCalendarAndFetch - */ - public function testUpdateCalendarUnknownProperty() - { - $backend = new PDO($this->pdo); - - //Creating a new calendar - $newId = $backend->createCalendar('principals/user2', 'somerandomid', []); - - $propPatch = new PropPatch([ - '{DAV:}displayname' => 'myCalendar', - '{DAV:}yourmom' => 'wittycomment', - ]); - - // Updating the calendar - $backend->updateCalendar($newId, $propPatch); - $propPatch->commit(); - - // Verifying the result of the update - $this->assertEquals([ - '{DAV:}yourmom' => 403, - '{DAV:}displayname' => 424, - ], $propPatch->getResult()); - } - - /** - * @depends testCreateCalendarAndFetch - */ - public function testDeleteCalendar() - { - $backend = new PDO($this->pdo); - $returnedId = $backend->createCalendar('principals/user2', 'somerandomid', [ - '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set' => new CalDAV\Xml\Property\SupportedCalendarComponentSet(['VEVENT']), - '{DAV:}displayname' => 'Hello!', - ]); - - $backend->deleteCalendar($returnedId); - - $calendars = $backend->getCalendarsForUser('principals/user2'); - $this->assertEquals([], $calendars); - } - - /** - * @depends testCreateCalendarAndFetch - */ - public function testDeleteCalendarBadID() - { - $this->expectException('InvalidArgumentException'); - $backend = new PDO($this->pdo); - $returnedId = $backend->createCalendar('principals/user2', 'somerandomid', [ - '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set' => new CalDAV\Xml\Property\SupportedCalendarComponentSet(['VEVENT']), - '{DAV:}displayname' => 'Hello!', - ]); - - $backend->deleteCalendar('bad-id'); - } - - /** - * @depends testCreateCalendarAndFetch - */ - public function testCreateCalendarIncorrectComponentSet() - { - $this->expectException('Sabre\DAV\Exception'); - $backend = new PDO($this->pdo); - - //Creating a new calendar - $newId = $backend->createCalendar('principals/user2', 'somerandomid', [ - '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set' => 'blabla', - ]); - } - - public function testCreateCalendarObject() - { - $backend = new PDO($this->pdo); - $returnedId = $backend->createCalendar('principals/user2', 'somerandomid', []); - - $object = "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART;VALUE=DATE:20120101\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n"; - - $backend->createCalendarObject($returnedId, 'random-id', $object); - - $result = $this->pdo->query('SELECT etag, size, calendardata, firstoccurence, lastoccurence, componenttype FROM calendarobjects WHERE uri = \'random-id\''); - - $row = $result->fetch(\PDO::FETCH_ASSOC); - if (is_resource($row['calendardata'])) { - $row['calendardata'] = stream_get_contents($row['calendardata']); - } - - $this->assertEquals([ - 'etag' => md5($object), - 'size' => strlen($object), - 'calendardata' => $object, - 'firstoccurence' => strtotime('20120101'), - 'lastoccurence' => strtotime('20120101') + (3600 * 24), - 'componenttype' => 'VEVENT', - ], $row); - } - - public function testGetMultipleObjects() - { - $backend = new PDO($this->pdo); - $returnedId = $backend->createCalendar('principals/user2', 'somerandomid', []); - - $object = "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART;VALUE=DATE:20120101\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n"; - - $backend->createCalendarObject($returnedId, 'id-1', $object); - $backend->createCalendarObject($returnedId, 'id-2', $object); - - $check = [ - [ - 'id' => 1, - 'etag' => '"'.md5($object).'"', - 'uri' => 'id-1', - 'size' => strlen($object), - 'calendardata' => $object, - 'lastmodified' => null, - ], - [ - 'id' => 2, - 'etag' => '"'.md5($object).'"', - 'uri' => 'id-2', - 'size' => strlen($object), - 'calendardata' => $object, - 'lastmodified' => null, - ], - ]; - - $result = $backend->getMultipleCalendarObjects($returnedId, ['id-1', 'id-2']); - - foreach ($check as $index => $props) { - foreach ($props as $key => $expected) { - $actual = $result[$index][$key]; - - switch ($key) { - case 'lastmodified': - $this->assertIsInt($actual); - break; - case 'calendardata': - if (is_resource($actual)) { - $actual = stream_get_contents($actual); - } - // no break intentional - default: - $this->assertEquals($expected, $actual); - } - } - } - } - - /** - * @depends testGetMultipleObjects - */ - public function testGetMultipleObjectsBadId() - { - $this->expectException('InvalidArgumentException'); - $backend = new PDO($this->pdo); - $backend->getMultipleCalendarObjects('bad-id', ['foo-bar']); - } - - /** - * @depends testCreateCalendarObject - */ - public function testCreateCalendarObjectNoComponent() - { - $this->expectException('Sabre\DAV\Exception\BadRequest'); - $backend = new PDO($this->pdo); - $returnedId = $backend->createCalendar('principals/user2', 'somerandomid', []); - - $object = "BEGIN:VCALENDAR\r\nBEGIN:VTIMEZONE\r\nEND:VTIMEZONE\r\nEND:VCALENDAR\r\n"; - - $backend->createCalendarObject($returnedId, 'random-id', $object); - } - - /** - * @depends testCreateCalendarObject - */ - public function testCreateCalendarObjectDuration() - { - $backend = new PDO($this->pdo); - $returnedId = $backend->createCalendar('principals/user2', 'somerandomid', []); - - $object = "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART;VALUE=DATE:20120101\r\nDURATION:P2D\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n"; - - $backend->createCalendarObject($returnedId, 'random-id', $object); - - $result = $this->pdo->query('SELECT etag, size, calendardata, firstoccurence, lastoccurence, componenttype FROM calendarobjects WHERE uri = \'random-id\''); - - $row = $result->fetch(\PDO::FETCH_ASSOC); - if (is_resource($row['calendardata'])) { - $row['calendardata'] = stream_get_contents($row['calendardata']); - } - - $this->assertEquals([ - 'etag' => md5($object), - 'size' => strlen($object), - 'calendardata' => $object, - 'firstoccurence' => strtotime('20120101'), - 'lastoccurence' => strtotime('20120101') + (3600 * 48), - 'componenttype' => 'VEVENT', - ], $row); - } - - /** - * @depends testCreateCalendarObject - */ - public function testCreateCalendarObjectBadId() - { - $this->expectException('InvalidArgumentException'); - $backend = new PDO($this->pdo); - $returnedId = $backend->createCalendar('principals/user2', 'somerandomid', []); - - $object = "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART;VALUE=DATE:20120101\r\nDURATION:P2D\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n"; - - $backend->createCalendarObject('bad-id', 'random-id', $object); - } - - /** - * @depends testCreateCalendarObject - */ - public function testCreateCalendarObjectNoDTEND() - { - $backend = new PDO($this->pdo); - $returnedId = $backend->createCalendar('principals/user2', 'somerandomid', []); - - $object = "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART;VALUE=DATE-TIME:20120101T100000Z\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n"; - - $backend->createCalendarObject($returnedId, 'random-id', $object); - - $result = $this->pdo->query('SELECT etag, size, calendardata, firstoccurence, lastoccurence, componenttype FROM calendarobjects WHERE uri = \'random-id\''); - $row = $result->fetch(\PDO::FETCH_ASSOC); - if (is_resource($row['calendardata'])) { - $row['calendardata'] = stream_get_contents($row['calendardata']); - } - - $this->assertEquals([ - 'etag' => md5($object), - 'size' => strlen($object), - 'calendardata' => $object, - 'firstoccurence' => strtotime('2012-01-01 10:00:00'), - 'lastoccurence' => strtotime('2012-01-01 10:00:00'), - 'componenttype' => 'VEVENT', - ], $row); - } - - /** - * @depends testCreateCalendarObject - */ - public function testCreateCalendarObjectWithDTEND() - { - $backend = new PDO($this->pdo); - $returnedId = $backend->createCalendar('principals/user2', 'somerandomid', []); - - $object = "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART;VALUE=DATE-TIME:20120101T100000Z\r\nDTEND:20120101T110000Z\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n"; - - $backend->createCalendarObject($returnedId, 'random-id', $object); - - $result = $this->pdo->query('SELECT etag, size, calendardata, firstoccurence, lastoccurence, componenttype FROM calendarobjects WHERE uri = \'random-id\''); - $row = $result->fetch(\PDO::FETCH_ASSOC); - if (is_resource($row['calendardata'])) { - $row['calendardata'] = stream_get_contents($row['calendardata']); - } - - $this->assertEquals([ - 'etag' => md5($object), - 'size' => strlen($object), - 'calendardata' => $object, - 'firstoccurence' => strtotime('2012-01-01 10:00:00'), - 'lastoccurence' => strtotime('2012-01-01 11:00:00'), - 'componenttype' => 'VEVENT', - ], $row); - } - - /** - * @depends testCreateCalendarObject - */ - public function testCreateCalendarObjectInfiniteRecurrence() - { - $backend = new PDO($this->pdo); - $returnedId = $backend->createCalendar('principals/user2', 'somerandomid', []); - - $object = "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART;VALUE=DATE-TIME:20120101T100000Z\r\nRRULE:FREQ=DAILY\r\nUID:foo\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n"; - - $backend->createCalendarObject($returnedId, 'random-id', $object); - - $result = $this->pdo->query('SELECT etag, size, calendardata, firstoccurence, lastoccurence, componenttype FROM calendarobjects WHERE uri = \'random-id\''); - $row = $result->fetch(\PDO::FETCH_ASSOC); - if (is_resource($row['calendardata'])) { - $row['calendardata'] = stream_get_contents($row['calendardata']); - } - - $this->assertEquals([ - 'etag' => md5($object), - 'size' => strlen($object), - 'calendardata' => $object, - 'firstoccurence' => strtotime('2012-01-01 10:00:00'), - 'lastoccurence' => strtotime(PDO::MAX_DATE), - 'componenttype' => 'VEVENT', - ], $row); - } - - /** - * @depends testCreateCalendarObject - */ - public function testCreateCalendarObjectEndingRecurrence() - { - $backend = new PDO($this->pdo); - $returnedId = $backend->createCalendar('principals/user2', 'somerandomid', []); - - $object = "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART;VALUE=DATE-TIME:20120101T100000Z\r\nDTEND;VALUE=DATE-TIME:20120101T110000Z\r\nUID:foo\r\nRRULE:FREQ=DAILY;COUNT=1000\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n"; - - $backend->createCalendarObject($returnedId, 'random-id', $object); - - $result = $this->pdo->query('SELECT etag, size, calendardata, firstoccurence, lastoccurence, componenttype FROM calendarobjects WHERE uri = \'random-id\''); - $row = $result->fetch(\PDO::FETCH_ASSOC); - if (is_resource($row['calendardata'])) { - $row['calendardata'] = stream_get_contents($row['calendardata']); - } - - $this->assertEquals([ - 'etag' => md5($object), - 'size' => strlen($object), - 'calendardata' => $object, - 'firstoccurence' => strtotime('2012-01-01 10:00:00'), - 'lastoccurence' => strtotime('2012-01-01 11:00:00') + (3600 * 24 * 999), - 'componenttype' => 'VEVENT', - ], $row); - } - - /** - * @depends testCreateCalendarObject - */ - public function testCreateCalendarObjectTask() - { - $backend = new PDO($this->pdo); - $returnedId = $backend->createCalendar('principals/user2', 'somerandomid', []); - - $object = "BEGIN:VCALENDAR\r\nBEGIN:VTODO\r\nDUE;VALUE=DATE-TIME:20120101T100000Z\r\nEND:VTODO\r\nEND:VCALENDAR\r\n"; - - $backend->createCalendarObject($returnedId, 'random-id', $object); - - $result = $this->pdo->query('SELECT etag, size, calendardata, firstoccurence, lastoccurence, componenttype FROM calendarobjects WHERE uri = \'random-id\''); - $row = $result->fetch(\PDO::FETCH_ASSOC); - if (is_resource($row['calendardata'])) { - $row['calendardata'] = stream_get_contents($row['calendardata']); - } - - $this->assertEquals([ - 'etag' => md5($object), - 'size' => strlen($object), - 'calendardata' => $object, - 'firstoccurence' => null, - 'lastoccurence' => null, - 'componenttype' => 'VTODO', - ], $row); - } - - /** - * @depends testCreateCalendarObject - */ - public function testGetCalendarObjects() - { - $backend = new PDO($this->pdo); - $returnedId = $backend->createCalendar('principals/user2', 'somerandomid', []); - - $object = "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART;VALUE=DATE:20120101\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n"; - $backend->createCalendarObject($returnedId, 'random-id', $object); - - $data = $backend->getCalendarObjects($returnedId); - - $this->assertEquals(1, count($data)); - $data = $data[0]; - - $this->assertEquals('random-id', $data['uri']); - $this->assertEquals(strlen($object), $data['size']); - } - - /** - * @depends testGetCalendarObjects - */ - public function testGetCalendarObjectsBadId() - { - $this->expectException('InvalidArgumentException'); - $backend = new PDO($this->pdo); - $backend->getCalendarObjects('bad-id'); - } - - /** - * @depends testGetCalendarObjects - */ - public function testGetCalendarObjectBadId() - { - $this->expectException('InvalidArgumentException'); - $backend = new PDO($this->pdo); - $backend->getCalendarObject('bad-id', 'foo-bar'); - } - - /** - * @depends testCreateCalendarObject - */ - public function testGetCalendarObjectByUID() - { - $backend = new PDO($this->pdo); - $returnedId = $backend->createCalendar('principals/user2', 'somerandomid', []); - - $object = "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nUID:foo\r\nDTSTART;VALUE=DATE:20120101\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n"; - $backend->createCalendarObject($returnedId, 'random-id', $object); - - $this->assertNull( - $backend->getCalendarObjectByUID('principals/user2', 'bar') - ); - $this->assertEquals( - 'somerandomid/random-id', - $backend->getCalendarObjectByUID('principals/user2', 'foo') - ); - } - - /** - * @depends testCreateCalendarObject - */ - public function testUpdateCalendarObject() - { - $backend = new PDO($this->pdo); - $returnedId = $backend->createCalendar('principals/user2', 'somerandomid', []); - - $object = "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART;VALUE=DATE:20120101\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n"; - $object2 = "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART;VALUE=DATE:20130101\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n"; - $backend->createCalendarObject($returnedId, 'random-id', $object); - $backend->updateCalendarObject($returnedId, 'random-id', $object2); - - $data = $backend->getCalendarObject($returnedId, 'random-id'); - - if (is_resource($data['calendardata'])) { - $data['calendardata'] = stream_get_contents($data['calendardata']); - } - - $this->assertEquals($object2, $data['calendardata']); - $this->assertEquals('random-id', $data['uri']); - } - - /** - * @depends testUpdateCalendarObject - */ - public function testUpdateCalendarObjectBadId() - { - $this->expectException('InvalidArgumentException'); - $backend = new PDO($this->pdo); - $backend->updateCalendarObject('bad-id', 'object-id', 'objectdata'); - } - - /** - * @depends testCreateCalendarObject - */ - public function testDeleteCalendarObject() - { - $backend = new PDO($this->pdo); - $returnedId = $backend->createCalendar('principals/user2', 'somerandomid', []); - - $object = "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART;VALUE=DATE:20120101\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n"; - $backend->createCalendarObject($returnedId, 'random-id', $object); - $backend->deleteCalendarObject($returnedId, 'random-id'); - - $data = $backend->getCalendarObject($returnedId, 'random-id'); - $this->assertNull($data); - } - - /** - * @depends testDeleteCalendarObject - */ - public function testDeleteCalendarObjectBadId() - { - $this->expectException('InvalidArgumentException'); - $backend = new PDO($this->pdo); - $returnedId = $backend->createCalendar('principals/user2', 'somerandomid', []); - - $object = "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART;VALUE=DATE:20120101\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n"; - $backend->createCalendarObject($returnedId, 'random-id', $object); - $backend->deleteCalendarObject('bad-id', 'random-id'); - } - - public function testCalendarQueryNoResult() - { - $abstract = new PDO($this->pdo); - $filters = [ - 'name' => 'VCALENDAR', - 'comp-filters' => [ - [ - 'name' => 'VJOURNAL', - 'comp-filters' => [], - 'prop-filters' => [], - 'is-not-defined' => false, - 'time-range' => null, - ], - ], - 'prop-filters' => [], - 'is-not-defined' => false, - 'time-range' => null, - ]; - - $this->assertEquals([ - ], $abstract->calendarQuery([1, 1], $filters)); - } - - /** - * @depends testCalendarQueryNoResult - */ - public function testCalendarQueryBadId() - { - $this->expectException('InvalidArgumentException'); - $abstract = new PDO($this->pdo); - $filters = [ - 'name' => 'VCALENDAR', - 'comp-filters' => [ - [ - 'name' => 'VJOURNAL', - 'comp-filters' => [], - 'prop-filters' => [], - 'is-not-defined' => false, - 'time-range' => null, - ], - ], - 'prop-filters' => [], - 'is-not-defined' => false, - 'time-range' => null, - ]; - - $abstract->calendarQuery('bad-id', $filters); - } - - public function testCalendarQueryTodo() - { - $backend = new PDO($this->pdo); - $backend->createCalendarObject([1, 1], 'todo', "BEGIN:VCALENDAR\r\nBEGIN:VTODO\r\nEND:VTODO\r\nEND:VCALENDAR\r\n"); - $backend->createCalendarObject([1, 1], 'event', "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART:20120101\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n"); - - $filters = [ - 'name' => 'VCALENDAR', - 'comp-filters' => [ - [ - 'name' => 'VTODO', - 'comp-filters' => [], - 'prop-filters' => [], - 'is-not-defined' => false, - 'time-range' => null, - ], - ], - 'prop-filters' => [], - 'is-not-defined' => false, - 'time-range' => null, - ]; - - $this->assertEquals([ - 'todo', - ], $backend->calendarQuery([1, 1], $filters)); - } - - public function testCalendarQueryTodoNotMatch() - { - $backend = new PDO($this->pdo); - $backend->createCalendarObject([1, 1], 'todo', "BEGIN:VCALENDAR\r\nBEGIN:VTODO\r\nEND:VTODO\r\nEND:VCALENDAR\r\n"); - $backend->createCalendarObject([1, 1], 'event', "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART:20120101\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n"); - - $filters = [ - 'name' => 'VCALENDAR', - 'comp-filters' => [ - [ - 'name' => 'VTODO', - 'comp-filters' => [], - 'prop-filters' => [ - [ - 'name' => 'summary', - 'text-match' => null, - 'time-range' => null, - 'param-filters' => [], - 'is-not-defined' => false, - ], - ], - 'is-not-defined' => false, - 'time-range' => null, - ], - ], - 'prop-filters' => [], - 'is-not-defined' => false, - 'time-range' => null, - ]; - - $this->assertEquals([ - ], $backend->calendarQuery([1, 1], $filters)); - } - - public function testCalendarQueryNoFilter() - { - $backend = new PDO($this->pdo); - $backend->createCalendarObject([1, 1], 'todo', "BEGIN:VCALENDAR\r\nBEGIN:VTODO\r\nEND:VTODO\r\nEND:VCALENDAR\r\n"); - $backend->createCalendarObject([1, 1], 'event', "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART:20120101\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n"); - - $filters = [ - 'name' => 'VCALENDAR', - 'comp-filters' => [], - 'prop-filters' => [], - 'is-not-defined' => false, - 'time-range' => null, - ]; - - $result = $backend->calendarQuery([1, 1], $filters); - $this->assertTrue(in_array('todo', $result)); - $this->assertTrue(in_array('event', $result)); - } - - public function testCalendarQueryTimeRange() - { - $backend = new PDO($this->pdo); - $backend->createCalendarObject([1, 1], 'todo', "BEGIN:VCALENDAR\r\nBEGIN:VTODO\r\nEND:VTODO\r\nEND:VCALENDAR\r\n"); - $backend->createCalendarObject([1, 1], 'event', "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART;VALUE=DATE:20120101\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n"); - $backend->createCalendarObject([1, 1], 'event2', "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART;VALUE=DATE:20120103\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n"); - - $filters = [ - 'name' => 'VCALENDAR', - 'comp-filters' => [ - [ - 'name' => 'VEVENT', - 'comp-filters' => [], - 'prop-filters' => [], - 'is-not-defined' => false, - 'time-range' => [ - 'start' => new \DateTime('20120103'), - 'end' => new \DateTime('20120104'), - ], - ], - ], - 'prop-filters' => [], - 'is-not-defined' => false, - 'time-range' => null, - ]; - - $this->assertEquals([ - 'event2', - ], $backend->calendarQuery([1, 1], $filters)); - } - - public function testCalendarQueryTimeRangeNoEnd() - { - $backend = new PDO($this->pdo); - $backend->createCalendarObject([1, 1], 'todo', "BEGIN:VCALENDAR\r\nBEGIN:VTODO\r\nEND:VTODO\r\nEND:VCALENDAR\r\n"); - $backend->createCalendarObject([1, 1], 'event', "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART:20120101\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n"); - $backend->createCalendarObject([1, 1], 'event2', "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART:20120103\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n"); - - $filters = [ - 'name' => 'VCALENDAR', - 'comp-filters' => [ - [ - 'name' => 'VEVENT', - 'comp-filters' => [], - 'prop-filters' => [], - 'is-not-defined' => false, - 'time-range' => [ - 'start' => new \DateTime('20120102'), - 'end' => null, - ], - ], - ], - 'prop-filters' => [], - 'is-not-defined' => false, - 'time-range' => null, - ]; - - $this->assertEquals([ - 'event2', - ], $backend->calendarQuery([1, 1], $filters)); - } - - public function testGetChanges() - { - $backend = new PDO($this->pdo); - $id = $backend->createCalendar( - 'principals/user1', - 'bla', - [] - ); - $result = $backend->getChangesForCalendar($id, null, 1); - - $this->assertEquals([ - 'syncToken' => 1, - 'modified' => [], - 'deleted' => [], - 'added' => [], - ], $result); - - $currentToken = $result['syncToken']; - - $dummyTodo = "BEGIN:VCALENDAR\r\nBEGIN:VTODO\r\nEND:VTODO\r\nEND:VCALENDAR\r\n"; - - $backend->createCalendarObject($id, 'todo1.ics', $dummyTodo); - $backend->createCalendarObject($id, 'todo2.ics', $dummyTodo); - $backend->createCalendarObject($id, 'todo3.ics', $dummyTodo); - $backend->updateCalendarObject($id, 'todo1.ics', $dummyTodo); - $backend->deleteCalendarObject($id, 'todo2.ics'); - - $result = $backend->getChangesForCalendar($id, $currentToken, 1); - - $this->assertEquals([ - 'syncToken' => 6, - 'modified' => ['todo1.ics'], - 'deleted' => ['todo2.ics'], - 'added' => ['todo3.ics'], - ], $result); - - $result = $backend->getChangesForCalendar($id, null, 1); - - $this->assertEquals([ - 'syncToken' => 6, - 'modified' => [], - 'deleted' => [], - 'added' => ['todo1.ics', 'todo3.ics'], - ], $result); - } - - /** - * @depends testGetChanges - */ - public function testGetChangesBadId() - { - $this->expectException('InvalidArgumentException'); - $backend = new PDO($this->pdo); - $id = $backend->createCalendar( - 'principals/user1', - 'bla', - [] - ); - $backend->getChangesForCalendar('bad-id', null, 1); - } - - public function testCreateSubscriptions() - { - $props = [ - '{http://calendarserver.org/ns/}source' => new \Sabre\DAV\Xml\Property\Href('http://example.org/cal.ics', false), - '{DAV:}displayname' => 'cal', - '{http://apple.com/ns/ical/}refreshrate' => 'P1W', - '{http://apple.com/ns/ical/}calendar-color' => '#FF00FFFF', - '{http://calendarserver.org/ns/}subscribed-strip-todos' => true, - //'{http://calendarserver.org/ns/}subscribed-strip-alarms' => true, - '{http://calendarserver.org/ns/}subscribed-strip-attachments' => true, - ]; - - $backend = new PDO($this->pdo); - $backend->createSubscription('principals/user1', 'sub1', $props); - - $subs = $backend->getSubscriptionsForUser('principals/user1'); - - $expected = $props; - $expected['id'] = 1; - $expected['uri'] = 'sub1'; - $expected['principaluri'] = 'principals/user1'; - - unset($expected['{http://calendarserver.org/ns/}source']); - $expected['source'] = 'http://example.org/cal.ics'; - - $this->assertEquals(1, count($subs)); - foreach ($expected as $k => $v) { - $this->assertEquals($subs[0][$k], $expected[$k]); - } - } - - public function testCreateSubscriptionFail() - { - $this->expectException('Sabre\DAV\Exception\Forbidden'); - $props = [ - ]; - - $backend = new PDO($this->pdo); - $backend->createSubscription('principals/user1', 'sub1', $props); - } - - public function testUpdateSubscriptions() - { - $props = [ - '{http://calendarserver.org/ns/}source' => new \Sabre\DAV\Xml\Property\Href('http://example.org/cal.ics', false), - '{DAV:}displayname' => 'cal', - '{http://apple.com/ns/ical/}refreshrate' => 'P1W', - '{http://apple.com/ns/ical/}calendar-color' => '#FF00FFFF', - '{http://calendarserver.org/ns/}subscribed-strip-todos' => true, - //'{http://calendarserver.org/ns/}subscribed-strip-alarms' => true, - '{http://calendarserver.org/ns/}subscribed-strip-attachments' => true, - ]; - - $backend = new PDO($this->pdo); - $backend->createSubscription('principals/user1', 'sub1', $props); - - $newProps = [ - '{DAV:}displayname' => 'new displayname', - '{http://calendarserver.org/ns/}source' => new \Sabre\DAV\Xml\Property\Href('http://example.org/cal2.ics', false), - ]; - - $propPatch = new DAV\PropPatch($newProps); - $backend->updateSubscription(1, $propPatch); - $result = $propPatch->commit(); - - $this->assertTrue($result); - - $subs = $backend->getSubscriptionsForUser('principals/user1'); - - $expected = array_merge($props, $newProps); - $expected['id'] = 1; - $expected['uri'] = 'sub1'; - $expected['principaluri'] = 'principals/user1'; - - unset($expected['{http://calendarserver.org/ns/}source']); - $expected['source'] = 'http://example.org/cal2.ics'; - - $this->assertEquals(1, count($subs)); - foreach ($expected as $k => $v) { - $this->assertEquals($subs[0][$k], $expected[$k]); - } - } - - public function testUpdateSubscriptionsFail() - { - $props = [ - '{http://calendarserver.org/ns/}source' => new \Sabre\DAV\Xml\Property\Href('http://example.org/cal.ics', false), - '{DAV:}displayname' => 'cal', - '{http://apple.com/ns/ical/}refreshrate' => 'P1W', - '{http://apple.com/ns/ical/}calendar-color' => '#FF00FFFF', - '{http://calendarserver.org/ns/}subscribed-strip-todos' => true, - //'{http://calendarserver.org/ns/}subscribed-strip-alarms' => true, - '{http://calendarserver.org/ns/}subscribed-strip-attachments' => true, - ]; - - $backend = new PDO($this->pdo); - $backend->createSubscription('principals/user1', 'sub1', $props); - - $propPatch = new DAV\PropPatch([ - '{DAV:}displayname' => 'new displayname', - '{http://calendarserver.org/ns/}source' => new \Sabre\DAV\Xml\Property\Href('http://example.org/cal2.ics', false), - '{DAV:}unknown' => 'foo', - ]); - - $backend->updateSubscription(1, $propPatch); - $propPatch->commit(); - - $this->assertEquals([ - '{DAV:}unknown' => 403, - '{DAV:}displayname' => 424, - '{http://calendarserver.org/ns/}source' => 424, - ], $propPatch->getResult()); - } - - public function testDeleteSubscriptions() - { - $props = [ - '{http://calendarserver.org/ns/}source' => new \Sabre\DAV\Xml\Property\Href('http://example.org/cal.ics', false), - '{DAV:}displayname' => 'cal', - '{http://apple.com/ns/ical/}refreshrate' => 'P1W', - '{http://apple.com/ns/ical/}calendar-color' => '#FF00FFFF', - '{http://calendarserver.org/ns/}subscribed-strip-todos' => true, - //'{http://calendarserver.org/ns/}subscribed-strip-alarms' => true, - '{http://calendarserver.org/ns/}subscribed-strip-attachments' => true, - ]; - - $backend = new PDO($this->pdo); - $backend->createSubscription('principals/user1', 'sub1', $props); - - $newProps = [ - '{DAV:}displayname' => 'new displayname', - '{http://calendarserver.org/ns/}source' => new \Sabre\DAV\Xml\Property\Href('http://example.org/cal2.ics', false), - ]; - - $backend->deleteSubscription(1); - - $subs = $backend->getSubscriptionsForUser('principals/user1'); - $this->assertEquals(0, count($subs)); - } - - public function testSchedulingMethods() - { - $backend = new PDO($this->pdo); - - $calData = "BEGIN:VCALENDAR\r\nEND:VCALENDAR\r\n"; - - $backend->createSchedulingObject( - 'principals/user1', - 'schedule1.ics', - $calData - ); - - $calDataResource = "BEGIN:VCALENDAR\r\nEND:VCALENDAR\r\n"; - $stream = fopen('data://text/plain,'.$calData, 'r'); - - $backend->createSchedulingObject( - 'principals/user1', - 'schedule1-resource.ics', - $stream - ); - - $expected = [ - 'calendardata' => $calData, - 'uri' => 'schedule1.ics', - 'etag' => '"'.md5($calData).'"', - 'size' => strlen($calData), - ]; - - $expectedResource = [ - 'calendardata' => $calDataResource, - 'uri' => 'schedule1-resource.ics', - 'etag' => '"'.md5($calDataResource).'"', - 'size' => strlen($calDataResource), - ]; - - $result = $backend->getSchedulingObject('principals/user1', 'schedule1.ics'); - foreach ($expected as $k => $v) { - $this->assertArrayHasKey($k, $result); - if (is_resource($result[$k])) { - $result[$k] = stream_get_contents($result[$k]); - } - $this->assertEquals($v, $result[$k]); - } - - $resultResource = $backend->getSchedulingObject('principals/user1', 'schedule1-resource.ics'); - foreach ($expected as $k => $v) { - $this->assertArrayHasKey($k, $result); - if (is_resource($result[$k])) { - $result[$k] = stream_get_contents($result[$k]); - } - $this->assertEquals($v, $result[$k]); - } - - $backend->deleteSchedulingObject('principals/user1', 'schedule1-resource.ics'); - - $results = $backend->getSchedulingObjects('principals/user1'); - - $this->assertEquals(1, count($results)); - $result = $results[0]; - foreach ($expected as $k => $v) { - if (is_resource($result[$k])) { - $result[$k] = stream_get_contents($result[$k]); - } - $this->assertEquals($v, $result[$k]); - } - - $backend->deleteSchedulingObject('principals/user1', 'schedule1.ics'); - $result = $backend->getSchedulingObject('principals/user1', 'schedule1.ics'); - - $this->assertNull($result); - } - - public function testGetInvites() - { - $backend = new PDO($this->pdo); - - // creating a new calendar - $backend->createCalendar('principals/user1', 'somerandomid', []); - $calendar = $backend->getCalendarsForUser('principals/user1')[0]; - - $result = $backend->getInvites($calendar['id']); - $expected = [ - new Sharee([ - 'href' => 'principals/user1', - 'principal' => 'principals/user1', - 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_SHAREDOWNER, - 'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_ACCEPTED, - ]), - ]; - - $this->assertEquals($expected, $result); - } - - /** - * @depends testGetInvites - */ - public function testGetInvitesBadId() - { - $this->expectException('InvalidArgumentException'); - $backend = new PDO($this->pdo); - - // creating a new calendar - $backend->createCalendar('principals/user1', 'somerandomid', []); - $calendar = $backend->getCalendarsForUser('principals/user1')[0]; - - $backend->getInvites('bad-id'); - } - - /** - * @depends testCreateCalendarAndFetch - */ - public function testUpdateInvites() - { - $backend = new PDO($this->pdo); - - // creating a new calendar - $backend->createCalendar('principals/user1', 'somerandomid', []); - $calendar = $backend->getCalendarsForUser('principals/user1')[0]; - - $ownerSharee = new Sharee([ - 'href' => 'principals/user1', - 'principal' => 'principals/user1', - 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_SHAREDOWNER, - 'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_ACCEPTED, - ]); - - // Add a new invite - $backend->updateInvites( - $calendar['id'], - [ - new Sharee([ - 'href' => 'mailto:user@example.org', - 'principal' => 'principals/user2', - 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_READ, - 'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_ACCEPTED, - 'properties' => ['{DAV:}displayname' => 'User 2'], - ]), - ] - ); - - $result = $backend->getInvites($calendar['id']); - $expected = [ - $ownerSharee, - new Sharee([ - 'href' => 'mailto:user@example.org', - 'principal' => 'principals/user2', - 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_READ, - 'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_ACCEPTED, - 'properties' => [ - '{DAV:}displayname' => 'User 2', - ], - ]), - ]; - $this->assertEquals($expected, $result); - - // Checking calendar_instances too - $expectedCalendar = [ - 'id' => [1, 2], - 'principaluri' => 'principals/user2', - '{http://calendarserver.org/ns/}getctag' => 'http://sabre.io/ns/sync/1', - '{http://sabredav.org/ns}sync-token' => '1', - 'share-access' => \Sabre\DAV\Sharing\Plugin::ACCESS_READ, - 'read-only' => true, - 'share-resource-uri' => '/ns/share/1', - ]; - $calendars = $backend->getCalendarsForUser('principals/user2'); - - foreach ($expectedCalendar as $k => $v) { - $this->assertEquals( - $v, - $calendars[0][$k], - 'Key '.$k.' in calendars array did not have the expected value.' - ); - } - - // Updating an invite - $backend->updateInvites( - $calendar['id'], - [ - new Sharee([ - 'href' => 'mailto:user@example.org', - 'principal' => 'principals/user2', - 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_READWRITE, - 'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_ACCEPTED, - ]), - ] - ); - - $result = $backend->getInvites($calendar['id']); - $expected = [ - $ownerSharee, - new Sharee([ - 'href' => 'mailto:user@example.org', - 'principal' => 'principals/user2', - 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_READWRITE, - 'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_ACCEPTED, - 'properties' => [ - '{DAV:}displayname' => 'User 2', - ], - ]), - ]; - $this->assertEquals($expected, $result); - - // Removing an invite - $backend->updateInvites( - $calendar['id'], - [ - new Sharee([ - 'href' => 'mailto:user@example.org', - 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_NOACCESS, - ]), - ] - ); - - $result = $backend->getInvites($calendar['id']); - $expected = [ - $ownerSharee, - ]; - $this->assertEquals($expected, $result); - - // Preventing the owner share from being removed - $backend->updateInvites( - $calendar['id'], - [ - new Sharee([ - 'href' => 'principals/user2', - 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_NOACCESS, - ]), - ] - ); - - $result = $backend->getInvites($calendar['id']); - $expected = [ - new Sharee([ - 'href' => 'principals/user1', - 'principal' => 'principals/user1', - 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_SHAREDOWNER, - 'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_ACCEPTED, - ]), - ]; - $this->assertEquals($expected, $result); - } - - /** - * @depends testUpdateInvites - */ - public function testUpdateInvitesBadId() - { - $this->expectException('InvalidArgumentException'); - $backend = new PDO($this->pdo); - // Add a new invite - $backend->updateInvites( - 'bad-id', - [] - ); - } - - /** - * @depends testUpdateInvites - */ - public function testUpdateInvitesNoPrincipal() - { - $backend = new PDO($this->pdo); - - // creating a new calendar - $backend->createCalendar('principals/user1', 'somerandomid', []); - $calendar = $backend->getCalendarsForUser('principals/user1')[0]; - - $ownerSharee = new Sharee([ - 'href' => 'principals/user1', - 'principal' => 'principals/user1', - 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_SHAREDOWNER, - 'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_ACCEPTED, - ]); - - // Add a new invite - $backend->updateInvites( - $calendar['id'], - [ - new Sharee([ - 'href' => 'mailto:user@example.org', - 'principal' => null, - 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_READ, - 'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_ACCEPTED, - 'properties' => ['{DAV:}displayname' => 'User 2'], - ]), - ] - ); - - $result = $backend->getInvites($calendar['id']); - $expected = [ - $ownerSharee, - new Sharee([ - 'href' => 'mailto:user@example.org', - 'principal' => null, - 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_READ, - 'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_INVALID, - 'properties' => [ - '{DAV:}displayname' => 'User 2', - ], - ]), - ]; - $this->assertEqualsCanonicalizing($expected, $result); - } - - /** - * @depends testUpdateInvites - */ - public function testDeleteSharedCalendar() - { - $backend = new PDO($this->pdo); - - // creating a new calendar - $backend->createCalendar('principals/user1', 'somerandomid', []); - $calendar = $backend->getCalendarsForUser('principals/user1')[0]; - - $ownerSharee = new Sharee([ - 'href' => 'principals/user1', - 'principal' => 'principals/user1', - 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_SHAREDOWNER, - 'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_ACCEPTED, - ]); - - // Add a new invite - $backend->updateInvites( - $calendar['id'], - [ - new Sharee([ - 'href' => 'mailto:user@example.org', - 'principal' => 'principals/user2', - 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_READ, - 'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_ACCEPTED, - 'properties' => ['{DAV:}displayname' => 'User 2'], - ]), - ] - ); - - $expectedCalendar = [ - 'id' => [1, 2], - 'principaluri' => 'principals/user2', - '{http://calendarserver.org/ns/}getctag' => 'http://sabre.io/ns/sync/1', - '{http://sabredav.org/ns}sync-token' => '1', - 'share-access' => \Sabre\DAV\Sharing\Plugin::ACCESS_READ, - 'read-only' => true, - 'share-resource-uri' => '/ns/share/1', - ]; - $calendars = $backend->getCalendarsForUser('principals/user2'); - - foreach ($expectedCalendar as $k => $v) { - $this->assertEquals( - $v, - $calendars[0][$k], - 'Key '.$k.' in calendars array did not have the expected value.' - ); - } - - // Removing the shared calendar. - $backend->deleteCalendar($calendars[0]['id']); - - $this->assertEquals( - [], - $backend->getCalendarsForUser('principals/user2') - ); - - $result = $backend->getInvites($calendar['id']); - $expected = [ - new Sharee([ - 'href' => 'principals/user1', - 'principal' => 'principals/user1', - 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_SHAREDOWNER, - 'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_ACCEPTED, - ]), - ]; - $this->assertEquals($expected, $result); - } - - public function testSetPublishStatus() - { - $this->expectException('Sabre\DAV\Exception\NotImplemented'); - $backend = new PDO($this->pdo); - $backend->setPublishStatus([1, 1], true); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/AbstractTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/AbstractTest.php deleted file mode 100644 index 166de1dab..000000000 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/AbstractTest.php +++ /dev/null @@ -1,184 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\CalDAV\Backend; - -use - Sabre\DAV\PropPatch; - -class AbstractTest extends \PHPUnit\Framework\TestCase -{ - public function testUpdateCalendar() - { - $abstract = new AbstractMock(); - $propPatch = new PropPatch(['{DAV:}displayname' => 'anything']); - - $abstract->updateCalendar('randomid', $propPatch); - $result = $propPatch->commit(); - - $this->assertFalse($result); - } - - public function testCalendarQuery() - { - $abstract = new AbstractMock(); - $filters = [ - 'name' => 'VCALENDAR', - 'comp-filters' => [ - [ - 'name' => 'VEVENT', - 'comp-filters' => [], - 'prop-filters' => [], - 'is-not-defined' => false, - 'time-range' => null, - ], - ], - 'prop-filters' => [], - 'is-not-defined' => false, - 'time-range' => null, - ]; - - $this->assertEquals([ - 'event1.ics', - ], $abstract->calendarQuery(1, $filters)); - } - - public function testGetCalendarObjectByUID() - { - $abstract = new AbstractMock(); - $this->assertNull( - $abstract->getCalendarObjectByUID('principal1', 'zim') - ); - $this->assertEquals( - 'cal1/event1.ics', - $abstract->getCalendarObjectByUID('principal1', 'foo') - ); - $this->assertNull( - $abstract->getCalendarObjectByUID('principal3', 'foo') - ); - $this->assertNull( - $abstract->getCalendarObjectByUID('principal1', 'shared') - ); - } - - public function testGetMultipleCalendarObjects() - { - $abstract = new AbstractMock(); - $result = $abstract->getMultipleCalendarObjects(1, [ - 'event1.ics', - 'task1.ics', - ]); - - $expected = [ - [ - 'id' => 1, - 'calendarid' => 1, - 'uri' => 'event1.ics', - 'calendardata' => "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nUID:foo\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n", - ], - [ - 'id' => 2, - 'calendarid' => 1, - 'uri' => 'task1.ics', - 'calendardata' => "BEGIN:VCALENDAR\r\nBEGIN:VTODO\r\nEND:VTODO\r\nEND:VCALENDAR\r\n", - ], - ]; - - $this->assertEquals($expected, $result); - } -} - -class AbstractMock extends AbstractBackend -{ - public function getCalendarsForUser($principalUri) - { - return [ - [ - 'id' => 1, - 'principaluri' => 'principal1', - 'uri' => 'cal1', - ], - [ - 'id' => 2, - 'principaluri' => 'principal1', - '{http://sabredav.org/ns}owner-principal' => 'principal2', - 'uri' => 'cal1', - ], - ]; - } - - public function createCalendar($principalUri, $calendarUri, array $properties) - { - } - - public function deleteCalendar($calendarId) - { - } - - public function getCalendarObjects($calendarId) - { - switch ($calendarId) { - case 1: - return [ - [ - 'id' => 1, - 'calendarid' => 1, - 'uri' => 'event1.ics', - ], - [ - 'id' => 2, - 'calendarid' => 1, - 'uri' => 'task1.ics', - ], - ]; - case 2: - return [ - [ - 'id' => 3, - 'calendarid' => 2, - 'uri' => 'shared-event.ics', - ], - ]; - } - } - - public function getCalendarObject($calendarId, $objectUri) - { - switch ($objectUri) { - case 'event1.ics': - return [ - 'id' => 1, - 'calendarid' => 1, - 'uri' => 'event1.ics', - 'calendardata' => "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nUID:foo\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n", - ]; - case 'task1.ics': - return [ - 'id' => 2, - 'calendarid' => 1, - 'uri' => 'task1.ics', - 'calendardata' => "BEGIN:VCALENDAR\r\nBEGIN:VTODO\r\nEND:VTODO\r\nEND:VCALENDAR\r\n", - ]; - case 'shared-event.ics': - return [ - 'id' => 3, - 'calendarid' => 2, - 'uri' => 'event1.ics', - 'calendardata' => "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nUID:shared\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n", - ]; - } - } - - public function createCalendarObject($calendarId, $objectUri, $calendarData) - { - } - - public function updateCalendarObject($calendarId, $objectUri, $calendarData) - { - } - - public function deleteCalendarObject($calendarId, $objectUri) - { - } -} diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/Mock.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/Mock.php deleted file mode 100644 index 01ac1b39e..000000000 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/Mock.php +++ /dev/null @@ -1,247 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\CalDAV\Backend; - -use Sabre\CalDAV; -use Sabre\DAV; - -class Mock extends AbstractBackend -{ - protected $calendarData; - protected $calendars; - - public function __construct(array $calendars = [], array $calendarData = []) - { - foreach ($calendars as &$calendar) { - if (!isset($calendar['id'])) { - $calendar['id'] = DAV\UUIDUtil::getUUID(); - } - } - - $this->calendars = $calendars; - $this->calendarData = $calendarData; - } - - /** - * Returns a list of calendars for a principal. - * - * Every project is an array with the following keys: - * * id, a unique id that will be used by other functions to modify the - * calendar. This can be the same as the uri or a database key. - * * uri, which the basename of the uri with which the calendar is - * accessed. - * * principalUri. The owner of the calendar. Almost always the same as - * principalUri passed to this method. - * - * Furthermore it can contain webdav properties in clark notation. A very - * common one is '{DAV:}displayname'. - * - * @param string $principalUri - * - * @return array - */ - public function getCalendarsForUser($principalUri) - { - $r = []; - foreach ($this->calendars as $row) { - if ($row['principaluri'] == $principalUri) { - $r[] = $row; - } - } - - return $r; - } - - /** - * Creates a new calendar for a principal. - * - * If the creation was a success, an id must be returned that can be used to reference - * this calendar in other methods, such as updateCalendar. - * - * This function must return a server-wide unique id that can be used - * later to reference the calendar. - * - * @param string $principalUri - * @param string $calendarUri - * - * @return string|int - */ - public function createCalendar($principalUri, $calendarUri, array $properties) - { - $id = DAV\UUIDUtil::getUUID(); - $this->calendars[] = array_merge([ - 'id' => $id, - 'principaluri' => $principalUri, - 'uri' => $calendarUri, - '{'.CalDAV\Plugin::NS_CALDAV.'}supported-calendar-component-set' => new CalDAV\Xml\Property\SupportedCalendarComponentSet(['VEVENT', 'VTODO']), - ], $properties); - - return $id; - } - - /** - * Updates properties for a calendar. - * - * The list of mutations is stored in a Sabre\DAV\PropPatch object. - * To do the actual updates, you must tell this object which properties - * you're going to process with the handle() method. - * - * Calling the handle method is like telling the PropPatch object "I - * promise I can handle updating this property". - * - * Read the PropPatch documentation for more info and examples. - * - * @param mixed $calendarId - */ - public function updateCalendar($calendarId, \Sabre\DAV\PropPatch $propPatch) - { - $propPatch->handleRemaining(function ($props) use ($calendarId) { - foreach ($this->calendars as $k => $calendar) { - if ($calendar['id'] === $calendarId) { - foreach ($props as $propName => $propValue) { - if (is_null($propValue)) { - unset($this->calendars[$k][$propName]); - } else { - $this->calendars[$k][$propName] = $propValue; - } - } - - return true; - } - } - }); - } - - /** - * Delete a calendar and all it's objects. - * - * @param string $calendarId - */ - public function deleteCalendar($calendarId) - { - foreach ($this->calendars as $k => $calendar) { - if ($calendar['id'] === $calendarId) { - unset($this->calendars[$k]); - } - } - } - - /** - * Returns all calendar objects within a calendar object. - * - * Every item contains an array with the following keys: - * * id - unique identifier which will be used for subsequent updates - * * calendardata - The iCalendar-compatible calendar data - * * uri - a unique key which will be used to construct the uri. This can be any arbitrary string. - * * lastmodified - a timestamp of the last modification time - * * etag - An arbitrary string, surrounded by double-quotes. (e.g.: - * ' "abcdef"') - * * calendarid - The calendarid as it was passed to this function. - * - * Note that the etag is optional, but it's highly encouraged to return for - * speed reasons. - * - * The calendardata is also optional. If it's not returned - * 'getCalendarObject' will be called later, which *is* expected to return - * calendardata. - * - * @param string $calendarId - * - * @return array - */ - public function getCalendarObjects($calendarId) - { - if (!isset($this->calendarData[$calendarId])) { - return []; - } - - $objects = $this->calendarData[$calendarId]; - - foreach ($objects as $uri => &$object) { - $object['calendarid'] = $calendarId; - $object['uri'] = $uri; - $object['lastmodified'] = null; - } - - return $objects; - } - - /** - * Returns information from a single calendar object, based on it's object - * uri. - * - * The object uri is only the basename, or filename and not a full path. - * - * The returned array must have the same keys as getCalendarObjects. The - * '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|null - */ - public function getCalendarObject($calendarId, $objectUri) - { - if (!isset($this->calendarData[$calendarId][$objectUri])) { - return null; - } - $object = $this->calendarData[$calendarId][$objectUri]; - $object['calendarid'] = $calendarId; - $object['uri'] = $objectUri; - $object['lastmodified'] = null; - - return $object; - } - - /** - * Creates a new calendar object. - * - * @param string $calendarId - * @param string $objectUri - * @param string $calendarData - */ - public function createCalendarObject($calendarId, $objectUri, $calendarData) - { - $this->calendarData[$calendarId][$objectUri] = [ - 'calendardata' => $calendarData, - 'calendarid' => $calendarId, - 'uri' => $objectUri, - ]; - - return '"'.md5($calendarData).'"'; - } - - /** - * Updates an existing calendarobject, based on it's uri. - * - * @param string $calendarId - * @param string $objectUri - * @param string $calendarData - */ - public function updateCalendarObject($calendarId, $objectUri, $calendarData) - { - $this->calendarData[$calendarId][$objectUri] = [ - 'calendardata' => $calendarData, - 'calendarid' => $calendarId, - 'uri' => $objectUri, - ]; - - return '"'.md5($calendarData).'"'; - } - - /** - * Deletes an existing calendar object. - * - * @param string $calendarId - * @param string $objectUri - */ - public function deleteCalendarObject($calendarId, $objectUri) - { - unset($this->calendarData[$calendarId][$objectUri]); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/PDOMySQLTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/PDOMySQLTest.php deleted file mode 100644 index 66388def4..000000000 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/PDOMySQLTest.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\CalDAV\Backend; - -class PDOMySQLTest extends AbstractPDOTest -{ - public $driver = 'mysql'; -} diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/PDOSqliteTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/PDOSqliteTest.php deleted file mode 100644 index 4470e5810..000000000 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/Backend/PDOSqliteTest.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\CalDAV\Backend; - -class PDOSqliteTest extends AbstractPDOTest -{ - public $driver = 'sqlite'; -} diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/CalendarObjectTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/CalendarObjectTest.php deleted file mode 100644 index b7eb4539e..000000000 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/CalendarObjectTest.php +++ /dev/null @@ -1,351 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\CalDAV; - -class CalendarObjectTest extends \PHPUnit\Framework\TestCase -{ - /** - * @var Sabre\CalDAV\Backend_PDO - */ - protected $backend; - /** - * @var Sabre\CalDAV\Calendar - */ - protected $calendar; - protected $principalBackend; - - public function setup(): void - { - $this->backend = TestUtil::getBackend(); - - $calendars = $this->backend->getCalendarsForUser('principals/user1'); - $this->assertEquals(2, count($calendars)); - $this->calendar = new Calendar($this->backend, $calendars[0]); - } - - public function teardown(): void - { - unset($this->calendar); - unset($this->backend); - } - - public function testSetup() - { - $children = $this->calendar->getChildren(); - $this->assertTrue($children[0] instanceof CalendarObject); - - $this->assertIsString($children[0]->getName()); - $this->assertIsString($children[0]->get()); - $this->assertIsString($children[0]->getETag()); - $this->assertEquals('text/calendar; charset=utf-8', $children[0]->getContentType()); - } - - public function testInvalidArg1() - { - $this->expectException('InvalidArgumentException'); - $obj = new CalendarObject( - new Backend\Mock([], []), - [], - [] - ); - } - - public function testInvalidArg2() - { - $this->expectException('InvalidArgumentException'); - $obj = new CalendarObject( - new Backend\Mock([], []), - [], - ['calendarid' => '1'] - ); - } - - /** - * @depends testSetup - */ - public function testPut() - { - $children = $this->calendar->getChildren(); - $this->assertTrue($children[0] instanceof CalendarObject); - $newData = TestUtil::getTestCalendarData(); - - $children[0]->put($newData); - $this->assertEquals($newData, $children[0]->get()); - } - - /** - * @depends testSetup - */ - public function testPutStream() - { - $children = $this->calendar->getChildren(); - $this->assertTrue($children[0] instanceof CalendarObject); - $newData = TestUtil::getTestCalendarData(); - - $stream = fopen('php://temp', 'r+'); - fwrite($stream, $newData); - rewind($stream); - $children[0]->put($stream); - $this->assertEquals($newData, $children[0]->get()); - } - - /** - * @depends testSetup - */ - public function testDelete() - { - $children = $this->calendar->getChildren(); - $this->assertTrue($children[0] instanceof CalendarObject); - - $obj = $children[0]; - $obj->delete(); - - $children2 = $this->calendar->getChildren(); - $this->assertEquals(count($children) - 1, count($children2)); - } - - /** - * @depends testSetup - */ - public function testGetLastModified() - { - $children = $this->calendar->getChildren(); - $this->assertTrue($children[0] instanceof CalendarObject); - - $obj = $children[0]; - - $lastMod = $obj->getLastModified(); - $this->assertTrue(is_int($lastMod) || ctype_digit($lastMod) || is_null($lastMod)); - } - - /** - * @depends testSetup - */ - public function testGetSize() - { - $children = $this->calendar->getChildren(); - $this->assertTrue($children[0] instanceof CalendarObject); - - $obj = $children[0]; - - $size = $obj->getSize(); - $this->assertIsInt($size); - } - - public function testGetOwner() - { - $children = $this->calendar->getChildren(); - $this->assertTrue($children[0] instanceof CalendarObject); - - $obj = $children[0]; - $this->assertEquals('principals/user1', $obj->getOwner()); - } - - public function testGetGroup() - { - $children = $this->calendar->getChildren(); - $this->assertTrue($children[0] instanceof CalendarObject); - - $obj = $children[0]; - $this->assertNull($obj->getGroup()); - } - - public function testGetACL() - { - $expected = [ - [ - 'privilege' => '{DAV:}read', - 'principal' => 'principals/user1', - 'protected' => true, - ], - [ - 'privilege' => '{DAV:}read', - 'principal' => 'principals/user1/calendar-proxy-write', - 'protected' => true, - ], - [ - 'privilege' => '{DAV:}read', - 'principal' => 'principals/user1/calendar-proxy-read', - 'protected' => true, - ], - [ - 'privilege' => '{DAV:}write', - 'principal' => 'principals/user1', - 'protected' => true, - ], - [ - 'privilege' => '{DAV:}write', - 'principal' => 'principals/user1/calendar-proxy-write', - 'protected' => true, - ], - ]; - - $children = $this->calendar->getChildren(); - $this->assertTrue($children[0] instanceof CalendarObject); - - $obj = $children[0]; - $this->assertEquals($expected, $obj->getACL()); - } - - public function testDefaultACL() - { - $backend = new Backend\Mock([], []); - $calendarObject = new CalendarObject($backend, ['principaluri' => 'principals/user1'], ['calendarid' => 1, 'uri' => 'foo']); - $expected = [ - [ - 'privilege' => '{DAV:}all', - 'principal' => 'principals/user1', - 'protected' => true, - ], - [ - 'privilege' => '{DAV:}all', - 'principal' => 'principals/user1/calendar-proxy-write', - 'protected' => true, - ], - [ - 'privilege' => '{DAV:}read', - 'principal' => 'principals/user1/calendar-proxy-read', - 'protected' => true, - ], - ]; - $this->assertEquals($expected, $calendarObject->getACL()); - } - - public function testSetACL() - { - $this->expectException('Sabre\DAV\Exception\Forbidden'); - $children = $this->calendar->getChildren(); - $this->assertTrue($children[0] instanceof CalendarObject); - - $obj = $children[0]; - $obj->setACL([]); - } - - public function testGet() - { - $children = $this->calendar->getChildren(); - $this->assertTrue($children[0] instanceof CalendarObject); - - $obj = $children[0]; - - $expected = 'BEGIN:VCALENDAR -VERSION:2.0 -PRODID:-//Apple Inc.//iCal 4.0.1//EN -CALSCALE:GREGORIAN -BEGIN:VTIMEZONE -TZID:Asia/Seoul -BEGIN:DAYLIGHT -TZOFFSETFROM:+0900 -RRULE:FREQ=YEARLY;UNTIL=19880507T150000Z;BYMONTH=5;BYDAY=2SU -DTSTART:19870510T000000 -TZNAME:GMT+09:00 -TZOFFSETTO:+1000 -END:DAYLIGHT -BEGIN:STANDARD -TZOFFSETFROM:+1000 -DTSTART:19881009T000000 -TZNAME:GMT+09:00 -TZOFFSETTO:+0900 -END:STANDARD -END:VTIMEZONE -BEGIN:VEVENT -CREATED:20100225T154229Z -UID:39A6B5ED-DD51-4AFE-A683-C35EE3749627 -TRANSP:TRANSPARENT -SUMMARY:Something here -DTSTAMP:20100228T130202Z -DTSTART;TZID=Asia/Seoul:20100223T060000 -DTEND;TZID=Asia/Seoul:20100223T070000 -ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:lisa@example.com -SEQUENCE:2 -END:VEVENT -END:VCALENDAR'; - - $this->assertEquals($expected, $obj->get()); - } - - public function testGetRefetch() - { - $backend = new Backend\Mock([], [ - 1 => [ - 'foo' => [ - 'calendardata' => 'foo', - 'uri' => 'foo', - ], - ], - ]); - $obj = new CalendarObject($backend, ['id' => 1], ['uri' => 'foo']); - - $this->assertEquals('foo', $obj->get()); - } - - public function testGetEtag1() - { - $objectInfo = [ - 'calendardata' => 'foo', - 'uri' => 'foo', - 'etag' => 'bar', - 'calendarid' => 1, - ]; - - $backend = new Backend\Mock([], []); - $obj = new CalendarObject($backend, [], $objectInfo); - - $this->assertEquals('bar', $obj->getETag()); - } - - public function testGetEtag2() - { - $objectInfo = [ - 'calendardata' => 'foo', - 'uri' => 'foo', - 'calendarid' => 1, - ]; - - $backend = new Backend\Mock([], []); - $obj = new CalendarObject($backend, [], $objectInfo); - - $this->assertEquals('"'.md5('foo').'"', $obj->getETag()); - } - - public function testGetSupportedPrivilegesSet() - { - $objectInfo = [ - 'calendardata' => 'foo', - 'uri' => 'foo', - 'calendarid' => 1, - ]; - - $backend = new Backend\Mock([], []); - $obj = new CalendarObject($backend, [], $objectInfo); - $this->assertNull($obj->getSupportedPrivilegeSet()); - } - - public function testGetSize1() - { - $objectInfo = [ - 'calendardata' => 'foo', - 'uri' => 'foo', - 'calendarid' => 1, - ]; - - $backend = new Backend\Mock([], []); - $obj = new CalendarObject($backend, [], $objectInfo); - $this->assertEquals(3, $obj->getSize()); - } - - public function testGetSize2() - { - $objectInfo = [ - 'uri' => 'foo', - 'calendarid' => 1, - 'size' => 4, - ]; - - $backend = new Backend\Mock([], []); - $obj = new CalendarObject($backend, [], $objectInfo); - $this->assertEquals(4, $obj->getSize()); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/CalendarQueryVAlarmTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/CalendarQueryVAlarmTest.php deleted file mode 100644 index 660832ba4..000000000 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/CalendarQueryVAlarmTest.php +++ /dev/null @@ -1,121 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\CalDAV; - -use Sabre\VObject; - -class CalendarQueryVAlarmTest extends \PHPUnit\Framework\TestCase -{ - /** - * This test is specifically for a time-range query on a VALARM, contained - * in a VEVENT that's recurring. - */ - public function testValarm() - { - $vcalendar = new VObject\Component\VCalendar(); - - $vevent = $vcalendar->createComponent('VEVENT'); - $vevent->RRULE = 'FREQ=MONTHLY'; - $vevent->DTSTART = '20120101T120000Z'; - $vevent->UID = 'bla'; - - $valarm = $vcalendar->createComponent('VALARM'); - $valarm->TRIGGER = '-P15D'; - $vevent->add($valarm); - - $vcalendar->add($vevent); - - $filter = [ - 'name' => 'VCALENDAR', - 'is-not-defined' => false, - 'time-range' => null, - 'prop-filters' => [], - 'comp-filters' => [ - [ - 'name' => 'VEVENT', - 'is-not-defined' => false, - 'time-range' => null, - 'prop-filters' => [], - 'comp-filters' => [ - [ - 'name' => 'VALARM', - 'is-not-defined' => false, - 'prop-filters' => [], - 'comp-filters' => [], - 'time-range' => [ - 'start' => new \DateTime('2012-05-10'), - 'end' => new \DateTime('2012-05-20'), - ], - ], - ], - ], - ], - ]; - - $validator = new CalendarQueryValidator(); - $this->assertTrue($validator->validate($vcalendar, $filter)); - - $vcalendar = new VObject\Component\VCalendar(); - - // A limited recurrence rule, should return false - $vevent = $vcalendar->createComponent('VEVENT'); - $vevent->RRULE = 'FREQ=MONTHLY;COUNT=1'; - $vevent->DTSTART = '20120101T120000Z'; - $vevent->UID = 'bla'; - - $valarm = $vcalendar->createComponent('VALARM'); - $valarm->TRIGGER = '-P15D'; - $vevent->add($valarm); - - $vcalendar->add($vevent); - - $this->assertFalse($validator->validate($vcalendar, $filter)); - } - - public function testAlarmWayBefore() - { - $vcalendar = new VObject\Component\VCalendar(); - - $vevent = $vcalendar->createComponent('VEVENT'); - $vevent->DTSTART = '20120101T120000Z'; - $vevent->UID = 'bla'; - - $valarm = $vcalendar->createComponent('VALARM'); - $valarm->TRIGGER = '-P2W1D'; - $vevent->add($valarm); - - $vcalendar->add($vevent); - - $filter = [ - 'name' => 'VCALENDAR', - 'is-not-defined' => false, - 'time-range' => null, - 'prop-filters' => [], - 'comp-filters' => [ - [ - 'name' => 'VEVENT', - 'is-not-defined' => false, - 'time-range' => null, - 'prop-filters' => [], - 'comp-filters' => [ - [ - 'name' => 'VALARM', - 'is-not-defined' => false, - 'prop-filters' => [], - 'comp-filters' => [], - 'time-range' => [ - 'start' => new \DateTime('2011-12-10'), - 'end' => new \DateTime('2011-12-20'), - ], - ], - ], - ], - ], - ]; - - $validator = new CalendarQueryValidator(); - $this->assertTrue($validator->validate($vcalendar, $filter)); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/CalendarQueryValidatorTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/CalendarQueryValidatorTest.php deleted file mode 100644 index 9dc8ce188..000000000 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/CalendarQueryValidatorTest.php +++ /dev/null @@ -1,823 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\CalDAV; - -use Sabre\VObject; - -class CalendarQueryValidatorTest extends \PHPUnit\Framework\TestCase -{ - public function testTopLevelFail() - { - $validator = new CalendarQueryValidator(); - $vcal = <<<ICS -BEGIN:VCALENDAR -BEGIN:VEVENT -END:VEVENT -END:VCALENDAR -ICS; - $vcal = VObject\Reader::read($vcal); - $this->assertFalse($validator->validate($vcal, ['name' => 'VFOO'])); - } - - /** - * @param string $icalObject - * @param array $filters - * @param int $outcome - * @dataProvider provider - */ - public function testValid($icalObject, $filters, $outcome) - { - $validator = new CalendarQueryValidator(); - - // Wrapping filter in a VCALENDAR component filter, as this is always - // there anyway. - $filters = [ - 'name' => 'VCALENDAR', - 'comp-filters' => [$filters], - 'prop-filters' => [], - 'is-not-defined' => false, - 'time-range' => null, - ]; - - $vObject = VObject\Reader::read($icalObject); - - switch ($outcome) { - case 0: - $this->assertFalse($validator->validate($vObject, $filters)); - break; - case 1: - $this->assertTrue($validator->validate($vObject, $filters)); - break; - case -1: - try { - $validator->validate($vObject, $filters); - $this->fail('This test was supposed to fail'); - } catch (\Exception $e) { - // We need to test something to be valid for phpunit strict - // mode. - $this->assertTrue(true); - } catch (\Throwable $e) { - // PHP7 - $this->assertTrue(true); - } - break; - } - } - - public function provider() - { - $blob1 = <<<yow -BEGIN:VCALENDAR -BEGIN:VEVENT -SUMMARY:hi -END:VEVENT -END:VCALENDAR -yow; - - $blob2 = <<<yow -BEGIN:VCALENDAR -BEGIN:VEVENT -SUMMARY:hi -BEGIN:VALARM -ACTION:DISPLAY -END:VALARM -END:VEVENT -END:VCALENDAR -yow; - - $blob3 = <<<yow -BEGIN:VCALENDAR -BEGIN:VEVENT -SUMMARY:hi -DTSTART;VALUE=DATE:20110704 -END:VEVENT -END:VCALENDAR -yow; - $blob4 = <<<yow -BEGIN:VCARD -VERSION:3.0 -FN:Evert -END:VCARD -yow; - - $blob5 = <<<yow -BEGIN:VCALENDAR -BEGIN:VEVENT -DTSTART:20110101T120000Z -DTEND:20110102T120000Z -END:VEVENT -END:VCALENDAR -yow; - - $blob6 = <<<yow -BEGIN:VCALENDAR -BEGIN:VEVENT -DTSTART:20110101T120000Z -DURATION:PT5H -END:VEVENT -END:VCALENDAR -yow; - - $blob7 = <<<yow -BEGIN:VCALENDAR -BEGIN:VEVENT -DTSTART;VALUE=DATE:20110101 -END:VEVENT -END:VCALENDAR -yow; - - $blob8 = <<<yow -BEGIN:VCALENDAR -BEGIN:VEVENT -DTSTART:20110101T120000Z -END:VEVENT -END:VCALENDAR -yow; - - $blob9 = <<<yow -BEGIN:VCALENDAR -BEGIN:VTODO -DTSTART:20110101T120000Z -DURATION:PT1H -END:VTODO -END:VCALENDAR -yow; - $blob10 = <<<yow -BEGIN:VCALENDAR -BEGIN:VTODO -DTSTART:20110101T120000Z -DUE:20110101T130000Z -END:VTODO -END:VCALENDAR -yow; - $blob11 = <<<yow -BEGIN:VCALENDAR -BEGIN:VTODO -DTSTART:20110101T120000Z -END:VTODO -END:VCALENDAR -yow; - - $blob12 = <<<yow -BEGIN:VCALENDAR -BEGIN:VTODO -DUE:20110101T130000Z -END:VTODO -END:VCALENDAR -yow; - - $blob13 = <<<yow -BEGIN:VCALENDAR -BEGIN:VTODO -COMPLETED:20110101T130000Z -CREATED:20110101T110000Z -END:VTODO -END:VCALENDAR -yow; - - $blob14 = <<<yow -BEGIN:VCALENDAR -BEGIN:VTODO -COMPLETED:20110101T130000Z -END:VTODO -END:VCALENDAR -yow; - - $blob15 = <<<yow -BEGIN:VCALENDAR -BEGIN:VTODO -CREATED:20110101T110000Z -END:VTODO -END:VCALENDAR -yow; - - $blob16 = <<<yow -BEGIN:VCALENDAR -BEGIN:VTODO -END:VTODO -END:VCALENDAR -yow; - - $blob17 = <<<yow -BEGIN:VCALENDAR -BEGIN:VJOURNAL -END:VJOURNAL -END:VCALENDAR -yow; - - $blob18 = <<<yow -BEGIN:VCALENDAR -BEGIN:VJOURNAL -DTSTART:20110101T120000Z -END:VJOURNAL -END:VCALENDAR -yow; - - $blob19 = <<<yow -BEGIN:VCALENDAR -BEGIN:VJOURNAL -DTSTART;VALUE=DATE:20110101 -END:VJOURNAL -END:VCALENDAR -yow; - - $blob20 = <<<yow -BEGIN:VCALENDAR -BEGIN:VFREEBUSY -END:VFREEBUSY -END:VCALENDAR -yow; - - $blob21 = <<<yow -BEGIN:VCALENDAR -BEGIN:VEVENT -DTSTART:20110101T120000Z -BEGIN:VALARM -TRIGGER:-PT1H -END:VALARM -END:VEVENT -END:VCALENDAR -yow; - - $blob22 = <<<yow -BEGIN:VCALENDAR -BEGIN:VEVENT -DTSTART:20110101T120000Z -BEGIN:VALARM -TRIGGER;VALUE=DURATION:-PT1H -END:VALARM -END:VEVENT -END:VCALENDAR -yow; - - $blob23 = <<<yow -BEGIN:VCALENDAR -BEGIN:VEVENT -DTSTART:20110101T120000Z -BEGIN:VALARM -TRIGGER;VALUE=DURATION;RELATED=END:-PT1H -END:VALARM -END:VEVENT -END:VCALENDAR -yow; - - $blob24 = <<<yow -BEGIN:VCALENDAR -BEGIN:VEVENT -DTSTART:20110101T120000Z -DTEND:20110101T130000Z -BEGIN:VALARM -TRIGGER;VALUE=DURATION;RELATED=END:-PT2H -END:VALARM -END:VEVENT -END:VCALENDAR -yow; - - $blob25 = <<<yow -BEGIN:VCALENDAR -BEGIN:VEVENT -DTSTART:20110101T120000Z -DURATION:PT1H -BEGIN:VALARM -TRIGGER;VALUE=DURATION;RELATED=END:-PT2H -END:VALARM -END:VEVENT -END:VCALENDAR -yow; - - $blob26 = <<<yow -BEGIN:VCALENDAR -BEGIN:VEVENT -DTSTART:20110101T120000Z -DURATION:PT1H -BEGIN:VALARM -TRIGGER;VALUE=DATE-TIME:20110101T110000Z -END:VALARM -END:VEVENT -END:VCALENDAR -yow; - - $blob27 = <<<yow -BEGIN:VCALENDAR -BEGIN:VTODO -DTSTART:20110101T120000Z -DUE:20110101T130000Z -BEGIN:VALARM -TRIGGER;VALUE=DURATION;RELATED=END:-PT2H -END:VALARM -END:VTODO -END:VCALENDAR -yow; - - $blob28 = <<<yow -BEGIN:VCALENDAR -BEGIN:VJOURNAL -DTSTART:20110101T120000Z -BEGIN:VALARM -TRIGGER;VALUE=DURATION;RELATED=END:-PT2H -END:VALARM -END:VJOURNAL -END:VCALENDAR -yow; - - $blob29 = <<<yow -BEGIN:VCALENDAR -BEGIN:VEVENT -DTSTART:20110101T120000Z -DURATION:PT1H -BEGIN:VALARM -TRIGGER;VALUE=DATE-TIME:20110101T090000Z -REPEAT:2 -DURATION:PT1H -END:VALARM -END:VEVENT -END:VCALENDAR -yow; - - $blob30 = <<<yow -BEGIN:VCALENDAR -BEGIN:VEVENT -DTSTART:20110101T120000Z -DURATION:PT1H -BEGIN:VALARM -TRIGGER;VALUE=DATE-TIME:20110101T090000Z -DURATION:PT1H -END:VALARM -END:VEVENT -END:VCALENDAR -yow; - - $blob31 = <<<yow -BEGIN:VCALENDAR -BEGIN:VEVENT -UID:foobar -DTSTART:20080101T120000Z -DURATION:PT1H -RRULE:FREQ=YEARLY -END:VEVENT -END:VCALENDAR -yow; - - $blob32 = <<<yow -BEGIN:VCALENDAR -BEGIN:VEVENT -UID:foobar -DTSTART:20080102T120000Z -DURATION:PT1H -RRULE:FREQ=YEARLY -END:VEVENT -END:VCALENDAR -yow; - $blob33 = <<<yow -BEGIN:VCALENDAR -BEGIN:VEVENT -UID:foobar -DTSTART;VALUE=DATE:20120628 -RRULE:FREQ=DAILY -END:VEVENT -END:VCALENDAR -yow; - $blob34 = <<<yow -BEGIN:VCALENDAR -BEGIN:VEVENT -UID:foobar -DTSTART;VALUE=DATE:20120628 -RRULE:FREQ=DAILY -BEGIN:VALARM -TRIGGER:P52W -END:VALARM -END:VEVENT -END:VCALENDAR -yow; - - $filter1 = [ - 'name' => 'VEVENT', - 'comp-filters' => [], - 'prop-filters' => [], - 'is-not-defined' => false, - 'time-range' => null, - ]; - $filter2 = $filter1; - $filter2['name'] = 'VTODO'; - - $filter3 = $filter1; - $filter3['is-not-defined'] = true; - - $filter4 = $filter1; - $filter4['name'] = 'VTODO'; - $filter4['is-not-defined'] = true; - - $filter5 = $filter1; - $filter5['comp-filters'] = [ - [ - 'name' => 'VALARM', - 'is-not-defined' => false, - 'comp-filters' => [], - 'prop-filters' => [], - 'time-range' => null, - ], - ]; - $filter6 = $filter1; - $filter6['prop-filters'] = [ - [ - 'name' => 'SUMMARY', - 'is-not-defined' => false, - 'param-filters' => [], - 'time-range' => null, - 'text-match' => null, - ], - ]; - $filter7 = $filter6; - $filter7['prop-filters'][0]['name'] = 'DESCRIPTION'; - - $filter8 = $filter6; - $filter8['prop-filters'][0]['is-not-defined'] = true; - - $filter9 = $filter7; - $filter9['prop-filters'][0]['is-not-defined'] = true; - - $filter10 = $filter5; - $filter10['prop-filters'] = $filter6['prop-filters']; - - // Param filters - $filter11 = $filter1; - $filter11['prop-filters'] = [ - [ - 'name' => 'DTSTART', - 'is-not-defined' => false, - 'param-filters' => [ - [ - 'name' => 'VALUE', - 'is-not-defined' => false, - 'text-match' => null, - ], - ], - 'time-range' => null, - 'text-match' => null, - ], - ]; - - $filter12 = $filter11; - $filter12['prop-filters'][0]['param-filters'][0]['name'] = 'TZID'; - - $filter13 = $filter11; - $filter13['prop-filters'][0]['param-filters'][0]['is-not-defined'] = true; - - $filter14 = $filter12; - $filter14['prop-filters'][0]['param-filters'][0]['is-not-defined'] = true; - - // Param text filter - $filter15 = $filter11; - $filter15['prop-filters'][0]['param-filters'][0]['text-match'] = [ - 'collation' => 'i;ascii-casemap', - 'value' => 'dAtE', - 'negate-condition' => false, - ]; - $filter16 = $filter15; - $filter16['prop-filters'][0]['param-filters'][0]['text-match']['collation'] = 'i;octet'; - - $filter17 = $filter15; - $filter17['prop-filters'][0]['param-filters'][0]['text-match']['negate-condition'] = true; - - $filter18 = $filter15; - $filter18['prop-filters'][0]['param-filters'][0]['text-match']['negate-condition'] = true; - $filter18['prop-filters'][0]['param-filters'][0]['text-match']['collation'] = 'i;octet'; - - // prop + text - $filter19 = $filter5; - $filter19['comp-filters'][0]['prop-filters'] = [ - [ - 'name' => 'action', - 'is-not-defined' => false, - 'time-range' => null, - 'param-filters' => [], - 'text-match' => [ - 'collation' => 'i;ascii-casemap', - 'value' => 'display', - 'negate-condition' => false, - ], - ], - ]; - - // Time range - $filter20 = [ - 'name' => 'VEVENT', - 'comp-filters' => [], - 'prop-filters' => [], - 'is-not-defined' => false, - 'time-range' => [ - 'start' => new \DateTime('2011-01-01 10:00:00', new \DateTimeZone('GMT')), - 'end' => new \DateTime('2011-01-01 13:00:00', new \DateTimeZone('GMT')), - ], - ]; - // Time range, no end date - $filter21 = $filter20; - $filter21['time-range']['end'] = null; - - // Time range, no start date - $filter22 = $filter20; - $filter22['time-range']['start'] = null; - - // Time range, other dates - $filter23 = $filter20; - $filter23['time-range'] = [ - 'start' => new \DateTime('2011-02-01 10:00:00', new \DateTimeZone('GMT')), - 'end' => new \DateTime('2011-02-01 13:00:00', new \DateTimeZone('GMT')), - ]; - // Time range - $filter24 = [ - 'name' => 'VTODO', - 'comp-filters' => [], - 'prop-filters' => [], - 'is-not-defined' => false, - 'time-range' => [ - 'start' => new \DateTime('2011-01-01 12:45:00', new \DateTimeZone('GMT')), - 'end' => new \DateTime('2011-01-01 13:15:00', new \DateTimeZone('GMT')), - ], - ]; - // Time range, other dates (1 month in the future) - $filter25 = $filter24; - $filter25['time-range'] = [ - 'start' => new \DateTime('2011-02-01 10:00:00', new \DateTimeZone('GMT')), - 'end' => new \DateTime('2011-02-01 13:00:00', new \DateTimeZone('GMT')), - ]; - $filter26 = $filter24; - $filter26['time-range'] = [ - 'start' => new \DateTime('2011-01-01 11:45:00', new \DateTimeZone('GMT')), - 'end' => new \DateTime('2011-01-01 12:15:00', new \DateTimeZone('GMT')), - ]; - - // Time range for VJOURNAL - $filter27 = [ - 'name' => 'VJOURNAL', - 'comp-filters' => [], - 'prop-filters' => [], - 'is-not-defined' => false, - 'time-range' => [ - 'start' => new \DateTime('2011-01-01 12:45:00', new \DateTimeZone('GMT')), - 'end' => new \DateTime('2011-01-01 13:15:00', new \DateTimeZone('GMT')), - ], - ]; - $filter28 = $filter27; - $filter28['time-range'] = [ - 'start' => new \DateTime('2011-01-01 11:45:00', new \DateTimeZone('GMT')), - 'end' => new \DateTime('2011-01-01 12:15:00', new \DateTimeZone('GMT')), - ]; - // Time range for VFREEBUSY - $filter29 = [ - 'name' => 'VFREEBUSY', - 'comp-filters' => [], - 'prop-filters' => [], - 'is-not-defined' => false, - 'time-range' => [ - 'start' => new \DateTime('2011-01-01 12:45:00', new \DateTimeZone('GMT')), - 'end' => new \DateTime('2011-01-01 13:15:00', new \DateTimeZone('GMT')), - ], - ]; - // Time range filter on property - $filter30 = [ - 'name' => 'VEVENT', - 'comp-filters' => [], - 'prop-filters' => [ - [ - 'name' => 'DTSTART', - 'is-not-defined' => false, - 'param-filters' => [], - 'time-range' => [ - 'start' => new \DateTime('2011-01-01 10:00:00', new \DateTimeZone('GMT')), - 'end' => new \DateTime('2011-01-01 13:00:00', new \DateTimeZone('GMT')), - ], - 'text-match' => null, - ], - ], - 'is-not-defined' => false, - 'time-range' => null, - ]; - - // Time range for alarm - $filter31 = [ - 'name' => 'VEVENT', - 'prop-filters' => [], - 'comp-filters' => [ - [ - 'name' => 'VALARM', - 'is-not-defined' => false, - 'comp-filters' => [], - 'prop-filters' => [], - 'time-range' => [ - 'start' => new \DateTime('2011-01-01 10:45:00', new \DateTimeZone('GMT')), - 'end' => new \DateTime('2011-01-01 11:15:00', new \DateTimeZone('GMT')), - ], - 'text-match' => null, - ], - ], - 'is-not-defined' => false, - 'time-range' => null, - ]; - $filter32 = $filter31; - $filter32['comp-filters'][0]['time-range'] = [ - 'start' => new \DateTime('2011-01-01 11:45:00', new \DateTimeZone('GMT')), - 'end' => new \DateTime('2011-01-01 12:15:00', new \DateTimeZone('GMT')), - ]; - - $filter33 = $filter31; - $filter33['name'] = 'VTODO'; - $filter34 = $filter32; - $filter34['name'] = 'VTODO'; - $filter35 = $filter31; - $filter35['name'] = 'VJOURNAL'; - $filter36 = $filter32; - $filter36['name'] = 'VJOURNAL'; - - // Time range filter on non-datetime property - $filter37 = [ - 'name' => 'VEVENT', - 'comp-filters' => [], - 'prop-filters' => [ - [ - 'name' => 'SUMMARY', - 'is-not-defined' => false, - 'param-filters' => [], - 'time-range' => [ - 'start' => new \DateTime('2011-01-01 10:00:00', new \DateTimeZone('GMT')), - 'end' => new \DateTime('2011-01-01 13:00:00', new \DateTimeZone('GMT')), - ], - 'text-match' => null, - ], - ], - 'is-not-defined' => false, - 'time-range' => null, - ]; - - $filter38 = [ - 'name' => 'VEVENT', - 'comp-filters' => [], - 'prop-filters' => [], - 'is-not-defined' => false, - 'time-range' => [ - 'start' => new \DateTime('2012-07-01 00:00:00', new \DateTimeZone('UTC')), - 'end' => new \DateTime('2012-08-01 00:00:00', new \DateTimeZone('UTC')), - ], - ]; - $filter39 = [ - 'name' => 'VEVENT', - 'comp-filters' => [ - [ - 'name' => 'VALARM', - 'comp-filters' => [], - 'prop-filters' => [], - 'is-not-defined' => false, - 'time-range' => [ - 'start' => new \DateTime('2012-09-01 00:00:00', new \DateTimeZone('UTC')), - 'end' => new \DateTime('2012-10-01 00:00:00', new \DateTimeZone('UTC')), - ], - ], - ], - 'prop-filters' => [], - 'is-not-defined' => false, - 'time-range' => null, - ]; - - return [ - // Component check - - [$blob1, $filter1, 1], - [$blob1, $filter2, 0], - [$blob1, $filter3, 0], - [$blob1, $filter4, 1], - - // Subcomponent check (4) - [$blob1, $filter5, 0], - [$blob2, $filter5, 1], - - // Property checki (6) - [$blob1, $filter6, 1], - [$blob1, $filter7, 0], - [$blob1, $filter8, 0], - [$blob1, $filter9, 1], - - // Subcomponent + property (10) - [$blob2, $filter10, 1], - - // Param filter (11) - [$blob3, $filter11, 1], - [$blob3, $filter12, 0], - [$blob3, $filter13, 0], - [$blob3, $filter14, 1], - - // Param + text (15) - [$blob3, $filter15, 1], - [$blob3, $filter16, 0], - [$blob3, $filter17, 0], - [$blob3, $filter18, 1], - - // Prop + text (19) - [$blob2, $filter19, 1], - - // Incorrect object (vcard) (20) - [$blob4, $filter1, -1], - - // Time-range for event (21) - [$blob5, $filter20, 1], - [$blob6, $filter20, 1], - [$blob7, $filter20, 1], - [$blob8, $filter20, 1], - - [$blob5, $filter21, 1], - [$blob5, $filter22, 1], - - [$blob5, $filter23, 0], - [$blob6, $filter23, 0], - [$blob7, $filter23, 0], - [$blob8, $filter23, 0], - - // Time-range for todo (31) - [$blob9, $filter24, 1], - [$blob9, $filter25, 0], - [$blob9, $filter26, 1], - [$blob10, $filter24, 1], - [$blob10, $filter25, 0], - [$blob10, $filter26, 1], - - [$blob11, $filter24, 0], - [$blob11, $filter25, 0], - [$blob11, $filter26, 1], - - [$blob12, $filter24, 1], - [$blob12, $filter25, 0], - [$blob12, $filter26, 0], - - [$blob13, $filter24, 1], - [$blob13, $filter25, 0], - [$blob13, $filter26, 1], - - [$blob14, $filter24, 1], - [$blob14, $filter25, 0], - [$blob14, $filter26, 0], - - [$blob15, $filter24, 1], - [$blob15, $filter25, 1], - [$blob15, $filter26, 1], - - [$blob16, $filter24, 1], - [$blob16, $filter25, 1], - [$blob16, $filter26, 1], - - // Time-range for journals (55) - [$blob17, $filter27, 0], - [$blob17, $filter28, 0], - [$blob18, $filter27, 0], - [$blob18, $filter28, 1], - [$blob19, $filter27, 1], - [$blob19, $filter28, 1], - - // Time-range for free-busy (61) - [$blob20, $filter29, -1], - - // Time-range on property (62) - [$blob5, $filter30, 1], - [$blob3, $filter37, -1], - [$blob3, $filter30, 0], - - // Time-range on alarm in vevent (65) - [$blob21, $filter31, 1], - [$blob21, $filter32, 0], - [$blob22, $filter31, 1], - [$blob22, $filter32, 0], - [$blob23, $filter31, 1], - [$blob23, $filter32, 0], - [$blob24, $filter31, 1], - [$blob24, $filter32, 0], - [$blob25, $filter31, 1], - [$blob25, $filter32, 0], - [$blob26, $filter31, 1], - [$blob26, $filter32, 0], - - // Time-range on alarm for vtodo (77) - [$blob27, $filter33, 1], - [$blob27, $filter34, 0], - - // Time-range on alarm for vjournal (79) - [$blob28, $filter35, -1], - [$blob28, $filter36, -1], - - // Time-range on alarm with duration (81) - [$blob29, $filter31, 1], - [$blob29, $filter32, 0], - [$blob30, $filter31, 0], - [$blob30, $filter32, 0], - - // Time-range with RRULE (85) - [$blob31, $filter20, 1], - [$blob32, $filter20, 0], - - // Bug reported on mailing list, related to all-day events (87) - //array($blob33, $filter38, 1), - - // Event in timerange, but filtered alarm is in the far future (88). - [$blob34, $filter39, 0], - ]; - } -} diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/CalendarTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/CalendarTest.php deleted file mode 100644 index 18c3ec126..000000000 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/CalendarTest.php +++ /dev/null @@ -1,229 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\CalDAV; - -use Sabre\DAV\PropPatch; - -class CalendarTest extends \PHPUnit\Framework\TestCase -{ - /** - * @var Sabre\CalDAV\Backend\PDO - */ - protected $backend; - protected $principalBackend; - /** - * @var Sabre\CalDAV\Calendar - */ - protected $calendar; - /** - * @var array - */ - protected $calendars; - - public function setup(): void - { - $this->backend = TestUtil::getBackend(); - - $this->calendars = $this->backend->getCalendarsForUser('principals/user1'); - $this->assertEquals(2, count($this->calendars)); - $this->calendar = new Calendar($this->backend, $this->calendars[0]); - } - - public function teardown(): void - { - unset($this->backend); - } - - public function testSimple() - { - $this->assertEquals($this->calendars[0]['uri'], $this->calendar->getName()); - } - - /** - * @depends testSimple - */ - public function testUpdateProperties() - { - $propPatch = new PropPatch([ - '{DAV:}displayname' => 'NewName', - ]); - - $result = $this->calendar->propPatch($propPatch); - $result = $propPatch->commit(); - - $this->assertEquals(true, $result); - - $calendars2 = $this->backend->getCalendarsForUser('principals/user1'); - $this->assertEquals('NewName', $calendars2[0]['{DAV:}displayname']); - } - - /** - * @depends testSimple - */ - public function testGetProperties() - { - $question = [ - '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set', - ]; - - $result = $this->calendar->getProperties($question); - - foreach ($question as $q) { - $this->assertArrayHasKey($q, $result); - } - - $this->assertEquals(['VEVENT', 'VTODO'], $result['{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set']->getValue()); - } - - /** - * @depends testSimple - */ - public function testGetChildNotFound() - { - $this->expectException('Sabre\DAV\Exception\NotFound'); - $this->calendar->getChild('randomname'); - } - - /** - * @depends testSimple - */ - public function testGetChildren() - { - $children = $this->calendar->getChildren(); - $this->assertEquals(1, count($children)); - - $this->assertTrue($children[0] instanceof CalendarObject); - } - - /** - * @depends testGetChildren - */ - public function testChildExists() - { - $this->assertFalse($this->calendar->childExists('foo')); - - $children = $this->calendar->getChildren(); - $this->assertTrue($this->calendar->childExists($children[0]->getName())); - } - - public function testCreateDirectory() - { - $this->expectException('Sabre\DAV\Exception\MethodNotAllowed'); - $this->calendar->createDirectory('hello'); - } - - public function testSetName() - { - $this->expectException('Sabre\DAV\Exception\MethodNotAllowed'); - $this->calendar->setName('hello'); - } - - public function testGetLastModified() - { - $this->assertNull($this->calendar->getLastModified()); - } - - public function testCreateFile() - { - $file = fopen('php://memory', 'r+'); - fwrite($file, TestUtil::getTestCalendarData()); - rewind($file); - - $this->calendar->createFile('hello', $file); - - $file = $this->calendar->getChild('hello'); - $this->assertTrue($file instanceof CalendarObject); - } - - public function testCreateFileNoSupportedComponents() - { - $file = fopen('php://memory', 'r+'); - fwrite($file, TestUtil::getTestCalendarData()); - rewind($file); - - $calendar = new Calendar($this->backend, $this->calendars[1]); - $calendar->createFile('hello', $file); - - $file = $calendar->getChild('hello'); - $this->assertTrue($file instanceof CalendarObject); - } - - public function testDelete() - { - $this->calendar->delete(); - - $calendars = $this->backend->getCalendarsForUser('principals/user1'); - $this->assertEquals(1, count($calendars)); - } - - public function testGetOwner() - { - $this->assertEquals('principals/user1', $this->calendar->getOwner()); - } - - public function testGetGroup() - { - $this->assertNull($this->calendar->getGroup()); - } - - public function testGetACL() - { - $expected = [ - [ - 'privilege' => '{DAV:}read', - 'principal' => 'principals/user1', - 'protected' => true, - ], - [ - 'privilege' => '{DAV:}read', - 'principal' => 'principals/user1/calendar-proxy-write', - 'protected' => true, - ], - [ - 'privilege' => '{DAV:}read', - 'principal' => 'principals/user1/calendar-proxy-read', - 'protected' => true, - ], - [ - 'privilege' => '{'.Plugin::NS_CALDAV.'}read-free-busy', - 'principal' => '{DAV:}authenticated', - 'protected' => true, - ], - [ - 'privilege' => '{DAV:}write', - 'principal' => 'principals/user1', - 'protected' => true, - ], - [ - 'privilege' => '{DAV:}write', - 'principal' => 'principals/user1/calendar-proxy-write', - 'protected' => true, - ], - ]; - $this->assertEquals($expected, $this->calendar->getACL()); - } - - public function testSetACL() - { - $this->expectException('Sabre\DAV\Exception\Forbidden'); - $this->calendar->setACL([]); - } - - public function testGetSyncToken() - { - $this->assertNull($this->calendar->getSyncToken()); - } - - public function testGetSyncTokenNoSyncSupport() - { - $calendar = new Calendar(new Backend\Mock([], []), []); - $this->assertNull($calendar->getSyncToken()); - } - - public function testGetChanges() - { - $this->assertNull($this->calendar->getChanges(1, 1)); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/ExpandEventsDTSTARTandDTENDTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/ExpandEventsDTSTARTandDTENDTest.php deleted file mode 100644 index 93fc56dae..000000000 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/ExpandEventsDTSTARTandDTENDTest.php +++ /dev/null @@ -1,114 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\CalDAV; - -use Sabre\HTTP; -use Sabre\VObject; - -/** - * This unittests is created to find out why recurring events have wrong DTSTART value. - * - * @copyright Copyright (C) fruux GmbH (https://fruux.com/) - * @author Evert Pot (http://evertpot.com/) - * @license http://sabre.io/license/ Modified BSD License - */ -class ExpandEventsDTSTARTandDTENDTest extends \Sabre\DAVServerTest -{ - protected $setupCalDAV = true; - - protected $caldavCalendars = [ - [ - 'id' => 1, - 'name' => 'Calendar', - 'principaluri' => 'principals/user1', - 'uri' => 'calendar1', - ], - ]; - - protected $caldavCalendarObjects = [ - 1 => [ - 'event.ics' => [ - 'calendardata' => 'BEGIN:VCALENDAR -VERSION:2.0 -BEGIN:VEVENT -UID:foobar -DTEND;TZID=Europe/Berlin:20120207T191500 -RRULE:FREQ=DAILY;INTERVAL=1;COUNT=3 -SUMMARY:RecurringEvents 3 times -DTSTART;TZID=Europe/Berlin:20120207T181500 -END:VEVENT -BEGIN:VEVENT -CREATED:20120207T111900Z -UID:foobar -DTEND;TZID=Europe/Berlin:20120208T191500 -SUMMARY:RecurringEvents 3 times OVERWRITTEN -DTSTART;TZID=Europe/Berlin:20120208T181500 -RECURRENCE-ID;TZID=Europe/Berlin:20120208T181500 -END:VEVENT -END:VCALENDAR -', - ], - ], - ]; - - public function testExpand() - { - $request = HTTP\Sapi::createFromServerArray([ - 'REQUEST_METHOD' => 'REPORT', - 'HTTP_CONTENT_TYPE' => 'application/xml', - 'REQUEST_URI' => '/calendars/user1/calendar1', - 'HTTP_DEPTH' => '1', - ]); - - $request->setBody('<?xml version="1.0" encoding="utf-8" ?> -<C:calendar-query xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav"> - <D:prop> - <C:calendar-data> - <C:expand start="20120205T230000Z" end="20120212T225959Z"/> - </C:calendar-data> - <D:getetag/> - </D:prop> - <C:filter> - <C:comp-filter name="VCALENDAR"> - <C:comp-filter name="VEVENT"> - <C:time-range start="20120205T230000Z" end="20120212T225959Z"/> - </C:comp-filter> - </C:comp-filter> - </C:filter> -</C:calendar-query>'); - - $response = $this->request($request); - - $bodyAsString = $response->getBodyAsString(); - // Everts super awesome xml parser. - $body = substr( - $bodyAsString, - $start = strpos($bodyAsString, 'BEGIN:VCALENDAR'), - strpos($bodyAsString, 'END:VCALENDAR') - $start + 13 - ); - $body = str_replace(' ', '', $body); - - try { - $vObject = VObject\Reader::read($body); - } catch (VObject\ParseException $e) { - $this->fail('Could not parse object. Error:'.$e->getMessage().' full object: '.$response->getBodyAsString()); - } - - // check if DTSTARTs and DTENDs are correct - foreach ($vObject->VEVENT as $vevent) { - /** @var $vevent Sabre\VObject\Component\VEvent */ - foreach ($vevent->children() as $child) { - /** @var $child Sabre\VObject\Property */ - if ('DTSTART' == $child->name) { - // DTSTART has to be one of three valid values - $this->assertContains($child->getValue(), ['20120207T171500Z', '20120208T171500Z', '20120209T171500Z'], 'DTSTART is not a valid value: '.$child->getValue()); - } elseif ('DTEND' == $child->name) { - // DTEND has to be one of three valid values - $this->assertContains($child->getValue(), ['20120207T181500Z', '20120208T181500Z', '20120209T181500Z'], 'DTEND is not a valid value: '.$child->getValue()); - } - } - } - } -} diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/ExpandEventsDTSTARTandDTENDbyDayTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/ExpandEventsDTSTARTandDTENDbyDayTest.php deleted file mode 100644 index 50fb6c03c..000000000 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/ExpandEventsDTSTARTandDTENDbyDayTest.php +++ /dev/null @@ -1,104 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\CalDAV; - -use Sabre\HTTP; -use Sabre\VObject; - -/** - * This unittests is created to find out why recurring events have wrong DTSTART value. - * - * @copyright Copyright (C) fruux GmbH (https://fruux.com/) - * @author Evert Pot (http://evertpot.com/) - * @license http://sabre.io/license/ Modified BSD License - */ -class ExpandEventsDTSTARTandDTENDbyDayTest extends \Sabre\DAVServerTest -{ - protected $setupCalDAV = true; - - protected $caldavCalendars = [ - [ - 'id' => 1, - 'name' => 'Calendar', - 'principaluri' => 'principals/user1', - 'uri' => 'calendar1', - ], - ]; - - protected $caldavCalendarObjects = [ - 1 => [ - 'event.ics' => [ - 'calendardata' => 'BEGIN:VCALENDAR -VERSION:2.0 -BEGIN:VEVENT -UID:foobar -DTEND;TZID=Europe/Berlin:20120207T191500 -RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=TU,TH -SUMMARY:RecurringEvents on tuesday and thursday -DTSTART;TZID=Europe/Berlin:20120207T181500 -END:VEVENT -END:VCALENDAR -', - ], - ], - ]; - - public function testExpandRecurringByDayEvent() - { - $request = HTTP\Sapi::createFromServerArray([ - 'REQUEST_METHOD' => 'REPORT', - 'HTTP_CONTENT_TYPE' => 'application/xml', - 'REQUEST_URI' => '/calendars/user1/calendar1', - 'HTTP_DEPTH' => '1', - ]); - - $request->setBody('<?xml version="1.0" encoding="utf-8" ?> -<C:calendar-query xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav"> - <D:prop> - <C:calendar-data> - <C:expand start="20120210T230000Z" end="20120217T225959Z"/> - </C:calendar-data> - <D:getetag/> - </D:prop> - <C:filter> - <C:comp-filter name="VCALENDAR"> - <C:comp-filter name="VEVENT"> - <C:time-range start="20120210T230000Z" end="20120217T225959Z"/> - </C:comp-filter> - </C:comp-filter> - </C:filter> -</C:calendar-query>'); - - $response = $this->request($request); - - $bodyAsString = $response->getBodyAsString(); - // Everts super awesome xml parser. - $body = substr( - $bodyAsString, - $start = strpos($bodyAsString, 'BEGIN:VCALENDAR'), - strpos($bodyAsString, 'END:VCALENDAR') - $start + 13 - ); - $body = str_replace(' ', '', $body); - - $vObject = VObject\Reader::read($body); - - $this->assertEquals(2, count($vObject->VEVENT)); - - // check if DTSTARTs and DTENDs are correct - foreach ($vObject->VEVENT as $vevent) { - /** @var $vevent Sabre\VObject\Component\VEvent */ - foreach ($vevent->children() as $child) { - /** @var $child Sabre\VObject\Property */ - if ('DTSTART' == $child->name) { - // DTSTART has to be one of two valid values - $this->assertContains($child->getValue(), ['20120214T171500Z', '20120216T171500Z'], 'DTSTART is not a valid value: '.$child->getValue()); - } elseif ('DTEND' == $child->name) { - // DTEND has to be one of two valid values - $this->assertContains($child->getValue(), ['20120214T181500Z', '20120216T181500Z'], 'DTEND is not a valid value: '.$child->getValue()); - } - } - } - } -} diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/ExpandEventsDoubleEventsTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/ExpandEventsDoubleEventsTest.php deleted file mode 100644 index 5e5c153e0..000000000 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/ExpandEventsDoubleEventsTest.php +++ /dev/null @@ -1,104 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\CalDAV; - -use Sabre\HTTP; -use Sabre\VObject; - -/** - * This unittests is created to find out why certain events show up twice. - * - * Hopefully, by the time I'm done with this, I've both found the problem, and - * fixed it :) - * - * @copyright Copyright (C) fruux GmbH (https://fruux.com/) - * @author Evert Pot (http://evertpot.com/) - * @license http://sabre.io/license/ Modified BSD License - */ -class ExpandEventsDoubleEventsTest extends \Sabre\DAVServerTest -{ - protected $setupCalDAV = true; - - protected $caldavCalendars = [ - [ - 'id' => 1, - 'name' => 'Calendar', - 'principaluri' => 'principals/user1', - 'uri' => 'calendar1', - ], - ]; - - protected $caldavCalendarObjects = [ - 1 => [ - 'event.ics' => [ - 'calendardata' => 'BEGIN:VCALENDAR -VERSION:2.0 -BEGIN:VEVENT -UID:foobar -DTEND;TZID=Europe/Berlin:20120207T191500 -RRULE:FREQ=DAILY;INTERVAL=1;COUNT=3 -SUMMARY:RecurringEvents 3 times -DTSTART;TZID=Europe/Berlin:20120207T181500 -END:VEVENT -BEGIN:VEVENT -CREATED:20120207T111900Z -UID:foobar -DTEND;TZID=Europe/Berlin:20120208T191500 -SUMMARY:RecurringEvents 3 times OVERWRITTEN -DTSTART;TZID=Europe/Berlin:20120208T181500 -RECURRENCE-ID;TZID=Europe/Berlin:20120208T181500 -END:VEVENT -END:VCALENDAR -', - ], - ], - ]; - - public function testExpand() - { - $request = HTTP\Sapi::createFromServerArray([ - 'REQUEST_METHOD' => 'REPORT', - 'HTTP_CONTENT_TYPE' => 'application/xml', - 'REQUEST_URI' => '/calendars/user1/calendar1', - 'HTTP_DEPTH' => '1', - ]); - - $request->setBody('<?xml version="1.0" encoding="utf-8" ?> -<C:calendar-query xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav"> - <D:prop> - <C:calendar-data> - <C:expand start="20120205T230000Z" end="20120212T225959Z"/> - </C:calendar-data> - <D:getetag/> - </D:prop> - <C:filter> - <C:comp-filter name="VCALENDAR"> - <C:comp-filter name="VEVENT"> - <C:time-range start="20120205T230000Z" end="20120212T225959Z"/> - </C:comp-filter> - </C:comp-filter> - </C:filter> -</C:calendar-query>'); - - $response = $this->request($request); - - $bodyAsString = $response->getBodyAsString(); - // Everts super awesome xml parser. - $body = substr( - $bodyAsString, - $start = strpos($bodyAsString, 'BEGIN:VCALENDAR'), - strpos($bodyAsString, 'END:VCALENDAR') - $start + 13 - ); - $body = str_replace(' ', '', $body); - - $vObject = VObject\Reader::read($body); - - // We only expect 3 events - $this->assertEquals(3, count($vObject->VEVENT), 'We got 6 events instead of 3. Output: '.$body); - - // TZID should be gone - $this->assertFalse(isset($vObject->VEVENT->DTSTART['TZID'])); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/FreeBusyReportTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/FreeBusyReportTest.php deleted file mode 100644 index 44823edab..000000000 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/FreeBusyReportTest.php +++ /dev/null @@ -1,158 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\CalDAV; - -use Sabre\DAV; -use Sabre\HTTP; - -class FreeBusyReportTest extends \PHPUnit\Framework\TestCase -{ - /** - * @var Plugin - */ - protected $plugin; - /** - * @var DAV\Server - */ - protected $server; - - public function setup(): void - { - $obj1 = <<<ics -BEGIN:VCALENDAR -BEGIN:VEVENT -DTSTART:20111005T120000Z -DURATION:PT1H -END:VEVENT -END:VCALENDAR -ics; - - $obj2 = fopen('php://memory', 'r+'); - fwrite($obj2, <<<ics -BEGIN:VCALENDAR -BEGIN:VEVENT -DTSTART:20121005T120000Z -DURATION:PT1H -END:VEVENT -END:VCALENDAR -ics - ); - rewind($obj2); - - $obj3 = <<<ics -BEGIN:VCALENDAR -BEGIN:VEVENT -DTSTART:20111006T120000 -DURATION:PT1H -END:VEVENT -END:VCALENDAR -ics; - - $calendarData = [ - 1 => [ - 'obj1' => [ - 'calendarid' => 1, - 'uri' => 'event1.ics', - 'calendardata' => $obj1, - ], - 'obj2' => [ - 'calendarid' => 1, - 'uri' => 'event2.ics', - 'calendardata' => $obj2, - ], - 'obj3' => [ - 'calendarid' => 1, - 'uri' => 'event3.ics', - 'calendardata' => $obj3, - ], - ], - ]; - - $caldavBackend = new Backend\Mock([], $calendarData); - - $calendar = new Calendar($caldavBackend, [ - 'id' => 1, - 'uri' => 'calendar', - 'principaluri' => 'principals/user1', - '{'.Plugin::NS_CALDAV.'}calendar-timezone' => "BEGIN:VCALENDAR\r\nBEGIN:VTIMEZONE\r\nTZID:Europe/Berlin\r\nEND:VTIMEZONE\r\nEND:VCALENDAR", - ]); - - $this->server = new DAV\Server([$calendar]); - - $request = new HTTP\Request('GET', '/calendar'); - $this->server->httpRequest = $request; - $this->server->httpResponse = new HTTP\ResponseMock(); - - $this->plugin = new Plugin(); - $this->server->addPlugin($this->plugin); - } - - public function testFreeBusyReport() - { - $reportXML = <<<XML -<?xml version="1.0"?> -<c:free-busy-query xmlns:c="urn:ietf:params:xml:ns:caldav"> - <c:time-range start="20111001T000000Z" end="20111101T000000Z" /> -</c:free-busy-query> -XML; - - $report = $this->server->xml->parse($reportXML, null, $rootElem); - $this->plugin->report($rootElem, $report, null); - - $this->assertEquals(200, $this->server->httpResponse->status); - $this->assertEquals('text/calendar', $this->server->httpResponse->getHeader('Content-Type')); - $this->assertTrue(false !== strpos($this->server->httpResponse->body, 'BEGIN:VFREEBUSY')); - $this->assertTrue(false !== strpos($this->server->httpResponse->body, '20111005T120000Z/20111005T130000Z')); - $this->assertTrue(false !== strpos($this->server->httpResponse->body, '20111006T100000Z/20111006T110000Z')); - } - - public function testFreeBusyReportNoTimeRange() - { - $this->expectException('Sabre\DAV\Exception\BadRequest'); - $reportXML = <<<XML -<?xml version="1.0"?> -<c:free-busy-query xmlns:c="urn:ietf:params:xml:ns:caldav"> -</c:free-busy-query> -XML; - - $report = $this->server->xml->parse($reportXML, null, $rootElem); - } - - public function testFreeBusyReportWrongNode() - { - $this->expectException('Sabre\DAV\Exception\NotImplemented'); - $request = new HTTP\Request('REPORT', '/'); - $this->server->httpRequest = $request; - - $reportXML = <<<XML -<?xml version="1.0"?> -<c:free-busy-query xmlns:c="urn:ietf:params:xml:ns:caldav"> - <c:time-range start="20111001T000000Z" end="20111101T000000Z" /> -</c:free-busy-query> -XML; - - $report = $this->server->xml->parse($reportXML, null, $rootElem); - $this->plugin->report($rootElem, $report, null); - } - - public function testFreeBusyReportNoACLPlugin() - { - $this->expectException('Sabre\DAV\Exception'); - $this->server = new DAV\Server(); - $this->server->httpRequest = new HTTP\Request('REPORT', '/'); - $this->plugin = new Plugin(); - $this->server->addPlugin($this->plugin); - - $reportXML = <<<XML -<?xml version="1.0"?> -<c:free-busy-query xmlns:c="urn:ietf:params:xml:ns:caldav"> - <c:time-range start="20111001T000000Z" end="20111101T000000Z" /> -</c:free-busy-query> -XML; - - $report = $this->server->xml->parse($reportXML, null, $rootElem); - $this->plugin->report($rootElem, $report, null); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/GetEventsByTimerangeTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/GetEventsByTimerangeTest.php deleted file mode 100644 index e82a85dd8..000000000 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/GetEventsByTimerangeTest.php +++ /dev/null @@ -1,82 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\CalDAV; - -use Sabre\HTTP; - -/** - * This unittest is created to check if queries for time-range include the start timestamp or not. - * - * @copyright Copyright (C) fruux GmbH (https://fruux.com/) - * @author Evert Pot (http://evertpot.com/) - * @license http://sabre.io/license/ Modified BSD License - */ -class GetEventsByTimerangeTest extends \Sabre\DAVServerTest -{ - protected $setupCalDAV = true; - - protected $caldavCalendars = [ - [ - 'id' => 1, - 'name' => 'Calendar', - 'principaluri' => 'principals/user1', - 'uri' => 'calendar1', - ], - ]; - - protected $caldavCalendarObjects = [ - 1 => [ - 'event.ics' => [ - 'calendardata' => 'BEGIN:VCALENDAR -VERSION:2.0 -BEGIN:VEVENT -CREATED:20120313T142342Z -UID:171EBEFC-C951-499D-B234-7BA7D677B45D -DTEND;TZID=Europe/Berlin:20120227T010000 -TRANSP:OPAQUE -SUMMARY:Monday 0h -DTSTART;TZID=Europe/Berlin:20120227T000000 -DTSTAMP:20120313T142416Z -SEQUENCE:4 -END:VEVENT -END:VCALENDAR -', - ], - ], - ]; - - public function testQueryTimerange() - { - $request = new HTTP\Request( - 'REPORT', - '/calendars/user1/calendar1', - [ - 'Content-Type' => 'application/xml', - 'Depth' => '1', - ] - ); - - $request->setBody('<?xml version="1.0" encoding="utf-8" ?> -<C:calendar-query xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav"> - <D:prop> - <C:calendar-data> - <C:expand start="20120226T220000Z" end="20120228T225959Z"/> - </C:calendar-data> - <D:getetag/> - </D:prop> - <C:filter> - <C:comp-filter name="VCALENDAR"> - <C:comp-filter name="VEVENT"> - <C:time-range start="20120226T220000Z" end="20120228T225959Z"/> - </C:comp-filter> - </C:comp-filter> - </C:filter> -</C:calendar-query>'); - - $response = $this->request($request); - - $this->assertTrue(false !== strpos($response->getBodyAsString(), 'BEGIN:VCALENDAR')); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/ICSExportPluginTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/ICSExportPluginTest.php deleted file mode 100644 index 8771f538b..000000000 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/ICSExportPluginTest.php +++ /dev/null @@ -1,366 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\CalDAV; - -use Sabre\DAV; -use Sabre\DAVACL; -use Sabre\HTTP; -use Sabre\VObject; - -class ICSExportPluginTest extends \Sabre\DAVServerTest -{ - protected $setupCalDAV = true; - - protected $icsExportPlugin; - - public function setup(): void - { - parent::setUp(); - $this->icsExportPlugin = new ICSExportPlugin(); - $this->server->addPlugin( - $this->icsExportPlugin - ); - - $id = $this->caldavBackend->createCalendar( - 'principals/admin', - 'UUID-123467', - [ - '{DAV:}displayname' => 'Hello!', - '{http://apple.com/ns/ical/}calendar-color' => '#AA0000FF', - ] - ); - - $this->caldavBackend->createCalendarObject( - $id, - 'event-1', - <<<ICS -BEGIN:VCALENDAR -BEGIN:VTIMEZONE -TZID:Europe/Amsterdam -END:VTIMEZONE -BEGIN:VEVENT -UID:event-1 -DTSTART;TZID=Europe/Amsterdam:20151020T000000 -END:VEVENT -END:VCALENDAR -ICS - ); - $this->caldavBackend->createCalendarObject( - $id, - 'todo-1', - <<<ICS -BEGIN:VCALENDAR -BEGIN:VTODO -UID:todo-1 -END:VTODO -END:VCALENDAR -ICS - ); - } - - public function testInit() - { - $this->assertEquals( - $this->icsExportPlugin, - $this->server->getPlugin('ics-export') - ); - $this->assertEquals($this->icsExportPlugin, $this->server->getPlugin('ics-export')); - $this->assertEquals('ics-export', $this->icsExportPlugin->getPluginInfo()['name']); - } - - public function testBeforeMethod() - { - $request = new HTTP\Request( - 'GET', - '/calendars/admin/UUID-123467?export' - ); - - $response = $this->request($request); - - $this->assertEquals(200, $response->getStatus()); - $this->assertEquals('text/calendar', $response->getHeader('Content-Type')); - - $obj = VObject\Reader::read($response->getBodyAsString()); - - $this->assertEquals(8, count($obj->children())); - $this->assertEquals(1, count($obj->VERSION)); - $this->assertEquals(1, count($obj->CALSCALE)); - $this->assertEquals(1, count($obj->PRODID)); - $this->assertTrue(false !== strpos((string) $obj->PRODID, DAV\Version::VERSION)); - $this->assertEquals(1, count($obj->VTIMEZONE)); - $this->assertEquals(1, count($obj->VEVENT)); - $this->assertEquals('Hello!', $obj->{'X-WR-CALNAME'}); - $this->assertEquals('#AA0000FF', $obj->{'X-APPLE-CALENDAR-COLOR'}); - } - - public function testBeforeMethodNoVersion() - { - $request = new HTTP\Request( - 'GET', - '/calendars/admin/UUID-123467?export' - ); - DAV\Server::$exposeVersion = false; - $response = $this->request($request); - DAV\Server::$exposeVersion = true; - - $this->assertEquals(200, $response->getStatus()); - $this->assertEquals('text/calendar', $response->getHeader('Content-Type')); - - $obj = VObject\Reader::read($response->getBodyAsString()); - - $this->assertEquals(8, count($obj->children())); - $this->assertEquals(1, count($obj->VERSION)); - $this->assertEquals(1, count($obj->CALSCALE)); - $this->assertEquals(1, count($obj->PRODID)); - $this->assertFalse(false !== strpos((string) $obj->PRODID, DAV\Version::VERSION)); - $this->assertEquals(1, count($obj->VTIMEZONE)); - $this->assertEquals(1, count($obj->VEVENT)); - } - - public function testBeforeMethodNoExport() - { - $request = new HTTP\Request( - 'GET', - '/calendars/admin/UUID-123467' - ); - $response = new HTTP\Response(); - $this->assertNull($this->icsExportPlugin->httpGet($request, $response)); - } - - public function testACLIntegrationBlocked() - { - $aclPlugin = new DAVACL\Plugin(); - $aclPlugin->allowUnauthenticatedAccess = false; - $this->server->addPlugin( - $aclPlugin - ); - - $request = new HTTP\Request( - 'GET', - '/calendars/admin/UUID-123467?export' - ); - - $this->request($request, 403); - } - - public function testACLIntegrationNotBlocked() - { - $aclPlugin = new DAVACL\Plugin(); - $aclPlugin->allowUnauthenticatedAccess = false; - $this->server->addPlugin( - $aclPlugin - ); - $this->server->addPlugin( - new Plugin() - ); - - $this->autoLogin('admin'); - - $request = new HTTP\Request( - 'GET', - '/calendars/admin/UUID-123467?export' - ); - - $response = $this->request($request, 200); - $this->assertEquals('text/calendar', $response->getHeader('Content-Type')); - - $obj = VObject\Reader::read($response->getBodyAsString()); - - $this->assertEquals(8, count($obj->children())); - $this->assertEquals(1, count($obj->VERSION)); - $this->assertEquals(1, count($obj->CALSCALE)); - $this->assertEquals(1, count($obj->PRODID)); - $this->assertTrue(false !== strpos((string) $obj->PRODID, DAV\Version::VERSION)); - $this->assertEquals(1, count($obj->VTIMEZONE)); - $this->assertEquals(1, count($obj->VEVENT)); - } - - public function testBadStartParam() - { - $request = new HTTP\Request( - 'GET', - '/calendars/admin/UUID-123467?export&start=foo' - ); - $this->request($request, 400); - } - - public function testBadEndParam() - { - $request = new HTTP\Request( - 'GET', - '/calendars/admin/UUID-123467?export&end=foo' - ); - $this->request($request, 400); - } - - public function testFilterStartEnd() - { - $request = new HTTP\Request( - 'GET', - '/calendars/admin/UUID-123467?export&start=1&end=2' - ); - $response = $this->request($request, 200); - - $obj = VObject\Reader::read($response->getBody()); - - $this->assertNull($obj->VTIMEZONE); - $this->assertNull($obj->VEVENT); - } - - public function testExpandNoStart() - { - $request = new HTTP\Request( - 'GET', - '/calendars/admin/UUID-123467?export&expand=1&end=2' - ); - $this->request($request, 400); - } - - public function testExpand() - { - $request = new HTTP\Request( - 'GET', - '/calendars/admin/UUID-123467?export&start=1&end=2000000000&expand=1' - ); - $response = $this->request($request, 200); - - $obj = VObject\Reader::read($response->getBody()); - - $this->assertNull($obj->VTIMEZONE); - $this->assertEquals(1, count($obj->VEVENT)); - } - - public function testJCal() - { - $request = new HTTP\Request( - 'GET', - '/calendars/admin/UUID-123467?export', - ['Accept' => 'application/calendar+json'] - ); - - $response = $this->request($request, 200); - $this->assertEquals('application/calendar+json', $response->getHeader('Content-Type')); - } - - public function testJCalInUrl() - { - $request = new HTTP\Request( - 'GET', - '/calendars/admin/UUID-123467?export&accept=jcal' - ); - - $response = $this->request($request, 200); - $this->assertEquals('application/calendar+json', $response->getHeader('Content-Type')); - } - - public function testNegotiateDefault() - { - $request = new HTTP\Request( - 'GET', - '/calendars/admin/UUID-123467?export', - ['Accept' => 'text/plain'] - ); - - $response = $this->request($request, 200); - $this->assertEquals('text/calendar', $response->getHeader('Content-Type')); - } - - public function testFilterComponentVEVENT() - { - $request = new HTTP\Request( - 'GET', - '/calendars/admin/UUID-123467?export&componentType=VEVENT' - ); - - $response = $this->request($request, 200); - - $obj = VObject\Reader::read($response->getBodyAsString()); - $this->assertEquals(1, count($obj->VTIMEZONE)); - $this->assertEquals(1, count($obj->VEVENT)); - $this->assertNull($obj->VTODO); - } - - public function testFilterComponentVTODO() - { - $request = new HTTP\Request( - 'GET', - '/calendars/admin/UUID-123467?export&componentType=VTODO' - ); - - $response = $this->request($request, 200); - - $obj = VObject\Reader::read($response->getBodyAsString()); - - $this->assertNull($obj->VTIMEZONE); - $this->assertNull($obj->VEVENT); - $this->assertEquals(1, count($obj->VTODO)); - } - - public function testFilterComponentBadComponent() - { - $request = new HTTP\Request( - 'GET', - '/calendars/admin/UUID-123467?export&componentType=VVOODOO' - ); - - $response = $this->request($request, 400); - } - - public function testContentDisposition() - { - $request = new HTTP\Request( - 'GET', - '/calendars/admin/UUID-123467?export' - ); - - $response = $this->request($request, 200); - $this->assertEquals('text/calendar', $response->getHeader('Content-Type')); - $this->assertEquals( - 'attachment; filename="UUID-123467-'.date('Y-m-d').'.ics"', - $response->getHeader('Content-Disposition') - ); - } - - public function testContentDispositionJson() - { - $request = new HTTP\Request( - 'GET', - '/calendars/admin/UUID-123467?export', - ['Accept' => 'application/calendar+json'] - ); - - $response = $this->request($request, 200); - $this->assertEquals('application/calendar+json', $response->getHeader('Content-Type')); - $this->assertEquals( - 'attachment; filename="UUID-123467-'.date('Y-m-d').'.json"', - $response->getHeader('Content-Disposition') - ); - } - - public function testContentDispositionBadChars() - { - $this->caldavBackend->createCalendar( - 'principals/admin', - 'UUID-b_ad"(ch)ars', - [ - '{DAV:}displayname' => 'Test bad characters', - '{http://apple.com/ns/ical/}calendar-color' => '#AA0000FF', - ] - ); - - $request = new HTTP\Request( - 'GET', - '/calendars/admin/UUID-b_ad"(ch)ars?export', - ['Accept' => 'application/calendar+json'] - ); - - $response = $this->request($request, 200); - $this->assertEquals('application/calendar+json', $response->getHeader('Content-Type')); - $this->assertEquals( - 'attachment; filename="UUID-b_adchars-'.date('Y-m-d').'.json"', - $response->getHeader('Content-Disposition') - ); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Issue166Test.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Issue166Test.php deleted file mode 100644 index 02d39fe84..000000000 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/Issue166Test.php +++ /dev/null @@ -1,63 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\CalDAV; - -use Sabre\VObject; - -class Issue166Test extends \PHPUnit\Framework\TestCase -{ - public function testFlaw() - { - $input = <<<HI -BEGIN:VCALENDAR -PRODID:-//Mozilla.org/NONSGML Mozilla Calendar V1.1//EN -VERSION:2.0 -BEGIN:VTIMEZONE -TZID:Asia/Pyongyang -X-LIC-LOCATION:Asia/Pyongyang -BEGIN:STANDARD -TZOFFSETFROM:+0900 -TZOFFSETTO:+0900 -TZNAME:KST -DTSTART:19700101T000000 -END:STANDARD -END:VTIMEZONE -BEGIN:VEVENT -CREATED:20111118T010857Z -LAST-MODIFIED:20111118T010937Z -DTSTAMP:20111118T010937Z -UID:a03245b3-9947-9a48-a088-863c74e0fdd8 -SUMMARY:New Event -RRULE:FREQ=YEARLY -DTSTART;TZID=Asia/Pyongyang:19960102T111500 -DTEND;TZID=Asia/Pyongyang:19960102T121500 -END:VEVENT -END:VCALENDAR -HI; - - $validator = new CalendarQueryValidator(); - - $filters = [ - 'name' => 'VCALENDAR', - 'comp-filters' => [ - [ - 'name' => 'VEVENT', - 'comp-filters' => [], - 'prop-filters' => [], - 'is-not-defined' => false, - 'time-range' => [ - 'start' => new \DateTime('2011-12-01'), - 'end' => new \DateTime('2012-02-01'), - ], - ], - ], - 'prop-filters' => [], - 'is-not-defined' => false, - 'time-range' => null, - ]; - $input = VObject\Reader::read($input); - $this->assertTrue($validator->validate($input, $filters)); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Issue172Test.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Issue172Test.php deleted file mode 100644 index 83120fe6a..000000000 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/Issue172Test.php +++ /dev/null @@ -1,140 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\CalDAV; - -use Sabre\VObject; - -class Issue172Test extends \PHPUnit\Framework\TestCase -{ - // DateTimeZone() native name: America/Los_Angeles (GMT-8 in January) - public function testBuiltInTimezoneName() - { - $input = <<<HI -BEGIN:VCALENDAR -VERSION:2.0 -BEGIN:VEVENT -DTSTART;TZID=America/Los_Angeles:20120118T204500 -DTEND;TZID=America/Los_Angeles:20120118T214500 -END:VEVENT -END:VCALENDAR -HI; - $validator = new CalendarQueryValidator(); - $filters = [ - 'name' => 'VCALENDAR', - 'comp-filters' => [ - [ - 'name' => 'VEVENT', - 'comp-filters' => [], - 'prop-filters' => [], - 'is-not-defined' => false, - 'time-range' => [ - 'start' => new \DateTime('2012-01-18 21:00:00 GMT-08:00'), - 'end' => new \DateTime('2012-01-18 21:00:00 GMT-08:00'), - ], - ], - ], - 'prop-filters' => [], - ]; - $input = VObject\Reader::read($input); - $this->assertTrue($validator->validate($input, $filters)); - } - - // Pacific Standard Time, translates to America/Los_Angeles (GMT-8 in January) - public function testOutlookTimezoneName() - { - $input = <<<HI -BEGIN:VCALENDAR -VERSION:2.0 -BEGIN:VTIMEZONE -TZID:Pacific Standard Time -BEGIN:STANDARD -DTSTART:16010101T030000 -TZOFFSETFROM:+0200 -TZOFFSETTO:+0100 -RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10 -END:STANDARD -BEGIN:DAYLIGHT -DTSTART:16010101T020000 -TZOFFSETFROM:+0100 -TZOFFSETTO:+0200 -RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=3 -END:DAYLIGHT -END:VTIMEZONE -BEGIN:VEVENT -DTSTART;TZID=Pacific Standard Time:20120113T100000 -DTEND;TZID=Pacific Standard Time:20120113T110000 -END:VEVENT -END:VCALENDAR -HI; - $validator = new CalendarQueryValidator(); - $filters = [ - 'name' => 'VCALENDAR', - 'comp-filters' => [ - [ - 'name' => 'VEVENT', - 'comp-filters' => [], - 'prop-filters' => [], - 'is-not-defined' => false, - 'time-range' => [ - 'start' => new \DateTime('2012-01-13 10:30:00 GMT-08:00'), - 'end' => new \DateTime('2012-01-13 10:30:00 GMT-08:00'), - ], - ], - ], - 'prop-filters' => [], - ]; - $input = VObject\Reader::read($input); - $this->assertTrue($validator->validate($input, $filters)); - } - - // X-LIC-LOCATION, translates to America/Los_Angeles (GMT-8 in January) - public function testLibICalLocationName() - { - $input = <<<HI -BEGIN:VCALENDAR -VERSION:2.0 -BEGIN:VTIMEZONE -TZID:My own timezone name -X-LIC-LOCATION:America/Los_Angeles -BEGIN:STANDARD -DTSTART:16010101T030000 -TZOFFSETFROM:+0200 -TZOFFSETTO:+0100 -RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10 -END:STANDARD -BEGIN:DAYLIGHT -DTSTART:16010101T020000 -TZOFFSETFROM:+0100 -TZOFFSETTO:+0200 -RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=3 -END:DAYLIGHT -END:VTIMEZONE -BEGIN:VEVENT -DTSTART;TZID=My own timezone name:20120113T100000 -DTEND;TZID=My own timezone name:20120113T110000 -END:VEVENT -END:VCALENDAR -HI; - $validator = new CalendarQueryValidator(); - $filters = [ - 'name' => 'VCALENDAR', - 'comp-filters' => [ - [ - 'name' => 'VEVENT', - 'comp-filters' => [], - 'prop-filters' => [], - 'is-not-defined' => false, - 'time-range' => [ - 'start' => new \DateTime('2012-01-13 10:30:00 GMT-08:00'), - 'end' => new \DateTime('2012-01-13 10:30:00 GMT-08:00'), - ], - ], - ], - 'prop-filters' => [], - ]; - $input = VObject\Reader::read($input); - $this->assertTrue($validator->validate($input, $filters)); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Issue203Test.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Issue203Test.php deleted file mode 100644 index 9a786c505..000000000 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/Issue203Test.php +++ /dev/null @@ -1,138 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\CalDAV; - -use Sabre\HTTP; -use Sabre\VObject; - -/** - * This unittest is created to find out why an overwritten DAILY event has wrong DTSTART, DTEND, SUMMARY and RECURRENCEID. - * - * @copyright Copyright (C) fruux GmbH (https://fruux.com/) - * @author Evert Pot (http://evertpot.com/) - * @license http://sabre.io/license/ Modified BSD License - */ -class Issue203Test extends \Sabre\DAVServerTest -{ - protected $setupCalDAV = true; - - protected $caldavCalendars = [ - [ - 'id' => 1, - 'name' => 'Calendar', - 'principaluri' => 'principals/user1', - 'uri' => 'calendar1', - ], - ]; - - protected $caldavCalendarObjects = [ - 1 => [ - 'event.ics' => [ - 'calendardata' => 'BEGIN:VCALENDAR -VERSION:2.0 -BEGIN:VEVENT -UID:20120330T155305CEST-6585fBUVgV -DTSTAMP:20120330T135305Z -DTSTART;TZID=Europe/Berlin:20120326T155200 -DTEND;TZID=Europe/Berlin:20120326T165200 -RRULE:FREQ=DAILY;COUNT=2;INTERVAL=1 -SUMMARY:original summary -TRANSP:OPAQUE -END:VEVENT -BEGIN:VEVENT -UID:20120330T155305CEST-6585fBUVgV -DTSTAMP:20120330T135352Z -DESCRIPTION: -DTSTART;TZID=Europe/Berlin:20120328T155200 -DTEND;TZID=Europe/Berlin:20120328T165200 -RECURRENCE-ID;TZID=Europe/Berlin:20120327T155200 -SEQUENCE:1 -SUMMARY:overwritten summary -TRANSP:OPAQUE -END:VEVENT -END:VCALENDAR -', - ], - ], - ]; - - public function testIssue203() - { - $request = HTTP\Sapi::createFromServerArray([ - 'REQUEST_METHOD' => 'REPORT', - 'HTTP_CONTENT_TYPE' => 'application/xml', - 'REQUEST_URI' => '/calendars/user1/calendar1', - 'HTTP_DEPTH' => '1', - ]); - - $request->setBody('<?xml version="1.0" encoding="utf-8" ?> -<C:calendar-query xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav"> - <D:prop> - <C:calendar-data> - <C:expand start="20120325T220000Z" end="20120401T215959Z"/> - </C:calendar-data> - <D:getetag/> - </D:prop> - <C:filter> - <C:comp-filter name="VCALENDAR"> - <C:comp-filter name="VEVENT"> - <C:time-range start="20120325T220000Z" end="20120401T215959Z"/> - </C:comp-filter> - </C:comp-filter> - </C:filter> -</C:calendar-query>'); - - $response = $this->request($request); - - $bodyAsString = $response->getBodyAsString(); - // Everts super awesome xml parser. - $body = substr( - $bodyAsString, - $start = strpos($bodyAsString, 'BEGIN:VCALENDAR'), - strpos($bodyAsString, 'END:VCALENDAR') - $start + 13 - ); - $body = str_replace(' ', '', $body); - - $vObject = VObject\Reader::read($body); - - $this->assertEquals(2, count($vObject->VEVENT)); - - $expectedEvents = [ - [ - 'DTSTART' => '20120326T135200Z', - 'DTEND' => '20120326T145200Z', - 'SUMMARY' => 'original summary', - ], - [ - 'DTSTART' => '20120328T135200Z', - 'DTEND' => '20120328T145200Z', - 'SUMMARY' => 'overwritten summary', - 'RECURRENCE-ID' => '20120327T135200Z', - ], - ]; - - // try to match agains $expectedEvents array - foreach ($expectedEvents as $expectedEvent) { - $matching = false; - - foreach ($vObject->VEVENT as $vevent) { - /** @var $vevent Sabre\VObject\Component\VEvent */ - foreach ($vevent->children() as $child) { - /** @var $child Sabre\VObject\Property */ - if (isset($expectedEvent[$child->name])) { - if ($expectedEvent[$child->name] != $child->getValue()) { - continue 2; - } - } - } - - $matching = true; - break; - } - - $this->assertTrue($matching, 'Did not find the following event in the response: '.var_export($expectedEvent, true)); - } - } -} diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Issue205Test.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Issue205Test.php deleted file mode 100644 index b021634ba..000000000 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/Issue205Test.php +++ /dev/null @@ -1,99 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\CalDAV; - -use Sabre\HTTP; -use Sabre\VObject; - -/** - * This unittest is created to check if a VALARM TRIGGER of PT0S is supported. - * - * @copyright Copyright (C) fruux GmbH (https://fruux.com/) - * @author Evert Pot (http://evertpot.com/) - * @license http://sabre.io/license/ Modified BSD License - */ -class Issue205Test extends \Sabre\DAVServerTest -{ - protected $setupCalDAV = true; - - protected $caldavCalendars = [ - [ - 'id' => 1, - 'name' => 'Calendar', - 'principaluri' => 'principals/user1', - 'uri' => 'calendar1', - ], - ]; - - protected $caldavCalendarObjects = [ - 1 => [ - 'event.ics' => [ - 'calendardata' => 'BEGIN:VCALENDAR -VERSION:2.0 -BEGIN:VEVENT -UID:20120330T155305CEST-6585fBUVgV -DTSTAMP:20120330T135305Z -DTSTART;TZID=Europe/Berlin:20120326T155200 -DTEND;TZID=Europe/Berlin:20120326T165200 -SUMMARY:original summary -TRANSP:OPAQUE -BEGIN:VALARM -ACTION:AUDIO -ATTACH;VALUE=URI:Basso -TRIGGER:PT0S -END:VALARM -END:VEVENT -END:VCALENDAR -', - ], - ], - ]; - - public function testIssue205() - { - $request = HTTP\Sapi::createFromServerArray([ - 'REQUEST_METHOD' => 'REPORT', - 'HTTP_CONTENT_TYPE' => 'application/xml', - 'REQUEST_URI' => '/calendars/user1/calendar1', - 'HTTP_DEPTH' => '1', - ]); - - $request->setBody('<?xml version="1.0" encoding="utf-8" ?> -<C:calendar-query xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav"> - <D:prop> - <C:calendar-data> - <C:expand start="20120325T220000Z" end="20120401T215959Z"/> - </C:calendar-data> - <D:getetag/> - </D:prop> - <C:filter> - <C:comp-filter name="VCALENDAR"> - <C:comp-filter name="VEVENT"> - <C:comp-filter name="VALARM"> - <C:time-range start="20120325T220000Z" end="20120401T215959Z"/> - </C:comp-filter> - </C:comp-filter> - </C:comp-filter> - </C:filter> -</C:calendar-query>'); - - $response = $this->request($request); - - $this->assertFalse(strpos($response->getBodyAsString(), '<s:exception>Exception</s:exception>'), 'Exception occurred: '.$response->getBodyAsString()); - $this->assertFalse(strpos($response->getBodyAsString(), 'Unknown or bad format'), 'DateTime unknown format Exception: '.$response->getBodyAsString()); - - // Everts super awesome xml parser. - $body = substr( - $response->getBodyAsString(), - $start = strpos($response->getBodyAsString(), 'BEGIN:VCALENDAR'), - strpos($response->getBodyAsString(), 'END:VCALENDAR') - $start + 13 - ); - $body = str_replace(' ', '', $body); - - $vObject = VObject\Reader::read($body); - - $this->assertEquals(1, count($vObject->VEVENT)); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Issue211Test.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Issue211Test.php deleted file mode 100644 index d7fa18c09..000000000 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/Issue211Test.php +++ /dev/null @@ -1,90 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\CalDAV; - -use Sabre\HTTP; - -/** - * This unittest is created to check for an endless loop in Sabre\CalDAV\CalendarQueryValidator. - * - * @copyright Copyright (C) fruux GmbH (https://fruux.com/) - * @author Evert Pot (http://evertpot.com/) - * @license http://sabre.io/license/ Modified BSD License - */ -class Issue211Test extends \Sabre\DAVServerTest -{ - protected $setupCalDAV = true; - - protected $caldavCalendars = [ - [ - 'id' => 1, - 'name' => 'Calendar', - 'principaluri' => 'principals/user1', - 'uri' => 'calendar1', - ], - ]; - - protected $caldavCalendarObjects = [ - 1 => [ - 'event.ics' => [ - 'calendardata' => 'BEGIN:VCALENDAR -VERSION:2.0 -BEGIN:VEVENT -UID:20120418T172519CEST-3510gh1hVw -DTSTAMP:20120418T152519Z -DTSTART;VALUE=DATE:20120330 -DTEND;VALUE=DATE:20120531 -EXDATE;TZID=Europe/Berlin:20120330T000000 -RRULE:FREQ=YEARLY;INTERVAL=1 -SEQUENCE:1 -SUMMARY:Birthday -TRANSP:TRANSPARENT -BEGIN:VALARM -ACTION:EMAIL -ATTENDEE:MAILTO:xxx@domain.de -DESCRIPTION:Dies ist eine Kalender Erinnerung -SUMMARY:Kalender Alarm Erinnerung -TRIGGER;VALUE=DATE-TIME:20120329T060000Z -END:VALARM -END:VEVENT -END:VCALENDAR -', - ], - ], - ]; - - public function testIssue211() - { - $request = HTTP\Sapi::createFromServerArray([ - 'REQUEST_METHOD' => 'REPORT', - 'HTTP_CONTENT_TYPE' => 'application/xml', - 'REQUEST_URI' => '/calendars/user1/calendar1', - 'HTTP_DEPTH' => '1', - ]); - - $request->setBody('<?xml version="1.0" encoding="utf-8" ?> -<C:calendar-query xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav"> - <D:prop> - <C:calendar-data/> - <D:getetag/> - </D:prop> - <C:filter> - <C:comp-filter name="VCALENDAR"> - <C:comp-filter name="VEVENT"> - <C:comp-filter name="VALARM"> - <C:time-range start="20120426T220000Z" end="20120427T215959Z"/> - </C:comp-filter> - </C:comp-filter> - </C:comp-filter> - </C:filter> -</C:calendar-query>'); - - $response = $this->request($request); - - // if this assert is reached, the endless loop is gone - // There should be no matching events - $this->assertFalse(strpos('BEGIN:VEVENT', $response->getBodyAsString())); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Issue220Test.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Issue220Test.php deleted file mode 100644 index 8e51e49e2..000000000 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/Issue220Test.php +++ /dev/null @@ -1,101 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\CalDAV; - -use Sabre\HTTP; - -/** - * This unittest is created to check for an endless loop in CalendarQueryValidator. - * - * @copyright Copyright (C) fruux GmbH (https://fruux.com/) - * @author Evert Pot (http://evertpot.com/) - * @license http://sabre.io/license/ Modified BSD License - */ -class Issue220Test extends \Sabre\DAVServerTest -{ - protected $setupCalDAV = true; - - protected $caldavCalendars = [ - [ - 'id' => 1, - 'name' => 'Calendar', - 'principaluri' => 'principals/user1', - 'uri' => 'calendar1', - ], - ]; - - protected $caldavCalendarObjects = [ - 1 => [ - 'event.ics' => [ - 'calendardata' => 'BEGIN:VCALENDAR -VERSION:2.0 -BEGIN:VEVENT -DTSTART;TZID=Europe/Berlin:20120601T180000 -SUMMARY:Brot backen -RRULE:FREQ=DAILY;INTERVAL=1;WKST=MO -TRANSP:OPAQUE -DURATION:PT20M -LAST-MODIFIED:20120601T064634Z -CREATED:20120601T064634Z -DTSTAMP:20120601T064634Z -UID:b64f14c5-dccc-4eda-947f-bdb1f763fbcd -BEGIN:VALARM -TRIGGER;VALUE=DURATION:-PT5M -ACTION:DISPLAY -DESCRIPTION:Default Event Notification -X-WR-ALARMUID:cd952c1b-b3d6-41fb-b0a6-ec3a1a5bdd58 -END:VALARM -END:VEVENT -BEGIN:VEVENT -DTSTART;TZID=Europe/Berlin:20120606T180000 -SUMMARY:Brot backen -TRANSP:OPAQUE -STATUS:CANCELLED -DTEND;TZID=Europe/Berlin:20120606T182000 -LAST-MODIFIED:20120605T094310Z -SEQUENCE:1 -RECURRENCE-ID:20120606T160000Z -UID:b64f14c5-dccc-4eda-947f-bdb1f763fbcd -END:VEVENT -END:VCALENDAR -', - ], - ], - ]; - - public function testIssue220() - { - $request = HTTP\Sapi::createFromServerArray([ - 'REQUEST_METHOD' => 'REPORT', - 'HTTP_CONTENT_TYPE' => 'application/xml', - 'REQUEST_URI' => '/calendars/user1/calendar1', - 'HTTP_DEPTH' => '1', - ]); - - $request->setBody('<?xml version="1.0" encoding="utf-8" ?> -<C:calendar-query xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav"> - <D:prop> - <C:calendar-data/> - <D:getetag/> - </D:prop> - <C:filter> - <C:comp-filter name="VCALENDAR"> - <C:comp-filter name="VEVENT"> - <C:comp-filter name="VALARM"> - <C:time-range start="20120607T161646Z" end="20120612T161646Z"/> - </C:comp-filter> - </C:comp-filter> - </C:comp-filter> - </C:filter> -</C:calendar-query>'); - - $response = $this->request($request); - - $this->assertFalse(strpos($response->getBodyAsString(), '<s:exception>PHPUnit_Framework_Error_Warning</s:exception>'), 'Error Warning occurred: '.$response->getBodyAsString()); - $this->assertFalse(strpos($response->getBodyAsString(), 'Invalid argument supplied for foreach()'), 'Invalid argument supplied for foreach(): '.$response->getBodyAsString()); - - $this->assertEquals(207, $response->status); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Issue228Test.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Issue228Test.php deleted file mode 100644 index 1f698e7dd..000000000 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/Issue228Test.php +++ /dev/null @@ -1,80 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\CalDAV; - -use Sabre\HTTP; - -/** - * This unittest is created to check if the time-range filter is working correctly with all-day-events. - * - * @copyright Copyright (C) fruux GmbH (https://fruux.com/) - * @author Evert Pot (http://evertpot.com/) - * @license http://sabre.io/license/ Modified BSD License - */ -class Issue228Test extends \Sabre\DAVServerTest -{ - protected $setupCalDAV = true; - - protected $caldavCalendars = [ - [ - 'id' => 1, - 'name' => 'Calendar', - 'principaluri' => 'principals/user1', - 'uri' => 'calendar1', - ], - ]; - - protected $caldavCalendarObjects = [ - 1 => [ - 'event.ics' => [ - 'calendardata' => 'BEGIN:VCALENDAR -VERSION:2.0 -BEGIN:VEVENT -UID:20120730T113415CEST-6804EGphkd@xxxxxx.de -DTSTAMP:20120730T093415Z -DTSTART;VALUE=DATE:20120729 -DTEND;VALUE=DATE:20120730 -SUMMARY:sunday event -TRANSP:TRANSPARENT -END:VEVENT -END:VCALENDAR -', - ], - ], - ]; - - public function testIssue228() - { - $request = HTTP\Sapi::createFromServerArray([ - 'REQUEST_METHOD' => 'REPORT', - 'HTTP_CONTENT_TYPE' => 'application/xml', - 'REQUEST_URI' => '/calendars/user1/calendar1', - 'HTTP_DEPTH' => '1', - ]); - - $request->setBody('<?xml version="1.0" encoding="utf-8" ?> -<C:calendar-query xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav"> - <D:prop> - <C:calendar-data> - <C:expand start="20120730T095609Z" - end="20120813T095609Z"/> -</C:calendar-data> - <D:getetag/> - </D:prop> - <C:filter> - <C:comp-filter name="VCALENDAR"> - <C:comp-filter name="VEVENT"> - <C:time-range start="20120730T095609Z" end="20120813T095609Z"/> - </C:comp-filter> - </C:comp-filter> - </C:filter> -</C:calendar-query>'); - - $response = $this->request($request); - - // We must check if absolutely nothing was returned from this query. - $this->assertFalse(strpos($response->getBodyAsString(), 'BEGIN:VCALENDAR')); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Notifications/CollectionTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Notifications/CollectionTest.php deleted file mode 100644 index 594241e0d..000000000 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/Notifications/CollectionTest.php +++ /dev/null @@ -1,78 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\CalDAV\Notifications; - -use Sabre\CalDAV; - -class CollectionTest extends \PHPUnit\Framework\TestCase -{ - protected $caldavBackend; - protected $principalUri; - protected $notification; - - public function getInstance() - { - $this->principalUri = 'principals/user1'; - - $this->notification = new CalDAV\Xml\Notification\SystemStatus(1, '"1"'); - - $this->caldavBackend = new CalDAV\Backend\MockSharing([], [], [ - 'principals/user1' => [ - $this->notification, - ], - ]); - - return new Collection($this->caldavBackend, $this->principalUri); - } - - public function testGetChildren() - { - $col = $this->getInstance(); - $this->assertEquals('notifications', $col->getName()); - - $this->assertEquals([ - new Node($this->caldavBackend, $this->principalUri, $this->notification), - ], $col->getChildren()); - } - - public function testGetOwner() - { - $col = $this->getInstance(); - $this->assertEquals('principals/user1', $col->getOwner()); - } - - public function testGetGroup() - { - $col = $this->getInstance(); - $this->assertNull($col->getGroup()); - } - - public function testGetACL() - { - $col = $this->getInstance(); - $expected = [ - [ - 'privilege' => '{DAV:}all', - 'principal' => '{DAV:}owner', - 'protected' => true, - ], - ]; - - $this->assertEquals($expected, $col->getACL()); - } - - public function testSetACL() - { - $this->expectException('Sabre\DAV\Exception\Forbidden'); - $col = $this->getInstance(); - $col->setACL([]); - } - - public function testGetSupportedPrivilegeSet() - { - $col = $this->getInstance(); - $this->assertNull($col->getSupportedPrivilegeSet()); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Notifications/NodeTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Notifications/NodeTest.php deleted file mode 100644 index 623525e69..000000000 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/Notifications/NodeTest.php +++ /dev/null @@ -1,88 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\CalDAV\Notifications; - -use Sabre\CalDAV; - -class NodeTest extends \PHPUnit\Framework\TestCase -{ - protected $systemStatus; - protected $caldavBackend; - - public function getInstance() - { - $principalUri = 'principals/user1'; - - $this->systemStatus = new CalDAV\Xml\Notification\SystemStatus(1, '"1"'); - - $this->caldavBackend = new CalDAV\Backend\MockSharing([], [], [ - 'principals/user1' => [ - $this->systemStatus, - ], - ]); - - $node = new Node($this->caldavBackend, 'principals/user1', $this->systemStatus); - - return $node; - } - - public function testGetId() - { - $node = $this->getInstance(); - $this->assertEquals($this->systemStatus->getId().'.xml', $node->getName()); - } - - public function testGetEtag() - { - $node = $this->getInstance(); - $this->assertEquals('"1"', $node->getETag()); - } - - public function testGetNotificationType() - { - $node = $this->getInstance(); - $this->assertEquals($this->systemStatus, $node->getNotificationType()); - } - - public function testDelete() - { - $node = $this->getInstance(); - $node->delete(); - $this->assertEquals([], $this->caldavBackend->getNotificationsForPrincipal('principals/user1')); - } - - public function testGetGroup() - { - $node = $this->getInstance(); - $this->assertNull($node->getGroup()); - } - - public function testGetACL() - { - $node = $this->getInstance(); - $expected = [ - [ - 'privilege' => '{DAV:}all', - 'principal' => '{DAV:}owner', - 'protected' => true, - ], - ]; - - $this->assertEquals($expected, $node->getACL()); - } - - public function testSetACL() - { - $this->expectException('Sabre\DAV\Exception\Forbidden'); - $node = $this->getInstance(); - $node->setACL([]); - } - - public function testGetSupportedPrivilegeSet() - { - $node = $this->getInstance(); - $this->assertNull($node->getSupportedPrivilegeSet()); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/PluginTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/PluginTest.php deleted file mode 100644 index a4f08f7e5..000000000 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/PluginTest.php +++ /dev/null @@ -1,1071 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\CalDAV; - -use DateTime; -use DateTimeZone; -use Sabre\DAV; -use Sabre\DAVACL; -use Sabre\HTTP; - -class PluginTest extends \PHPUnit\Framework\TestCase -{ - /** - * @var DAV\Server - */ - protected $server; - /** - * @var Plugin - */ - protected $plugin; - protected $response; - /** - * @var Backend\PDO - */ - protected $caldavBackend; - - public function setup(): void - { - $caldavNS = '{urn:ietf:params:xml:ns:caldav}'; - - $this->caldavBackend = new Backend\Mock([ - [ - 'id' => 1, - 'uri' => 'UUID-123467', - 'principaluri' => 'principals/user1', - '{DAV:}displayname' => 'user1 calendar', - $caldavNS.'calendar-description' => 'Calendar description', - '{http://apple.com/ns/ical/}calendar-order' => '1', - '{http://apple.com/ns/ical/}calendar-color' => '#FF0000', - $caldavNS.'supported-calendar-component-set' => new Xml\Property\SupportedCalendarComponentSet(['VEVENT', 'VTODO']), - ], - [ - 'id' => 2, - 'uri' => 'UUID-123468', - 'principaluri' => 'principals/user1', - '{DAV:}displayname' => 'user1 calendar2', - $caldavNS.'calendar-description' => 'Calendar description', - '{http://apple.com/ns/ical/}calendar-order' => '1', - '{http://apple.com/ns/ical/}calendar-color' => '#FF0000', - $caldavNS.'supported-calendar-component-set' => new Xml\Property\SupportedCalendarComponentSet(['VEVENT', 'VTODO']), - ], - ], [ - 1 => [ - 'UUID-2345' => [ - 'calendardata' => TestUtil::getTestCalendarData(), - ], - ], - ]); - $principalBackend = new DAVACL\PrincipalBackend\Mock(); - $principalBackend->setGroupMemberSet('principals/admin/calendar-proxy-read', ['principals/user1']); - $principalBackend->setGroupMemberSet('principals/admin/calendar-proxy-write', ['principals/user1']); - $principalBackend->addPrincipal([ - 'uri' => 'principals/admin/calendar-proxy-read', - ]); - $principalBackend->addPrincipal([ - 'uri' => 'principals/admin/calendar-proxy-write', - ]); - - $calendars = new CalendarRoot($principalBackend, $this->caldavBackend); - $principals = new Principal\Collection($principalBackend); - - $root = new DAV\SimpleCollection('root'); - $root->addChild($calendars); - $root->addChild($principals); - - $this->server = new DAV\Server($root); - $this->server->sapi = new HTTP\SapiMock(); - $this->server->debugExceptions = true; - $this->server->setBaseUri('/'); - $this->plugin = new Plugin(); - $this->server->addPlugin($this->plugin); - - // Adding ACL plugin - $aclPlugin = new DAVACL\Plugin(); - $aclPlugin->allowUnauthenticatedAccess = false; - $this->server->addPlugin($aclPlugin); - - // Adding Auth plugin, and ensuring that we are logged in. - $authBackend = new DAV\Auth\Backend\Mock(); - $authBackend->setPrincipal('principals/user1'); - $authPlugin = new DAV\Auth\Plugin($authBackend); - $authPlugin->beforeMethod(new \Sabre\HTTP\Request('GET', '/'), new \Sabre\HTTP\Response()); - $this->server->addPlugin($authPlugin); - - // This forces a login - $authPlugin->beforeMethod(new HTTP\Request('GET', '/'), new HTTP\Response()); - - $this->response = new HTTP\ResponseMock(); - $this->server->httpResponse = $this->response; - } - - public function testSimple() - { - $this->assertEquals(['MKCALENDAR'], $this->plugin->getHTTPMethods('calendars/user1/randomnewcalendar')); - $this->assertEquals(['calendar-access', 'calendar-proxy'], $this->plugin->getFeatures()); - $this->assertEquals( - 'caldav', - $this->plugin->getPluginInfo()['name'] - ); - } - - public function testUnknownMethodPassThrough() - { - $request = new HTTP\Request('MKBREAKFAST', '/'); - - $this->server->httpRequest = $request; - $this->server->exec(); - - $this->assertEquals(501, $this->response->status, 'Incorrect status returned. Full response body:'.$this->response->getBodyAsString()); - } - - public function testGetWithoutContentType() - { - $request = new HTTP\Request('GET', '/'); - $this->plugin->httpAfterGet($request, $this->response); - $this->assertTrue(true); - } - - public function testReportPassThrough() - { - $request = new HTTP\Request('REPORT', '/', ['Content-Type' => 'application/xml']); - $request->setBody('<?xml version="1.0"?><s:somereport xmlns:s="http://www.rooftopsolutions.nl/NS/example" />'); - - $this->server->httpRequest = $request; - $this->server->exec(); - - $this->assertEquals(415, $this->response->status); - } - - public function testMkCalendarBadLocation() - { - $request = new HTTP\Request('MKCALENDAR', '/blabla'); - - $body = '<?xml version="1.0" encoding="utf-8" ?> - <C:mkcalendar xmlns:D="DAV:" - xmlns:C="urn:ietf:params:xml:ns:caldav"> - <D:set> - <D:prop> - <D:displayname>Lisa\'s Events</D:displayname> - <C:calendar-description xml:lang="en" - >Calendar restricted to events.</C:calendar-description> - <C:supported-calendar-component-set> - <C:comp name="VEVENT"/> - </C:supported-calendar-component-set> - <C:calendar-timezone><![CDATA[BEGIN:VCALENDAR - PRODID:-//Example Corp.//CalDAV Client//EN - VERSION:2.0 - BEGIN:VTIMEZONE - TZID:US-Eastern - LAST-MODIFIED:19870101T000000Z - BEGIN:STANDARD - DTSTART:19671029T020000 - RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10 - TZOFFSETFROM:-0400 - TZOFFSETTO:-0500 - TZNAME:Eastern Standard Time (US & Canada) - END:STANDARD - BEGIN:DAYLIGHT - DTSTART:19870405T020000 - RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4 - TZOFFSETFROM:-0500 - TZOFFSETTO:-0400 - TZNAME:Eastern Daylight Time (US & Canada) - END:DAYLIGHT - END:VTIMEZONE - END:VCALENDAR - ]]></C:calendar-timezone> - </D:prop> - </D:set> - </C:mkcalendar>'; - - $request->setBody($body); - $this->server->httpRequest = $request; - $this->server->exec(); - - $this->assertEquals(403, $this->response->status); - } - - public function testMkCalendarNoParentNode() - { - $request = new HTTP\Request('MKCALENDAR', '/doesntexist/calendar'); - - $body = '<?xml version="1.0" encoding="utf-8" ?> - <C:mkcalendar xmlns:D="DAV:" - xmlns:C="urn:ietf:params:xml:ns:caldav"> - <D:set> - <D:prop> - <D:displayname>Lisa\'s Events</D:displayname> - <C:calendar-description xml:lang="en" - >Calendar restricted to events.</C:calendar-description> - <C:supported-calendar-component-set> - <C:comp name="VEVENT"/> - </C:supported-calendar-component-set> - <C:calendar-timezone><![CDATA[BEGIN:VCALENDAR - PRODID:-//Example Corp.//CalDAV Client//EN - VERSION:2.0 - BEGIN:VTIMEZONE - TZID:US-Eastern - LAST-MODIFIED:19870101T000000Z - BEGIN:STANDARD - DTSTART:19671029T020000 - RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10 - TZOFFSETFROM:-0400 - TZOFFSETTO:-0500 - TZNAME:Eastern Standard Time (US & Canada) - END:STANDARD - BEGIN:DAYLIGHT - DTSTART:19870405T020000 - RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4 - TZOFFSETFROM:-0500 - TZOFFSETTO:-0400 - TZNAME:Eastern Daylight Time (US & Canada) - END:DAYLIGHT - END:VTIMEZONE - END:VCALENDAR - ]]></C:calendar-timezone> - </D:prop> - </D:set> - </C:mkcalendar>'; - - $request->setBody($body); - $this->server->httpRequest = $request; - $this->server->exec(); - - $this->assertEquals(409, $this->response->status); - } - - public function testMkCalendarExistingCalendar() - { - $request = HTTP\Sapi::createFromServerArray([ - 'REQUEST_METHOD' => 'MKCALENDAR', - 'REQUEST_URI' => '/calendars/user1/UUID-123467', - ]); - - $body = '<?xml version="1.0" encoding="utf-8" ?> - <C:mkcalendar xmlns:D="DAV:" - xmlns:C="urn:ietf:params:xml:ns:caldav"> - <D:set> - <D:prop> - <D:displayname>Lisa\'s Events</D:displayname> - <C:calendar-description xml:lang="en" - >Calendar restricted to events.</C:calendar-description> - <C:supported-calendar-component-set> - <C:comp name="VEVENT"/> - </C:supported-calendar-component-set> - <C:calendar-timezone><![CDATA[BEGIN:VCALENDAR - PRODID:-//Example Corp.//CalDAV Client//EN - VERSION:2.0 - BEGIN:VTIMEZONE - TZID:US-Eastern - LAST-MODIFIED:19870101T000000Z - BEGIN:STANDARD - DTSTART:19671029T020000 - RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10 - TZOFFSETFROM:-0400 - TZOFFSETTO:-0500 - TZNAME:Eastern Standard Time (US & Canada) - END:STANDARD - BEGIN:DAYLIGHT - DTSTART:19870405T020000 - RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4 - TZOFFSETFROM:-0500 - TZOFFSETTO:-0400 - TZNAME:Eastern Daylight Time (US & Canada) - END:DAYLIGHT - END:VTIMEZONE - END:VCALENDAR - ]]></C:calendar-timezone> - </D:prop> - </D:set> - </C:mkcalendar>'; - - $request->setBody($body); - $this->server->httpRequest = $request; - $this->server->exec(); - - $this->assertEquals(405, $this->response->status); - } - - public function testMkCalendarSucceed() - { - $request = new HTTP\Request('MKCALENDAR', '/calendars/user1/NEWCALENDAR'); - - $timezone = 'BEGIN:VCALENDAR -PRODID:-//Example Corp.//CalDAV Client//EN -VERSION:2.0 -BEGIN:VTIMEZONE -TZID:US-Eastern -LAST-MODIFIED:19870101T000000Z -BEGIN:STANDARD -DTSTART:19671029T020000 -RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10 -TZOFFSETFROM:-0400 -TZOFFSETTO:-0500 -TZNAME:Eastern Standard Time (US & Canada) -END:STANDARD -BEGIN:DAYLIGHT -DTSTART:19870405T020000 -RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4 -TZOFFSETFROM:-0500 -TZOFFSETTO:-0400 -TZNAME:Eastern Daylight Time (US & Canada) -END:DAYLIGHT -END:VTIMEZONE -END:VCALENDAR'; - - $body = '<?xml version="1.0" encoding="utf-8" ?> - <C:mkcalendar xmlns:D="DAV:" - xmlns:C="urn:ietf:params:xml:ns:caldav"> - <D:set> - <D:prop> - <D:displayname>Lisa\'s Events</D:displayname> - <C:calendar-description xml:lang="en" - >Calendar restricted to events.</C:calendar-description> - <C:supported-calendar-component-set> - <C:comp name="VEVENT"/> - </C:supported-calendar-component-set> - <C:calendar-timezone><![CDATA['.$timezone.']]></C:calendar-timezone> - </D:prop> - </D:set> - </C:mkcalendar>'; - - $request->setBody($body); - $this->server->httpRequest = $request; - $this->server->exec(); - - $this->assertEquals(201, $this->response->status, 'Invalid response code received. Full response body: '.$this->response->getBodyAsString()); - - $calendars = $this->caldavBackend->getCalendarsForUser('principals/user1'); - $this->assertEquals(3, count($calendars)); - - $newCalendar = null; - foreach ($calendars as $calendar) { - if ('NEWCALENDAR' === $calendar['uri']) { - $newCalendar = $calendar; - break; - } - } - - $this->assertIsArray($newCalendar); - - $keys = [ - 'uri' => 'NEWCALENDAR', - 'id' => null, - '{urn:ietf:params:xml:ns:caldav}calendar-description' => 'Calendar restricted to events.', - '{urn:ietf:params:xml:ns:caldav}calendar-timezone' => $timezone, - '{DAV:}displayname' => 'Lisa\'s Events', - '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set' => null, - ]; - - foreach ($keys as $key => $value) { - $this->assertArrayHasKey($key, $newCalendar); - - if (is_null($value)) { - continue; - } - $this->assertEquals($value, $newCalendar[$key]); - } - $sccs = '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set'; - $this->assertTrue($newCalendar[$sccs] instanceof Xml\Property\SupportedCalendarComponentSet); - $this->assertEquals(['VEVENT'], $newCalendar[$sccs]->getValue()); - } - - public function testMkCalendarEmptyBodySucceed() - { - $request = new HTTP\Request('MKCALENDAR', '/calendars/user1/NEWCALENDAR'); - - $request->setBody(''); - $this->server->httpRequest = $request; - $this->server->exec(); - - $this->assertEquals(201, $this->response->status, 'Invalid response code received. Full response body: '.$this->response->getBodyAsString()); - - $calendars = $this->caldavBackend->getCalendarsForUser('principals/user1'); - $this->assertEquals(3, count($calendars)); - - $newCalendar = null; - foreach ($calendars as $calendar) { - if ('NEWCALENDAR' === $calendar['uri']) { - $newCalendar = $calendar; - break; - } - } - - $this->assertIsArray($newCalendar); - - $keys = [ - 'uri' => 'NEWCALENDAR', - 'id' => null, - '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set' => null, - ]; - - foreach ($keys as $key => $value) { - $this->assertArrayHasKey($key, $newCalendar); - - if (is_null($value)) { - continue; - } - $this->assertEquals($value, $newCalendar[$key]); - } - $sccs = '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set'; - $this->assertTrue($newCalendar[$sccs] instanceof Xml\Property\SupportedCalendarComponentSet); - $this->assertEquals(['VEVENT', 'VTODO'], $newCalendar[$sccs]->getValue()); - } - - public function testMkCalendarBadXml() - { - $request = new HTTP\Request('MKCALENDAR', '/blabla'); - $body = 'This is not xml'; - - $request->setBody($body); - $this->server->httpRequest = $request; - $this->server->exec(); - - $this->assertEquals(400, $this->response->status); - } - - public function testPrincipalProperties() - { - $httpRequest = new HTTP\Request('FOO', '/blabla', ['Host' => 'sabredav.org']); - $this->server->httpRequest = $httpRequest; - - $props = $this->server->getPropertiesForPath('/principals/user1', [ - '{'.Plugin::NS_CALDAV.'}calendar-home-set', - '{'.Plugin::NS_CALENDARSERVER.'}calendar-proxy-read-for', - '{'.Plugin::NS_CALENDARSERVER.'}calendar-proxy-write-for', - '{'.Plugin::NS_CALENDARSERVER.'}notification-URL', - '{'.Plugin::NS_CALENDARSERVER.'}email-address-set', - ]); - - $this->assertArrayHasKey(0, $props); - $this->assertArrayHasKey(200, $props[0]); - - $this->assertArrayHasKey('{urn:ietf:params:xml:ns:caldav}calendar-home-set', $props[0][200]); - $prop = $props[0][200]['{urn:ietf:params:xml:ns:caldav}calendar-home-set']; - $this->assertInstanceOf('Sabre\\DAV\\Xml\\Property\\Href', $prop); - $this->assertEquals('calendars/user1/', $prop->getHref()); - - $this->assertArrayHasKey('{http://calendarserver.org/ns/}calendar-proxy-read-for', $props[0][200]); - $prop = $props[0][200]['{http://calendarserver.org/ns/}calendar-proxy-read-for']; - $this->assertInstanceOf('Sabre\\DAV\\Xml\\Property\\Href', $prop); - $this->assertEquals(['principals/admin/'], $prop->getHrefs()); - - $this->assertArrayHasKey('{http://calendarserver.org/ns/}calendar-proxy-write-for', $props[0][200]); - $prop = $props[0][200]['{http://calendarserver.org/ns/}calendar-proxy-write-for']; - $this->assertInstanceOf('Sabre\\DAV\\Xml\\Property\\Href', $prop); - $this->assertEquals(['principals/admin/'], $prop->getHrefs()); - - $this->assertArrayHasKey('{'.Plugin::NS_CALENDARSERVER.'}email-address-set', $props[0][200]); - $prop = $props[0][200]['{'.Plugin::NS_CALENDARSERVER.'}email-address-set']; - $this->assertInstanceOf('Sabre\\CalDAV\\Xml\\Property\\EmailAddressSet', $prop); - $this->assertEquals(['user1.sabredav@sabredav.org'], $prop->getValue()); - } - - public function testSupportedReportSetPropertyNonCalendar() - { - $props = $this->server->getPropertiesForPath('/calendars/user1', [ - '{DAV:}supported-report-set', - ]); - - $this->assertArrayHasKey(0, $props); - $this->assertArrayHasKey(200, $props[0]); - $this->assertArrayHasKey('{DAV:}supported-report-set', $props[0][200]); - - $prop = $props[0][200]['{DAV:}supported-report-set']; - - $this->assertInstanceOf('\\Sabre\\DAV\\Xml\\Property\\SupportedReportSet', $prop); - $value = [ - '{DAV:}expand-property', - '{DAV:}principal-match', - '{DAV:}principal-property-search', - '{DAV:}principal-search-property-set', - ]; - $this->assertEquals($value, $prop->getValue()); - } - - /** - * @depends testSupportedReportSetPropertyNonCalendar - */ - public function testSupportedReportSetProperty() - { - $props = $this->server->getPropertiesForPath('/calendars/user1/UUID-123467', [ - '{DAV:}supported-report-set', - ]); - - $this->assertArrayHasKey(0, $props); - $this->assertArrayHasKey(200, $props[0]); - $this->assertArrayHasKey('{DAV:}supported-report-set', $props[0][200]); - - $prop = $props[0][200]['{DAV:}supported-report-set']; - - $this->assertInstanceOf('\\Sabre\\DAV\\Xml\\Property\\SupportedReportSet', $prop); - $value = [ - '{urn:ietf:params:xml:ns:caldav}calendar-multiget', - '{urn:ietf:params:xml:ns:caldav}calendar-query', - '{urn:ietf:params:xml:ns:caldav}free-busy-query', - '{DAV:}expand-property', - '{DAV:}principal-match', - '{DAV:}principal-property-search', - '{DAV:}principal-search-property-set', - ]; - $this->assertEquals($value, $prop->getValue()); - } - - public function testSupportedReportSetUserCalendars() - { - $this->server->addPlugin(new \Sabre\DAV\Sync\Plugin()); - - $props = $this->server->getPropertiesForPath('/calendars/user1', [ - '{DAV:}supported-report-set', - ]); - - $this->assertArrayHasKey(0, $props); - $this->assertArrayHasKey(200, $props[0]); - $this->assertArrayHasKey('{DAV:}supported-report-set', $props[0][200]); - - $prop = $props[0][200]['{DAV:}supported-report-set']; - - $this->assertInstanceOf('\\Sabre\\DAV\\Xml\\Property\\SupportedReportSet', $prop); - $value = [ - '{DAV:}sync-collection', - '{DAV:}expand-property', - '{DAV:}principal-match', - '{DAV:}principal-property-search', - '{DAV:}principal-search-property-set', - ]; - $this->assertEquals($value, $prop->getValue()); - } - - /** - * @depends testSupportedReportSetProperty - */ - public function testCalendarMultiGetReport() - { - $body = - '<?xml version="1.0"?>'. - '<c:calendar-multiget xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">'. - '<d:prop>'. - ' <c:calendar-data />'. - ' <d:getetag />'. - '</d:prop>'. - '<d:href>/calendars/user1/UUID-123467/UUID-2345</d:href>'. - '</c:calendar-multiget>'; - - $request = new HTTP\Request('REPORT', '/calendars/user1', ['Depth' => '1']); - $request->setBody($body); - - $this->server->httpRequest = $request; - $this->server->exec(); - - $this->assertEquals(207, $this->response->status, 'Invalid HTTP status received. Full response body'); - - $expectedIcal = TestUtil::getTestCalendarData(); - - $expected = <<<XML -<?xml version="1.0"?> -<d:multistatus xmlns:cal="urn:ietf:params:xml:ns:caldav" xmlns:cs="http://calendarserver.org/ns/" xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns"> -<d:response> - <d:href>/calendars/user1/UUID-123467/UUID-2345</d:href> - <d:propstat> - <d:prop> - <cal:calendar-data>$expectedIcal</cal:calendar-data> - <d:getetag>"e207e33c10e5fb9c12cfb35b5d9116e1"</d:getetag> - </d:prop> - <d:status>HTTP/1.1 200 OK</d:status> - </d:propstat> -</d:response> -</d:multistatus> -XML; - - $this->assertXmlStringEqualsXmlString($expected, $this->response->getBodyAsString()); - } - - /** - * @depends testCalendarMultiGetReport - */ - public function testCalendarMultiGetReportExpand() - { - $body = - '<?xml version="1.0"?>'. - '<c:calendar-multiget xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">'. - '<d:prop>'. - ' <c:calendar-data>'. - ' <c:expand start="20110101T000000Z" end="20111231T235959Z" />'. - ' </c:calendar-data>'. - ' <d:getetag />'. - '</d:prop>'. - '<d:href>/calendars/user1/UUID-123467/UUID-2345</d:href>'. - '</c:calendar-multiget>'; - - $request = new HTTP\Request('REPORT', '/calendars/user1', ['Depth' => '1']); - $request->setBody($body); - - $this->server->httpRequest = $request; - $this->server->exec(); - - $bodyAsString = $this->response->getBodyAsString(); - $this->assertEquals(207, $this->response->status, 'Invalid HTTP status received. Full response body: '.$bodyAsString); - - $expectedIcal = TestUtil::getTestCalendarData(); - $expectedIcal = \Sabre\VObject\Reader::read($expectedIcal); - $expectedIcal = $expectedIcal->expand( - new DateTime('2011-01-01 00:00:00', new DateTimeZone('UTC')), - new DateTime('2011-12-31 23:59:59', new DateTimeZone('UTC')) - ); - $expectedIcal = str_replace("\r\n", "
\n", $expectedIcal->serialize()); - - $expected = <<<XML -<?xml version="1.0"?> -<d:multistatus xmlns:cal="urn:ietf:params:xml:ns:caldav" xmlns:cs="http://calendarserver.org/ns/" xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns"> -<d:response> - <d:href>/calendars/user1/UUID-123467/UUID-2345</d:href> - <d:propstat> - <d:prop> - <cal:calendar-data>$expectedIcal</cal:calendar-data> - <d:getetag>"e207e33c10e5fb9c12cfb35b5d9116e1"</d:getetag> - </d:prop> - <d:status>HTTP/1.1 200 OK</d:status> - </d:propstat> -</d:response> -</d:multistatus> -XML; - - $this->assertXmlStringEqualsXmlString($expected, $bodyAsString); - } - - /** - * @depends testSupportedReportSetProperty - * @depends testCalendarMultiGetReport - */ - public function testCalendarQueryReport() - { - $body = - '<?xml version="1.0"?>'. - '<c:calendar-query xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">'. - '<d:prop>'. - ' <c:calendar-data>'. - ' <c:expand start="20000101T000000Z" end="20101231T235959Z" />'. - ' </c:calendar-data>'. - ' <d:getetag />'. - '</d:prop>'. - '<c:filter>'. - ' <c:comp-filter name="VCALENDAR">'. - ' <c:comp-filter name="VEVENT" />'. - ' </c:comp-filter>'. - '</c:filter>'. - '</c:calendar-query>'; - - $request = new HTTP\Request('REPORT', '/calendars/user1/UUID-123467', ['Depth' => '1']); - $request->setBody($body); - - $this->server->httpRequest = $request; - $this->server->exec(); - - $bodyAsString = $this->response->getBodyAsString(); - $this->assertEquals(207, $this->response->status, 'Received an unexpected status. Full response body: '.$bodyAsString); - - $expectedIcal = TestUtil::getTestCalendarData(); - $expectedIcal = \Sabre\VObject\Reader::read($expectedIcal); - $expectedIcal = $expectedIcal->expand( - new DateTime('2000-01-01 00:00:00', new DateTimeZone('UTC')), - new DateTime('2010-12-31 23:59:59', new DateTimeZone('UTC')) - ); - $expectedIcal = str_replace("\r\n", "
\n", $expectedIcal->serialize()); - - $expected = <<<XML -<?xml version="1.0"?> -<d:multistatus xmlns:cal="urn:ietf:params:xml:ns:caldav" xmlns:cs="http://calendarserver.org/ns/" xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns"> -<d:response> - <d:href>/calendars/user1/UUID-123467/UUID-2345</d:href> - <d:propstat> - <d:prop> - <cal:calendar-data>$expectedIcal</cal:calendar-data> - <d:getetag>"e207e33c10e5fb9c12cfb35b5d9116e1"</d:getetag> - </d:prop> - <d:status>HTTP/1.1 200 OK</d:status> - </d:propstat> -</d:response> -</d:multistatus> -XML; - - $this->assertXmlStringEqualsXmlString($expected, $bodyAsString); - } - - /** - * @depends testSupportedReportSetProperty - * @depends testCalendarMultiGetReport - */ - public function testCalendarQueryReportWindowsPhone() - { - $body = - '<?xml version="1.0"?>'. - '<c:calendar-query xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">'. - '<d:prop>'. - ' <c:calendar-data>'. - ' <c:expand start="20000101T000000Z" end="20101231T235959Z" />'. - ' </c:calendar-data>'. - ' <d:getetag />'. - '</d:prop>'. - '<c:filter>'. - ' <c:comp-filter name="VCALENDAR">'. - ' <c:comp-filter name="VEVENT" />'. - ' </c:comp-filter>'. - '</c:filter>'. - '</c:calendar-query>'; - - $request = new HTTP\Request('REPORT', '/calendars/user1/UUID-123467', [ - 'Depth' => '0', - 'User-Agent' => 'MSFT-WP/8.10.14219 (gzip)', - ]); - - $request->setBody($body); - - $this->server->httpRequest = $request; - $this->server->exec(); - - $bodyAsString = $this->response->getBodyAsString(); - $this->assertEquals(207, $this->response->status, 'Received an unexpected status. Full response body: '.$bodyAsString); - - $expectedIcal = TestUtil::getTestCalendarData(); - $expectedIcal = \Sabre\VObject\Reader::read($expectedIcal); - $expectedIcal = $expectedIcal->expand( - new DateTime('2000-01-01 00:00:00', new DateTimeZone('UTC')), - new DateTime('2010-12-31 23:59:59', new DateTimeZone('UTC')) - ); - $expectedIcal = str_replace("\r\n", "
\n", $expectedIcal->serialize()); - - $expected = <<<XML -<?xml version="1.0"?> -<d:multistatus xmlns:cal="urn:ietf:params:xml:ns:caldav" xmlns:cs="http://calendarserver.org/ns/" xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns"> -<d:response> - <d:href>/calendars/user1/UUID-123467/UUID-2345</d:href> - <d:propstat> - <d:prop> - <cal:calendar-data>$expectedIcal</cal:calendar-data> - <d:getetag>"e207e33c10e5fb9c12cfb35b5d9116e1"</d:getetag> - </d:prop> - <d:status>HTTP/1.1 200 OK</d:status> - </d:propstat> -</d:response> -</d:multistatus> -XML; - - $this->assertXmlStringEqualsXmlString($expected, $bodyAsString); - } - - /** - * @depends testSupportedReportSetProperty - * @depends testCalendarMultiGetReport - */ - public function testCalendarQueryReportBadDepth() - { - $body = - '<?xml version="1.0"?>'. - '<c:calendar-query xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">'. - '<d:prop>'. - ' <c:calendar-data>'. - ' <c:expand start="20000101T000000Z" end="20101231T235959Z" />'. - ' </c:calendar-data>'. - ' <d:getetag />'. - '</d:prop>'. - '<c:filter>'. - ' <c:comp-filter name="VCALENDAR">'. - ' <c:comp-filter name="VEVENT" />'. - ' </c:comp-filter>'. - '</c:filter>'. - '</c:calendar-query>'; - - $request = new HTTP\Request('REPORT', '/calendars/user1/UUID-123467', [ - 'Depth' => '0', - ]); - $request->setBody($body); - - $this->server->httpRequest = $request; - $this->server->exec(); - - $this->assertEquals(400, $this->response->status, 'Received an unexpected status. Full response body: '.$this->response->getBodyAsString()); - } - - /** - * @depends testCalendarQueryReport - */ - public function testCalendarQueryReportNoCalData() - { - $body = - '<?xml version="1.0"?>'. - '<c:calendar-query xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">'. - '<d:prop>'. - ' <d:getetag />'. - '</d:prop>'. - '<c:filter>'. - ' <c:comp-filter name="VCALENDAR">'. - ' <c:comp-filter name="VEVENT" />'. - ' </c:comp-filter>'. - '</c:filter>'. - '</c:calendar-query>'; - - $request = new HTTP\Request('REPORT', '/calendars/user1/UUID-123467', [ - 'Depth' => '1', - ]); - $request->setBody($body); - - $this->server->httpRequest = $request; - $this->server->exec(); - - $bodyAsString = $this->server->httpResponse->getBodyAsString(); - $this->assertEquals(207, $this->response->status, 'Received an unexpected status. Full response body: '.$bodyAsString); - - $expected = <<<XML -<?xml version="1.0"?> -<d:multistatus xmlns:cal="urn:ietf:params:xml:ns:caldav" xmlns:cs="http://calendarserver.org/ns/" xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns"> -<d:response> - <d:href>/calendars/user1/UUID-123467/UUID-2345</d:href> - <d:propstat> - <d:prop> - <d:getetag>"e207e33c10e5fb9c12cfb35b5d9116e1"</d:getetag> - </d:prop> - <d:status>HTTP/1.1 200 OK</d:status> - </d:propstat> -</d:response> -</d:multistatus> -XML; - - $this->assertXmlStringEqualsXmlString($expected, $bodyAsString); - } - - /** - * @depends testCalendarQueryReport - */ - public function testCalendarQueryReportNoFilters() - { - $body = - '<?xml version="1.0"?>'. - '<c:calendar-query xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">'. - '<d:prop>'. - ' <c:calendar-data />'. - ' <d:getetag />'. - '</d:prop>'. - '</c:calendar-query>'; - - $request = new HTTP\Request('REPORT', '/calendars/user1/UUID-123467'); - $request->setBody($body); - - $this->server->httpRequest = $request; - $this->server->exec(); - - $this->assertEquals(400, $this->response->status, 'Received an unexpected status. Full response body: '.$this->response->getBodyAsString()); - } - - /** - * @depends testSupportedReportSetProperty - * @depends testCalendarMultiGetReport - */ - public function testCalendarQueryReport1Object() - { - $body = - '<?xml version="1.0"?>'. - '<c:calendar-query xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">'. - '<d:prop>'. - ' <c:calendar-data>'. - ' <c:expand start="20000101T000000Z" end="20101231T235959Z" />'. - ' </c:calendar-data>'. - ' <d:getetag />'. - '</d:prop>'. - '<c:filter>'. - ' <c:comp-filter name="VCALENDAR">'. - ' <c:comp-filter name="VEVENT" />'. - ' </c:comp-filter>'. - '</c:filter>'. - '</c:calendar-query>'; - - $request = new HTTP\Request('REPORT', '/calendars/user1/UUID-123467/UUID-2345', ['Depth' => '0']); - $request->setBody($body); - - $this->server->httpRequest = $request; - $this->server->exec(); - - $bodyAsString = $this->server->httpResponse->getBodyAsString(); - $this->assertEquals(207, $this->response->status, 'Received an unexpected status. Full response body: '.$bodyAsString); - - $expectedIcal = TestUtil::getTestCalendarData(); - $expectedIcal = \Sabre\VObject\Reader::read($expectedIcal); - $expectedIcal = $expectedIcal->expand( - new DateTime('2000-01-01 00:00:00', new DateTimeZone('UTC')), - new DateTime('2010-12-31 23:59:59', new DateTimeZone('UTC')) - ); - $expectedIcal = str_replace("\r\n", "
\n", $expectedIcal->serialize()); - - $expected = <<<XML -<?xml version="1.0"?> -<d:multistatus xmlns:cal="urn:ietf:params:xml:ns:caldav" xmlns:cs="http://calendarserver.org/ns/" xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns"> -<d:response> - <d:href>/calendars/user1/UUID-123467/UUID-2345</d:href> - <d:propstat> - <d:prop> - <cal:calendar-data>$expectedIcal</cal:calendar-data> - <d:getetag>"e207e33c10e5fb9c12cfb35b5d9116e1"</d:getetag> - </d:prop> - <d:status>HTTP/1.1 200 OK</d:status> - </d:propstat> -</d:response> -</d:multistatus> -XML; - - $this->assertXmlStringEqualsXmlString($expected, $bodyAsString); - } - - /** - * @depends testSupportedReportSetProperty - * @depends testCalendarMultiGetReport - */ - public function testCalendarQueryReport1ObjectNoCalData() - { - $body = - '<?xml version="1.0"?>'. - '<c:calendar-query xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">'. - '<d:prop>'. - ' <d:getetag />'. - '</d:prop>'. - '<c:filter>'. - ' <c:comp-filter name="VCALENDAR">'. - ' <c:comp-filter name="VEVENT" />'. - ' </c:comp-filter>'. - '</c:filter>'. - '</c:calendar-query>'; - - $request = new HTTP\Request('REPORT', '/calendars/user1/UUID-123467/UUID-2345', ['Depth' => '0']); - $request->setBody($body); - - $this->server->httpRequest = $request; - $this->server->exec(); - - $bodyAsString = $this->server->httpResponse->getBodyAsString(); - $this->assertEquals(207, $this->response->status, 'Received an unexpected status. Full response body: '.$bodyAsString); - - $expected = <<<XML -<?xml version="1.0"?> -<d:multistatus xmlns:cal="urn:ietf:params:xml:ns:caldav" xmlns:cs="http://calendarserver.org/ns/" xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns"> -<d:response> - <d:href>/calendars/user1/UUID-123467/UUID-2345</d:href> - <d:propstat> - <d:prop> - <d:getetag>"e207e33c10e5fb9c12cfb35b5d9116e1"</d:getetag> - </d:prop> - <d:status>HTTP/1.1 200 OK</d:status> - </d:propstat> -</d:response> -</d:multistatus> -XML; - - $this->assertXmlStringEqualsXmlString($expected, $bodyAsString); - } - - public function testHTMLActionsPanel() - { - $output = ''; - $r = $this->server->emit('onHTMLActionsPanel', [$this->server->tree->getNodeForPath('calendars/user1'), &$output]); - $this->assertFalse($r); - - $this->assertTrue((bool) strpos($output, 'Display name')); - } - - /** - * @depends testCalendarMultiGetReport - */ - public function testCalendarMultiGetReportNoEnd() - { - $body = - '<?xml version="1.0"?>'. - '<c:calendar-multiget xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">'. - '<d:prop>'. - ' <c:calendar-data>'. - ' <c:expand start="20110101T000000Z" />'. - ' </c:calendar-data>'. - ' <d:getetag />'. - '</d:prop>'. - '<d:href>/calendars/user1/UUID-123467/UUID-2345</d:href>'. - '</c:calendar-multiget>'; - - $request = new HTTP\Request('REPORT', '/calendars/user1', ['Depth' => '1']); - $request->setBody($body); - - $this->server->httpRequest = $request; - $this->server->exec(); - - $this->assertEquals(400, $this->response->status, 'Invalid HTTP status received. Full response body: '.$this->response->getBodyAsString()); - } - - /** - * @depends testCalendarMultiGetReport - */ - public function testCalendarMultiGetReportNoStart() - { - $body = - '<?xml version="1.0"?>'. - '<c:calendar-multiget xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">'. - '<d:prop>'. - ' <c:calendar-data>'. - ' <c:expand end="20110101T000000Z" />'. - ' </c:calendar-data>'. - ' <d:getetag />'. - '</d:prop>'. - '<d:href>/calendars/user1/UUID-123467/UUID-2345</d:href>'. - '</c:calendar-multiget>'; - - $request = new HTTP\Request('REPORT', '/calendars/user1', ['Depth' => '1']); - $request->setBody($body); - - $this->server->httpRequest = $request; - $this->server->exec(); - - $this->assertEquals(400, $this->response->status, 'Invalid HTTP status received. Full response body: '.$this->response->getBodyAsString()); - } - - /** - * @depends testCalendarMultiGetReport - */ - public function testCalendarMultiGetReportEndBeforeStart() - { - $body = - '<?xml version="1.0"?>'. - '<c:calendar-multiget xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">'. - '<d:prop>'. - ' <c:calendar-data>'. - ' <c:expand start="20200101T000000Z" end="20110101T000000Z" />'. - ' </c:calendar-data>'. - ' <d:getetag />'. - '</d:prop>'. - '<d:href>/calendars/user1/UUID-123467/UUID-2345</d:href>'. - '</c:calendar-multiget>'; - - $request = new HTTP\Request('REPORT', '/calendars/user1', ['Depth' => '1']); - $request->setBody($body); - - $this->server->httpRequest = $request; - $this->server->exec(); - - $this->assertEquals(400, $this->response->status, 'Invalid HTTP status received. Full response body: '.$this->response->getBodyAsString()); - } - - /** - * @depends testSupportedReportSetPropertyNonCalendar - */ - public function testCalendarProperties() - { - $ns = '{urn:ietf:params:xml:ns:caldav}'; - $props = $this->server->getProperties('calendars/user1/UUID-123467', [ - $ns.'max-resource-size', - $ns.'supported-calendar-data', - $ns.'supported-collation-set', - ]); - - $this->assertEquals([ - $ns.'max-resource-size' => 10000000, - $ns.'supported-calendar-data' => new Xml\Property\SupportedCalendarData(), - $ns.'supported-collation-set' => new Xml\Property\SupportedCollationSet(), - ], $props); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Principal/CollectionTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Principal/CollectionTest.php deleted file mode 100644 index 277de0664..000000000 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/Principal/CollectionTest.php +++ /dev/null @@ -1,20 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\CalDAV\Principal; - -use Sabre\DAVACL; - -class CollectionTest extends \PHPUnit\Framework\TestCase -{ - public function testGetChildForPrincipal() - { - $back = new DAVACL\PrincipalBackend\Mock(); - $col = new Collection($back); - $r = $col->getChildForPrincipal([ - 'uri' => 'principals/admin', - ]); - $this->assertInstanceOf('Sabre\\CalDAV\\Principal\\User', $r); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Principal/ProxyReadTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Principal/ProxyReadTest.php deleted file mode 100644 index 95ff86fa1..000000000 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/Principal/ProxyReadTest.php +++ /dev/null @@ -1,91 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\CalDAV\Principal; - -use Sabre\DAVACL; - -class ProxyReadTest extends \PHPUnit\Framework\TestCase -{ - protected $backend; - - public function getInstance() - { - $backend = new DAVACL\PrincipalBackend\Mock(); - $principal = new ProxyRead($backend, [ - 'uri' => 'principal/user', - ]); - $this->backend = $backend; - - return $principal; - } - - public function testGetName() - { - $i = $this->getInstance(); - $this->assertEquals('calendar-proxy-read', $i->getName()); - } - - public function testGetDisplayName() - { - $i = $this->getInstance(); - $this->assertEquals('calendar-proxy-read', $i->getDisplayName()); - } - - public function testGetLastModified() - { - $i = $this->getInstance(); - $this->assertNull($i->getLastModified()); - } - - public function testDelete() - { - $this->expectException('Sabre\DAV\Exception\Forbidden'); - $i = $this->getInstance(); - $i->delete(); - } - - public function testSetName() - { - $this->expectException('Sabre\DAV\Exception\Forbidden'); - $i = $this->getInstance(); - $i->setName('foo'); - } - - public function testGetAlternateUriSet() - { - $i = $this->getInstance(); - $this->assertEquals([], $i->getAlternateUriSet()); - } - - public function testGetPrincipalUri() - { - $i = $this->getInstance(); - $this->assertEquals('principal/user/calendar-proxy-read', $i->getPrincipalUrl()); - } - - public function testGetGroupMemberSet() - { - $i = $this->getInstance(); - $this->assertEquals([], $i->getGroupMemberSet()); - } - - public function testGetGroupMembership() - { - $i = $this->getInstance(); - $this->assertEquals([], $i->getGroupMembership()); - } - - public function testSetGroupMemberSet() - { - $i = $this->getInstance(); - $i->setGroupMemberSet(['principals/foo']); - - $expected = [ - $i->getPrincipalUrl() => ['principals/foo'], - ]; - - $this->assertEquals($expected, $this->backend->groupMembers); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Principal/ProxyWriteTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Principal/ProxyWriteTest.php deleted file mode 100644 index df1715ee5..000000000 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/Principal/ProxyWriteTest.php +++ /dev/null @@ -1,39 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\CalDAV\Principal; - -use Sabre\DAVACL; - -class ProxyWriteTest extends ProxyReadTest -{ - public function getInstance() - { - $backend = new DAVACL\PrincipalBackend\Mock(); - $principal = new ProxyWrite($backend, [ - 'uri' => 'principal/user', - ]); - $this->backend = $backend; - - return $principal; - } - - public function testGetName() - { - $i = $this->getInstance(); - $this->assertEquals('calendar-proxy-write', $i->getName()); - } - - public function testGetDisplayName() - { - $i = $this->getInstance(); - $this->assertEquals('calendar-proxy-write', $i->getDisplayName()); - } - - public function testGetPrincipalUri() - { - $i = $this->getInstance(); - $this->assertEquals('principal/user/calendar-proxy-write', $i->getPrincipalUrl()); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Principal/UserTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Principal/UserTest.php deleted file mode 100644 index fd079acb2..000000000 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/Principal/UserTest.php +++ /dev/null @@ -1,111 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\CalDAV\Principal; - -use Sabre\DAVACL; - -class UserTest extends \PHPUnit\Framework\TestCase -{ - public function getInstance() - { - $backend = new DAVACL\PrincipalBackend\Mock(); - $backend->addPrincipal([ - 'uri' => 'principals/user/calendar-proxy-read', - ]); - $backend->addPrincipal([ - 'uri' => 'principals/user/calendar-proxy-write', - ]); - $backend->addPrincipal([ - 'uri' => 'principals/user/random', - ]); - - return new User($backend, [ - 'uri' => 'principals/user', - ]); - } - - public function testCreateFile() - { - $this->expectException('Sabre\DAV\Exception\Forbidden'); - $u = $this->getInstance(); - $u->createFile('test'); - } - - public function testCreateDirectory() - { - $this->expectException('Sabre\DAV\Exception\Forbidden'); - $u = $this->getInstance(); - $u->createDirectory('test'); - } - - public function testGetChildProxyRead() - { - $u = $this->getInstance(); - $child = $u->getChild('calendar-proxy-read'); - $this->assertInstanceOf('Sabre\\CalDAV\\Principal\\ProxyRead', $child); - } - - public function testGetChildProxyWrite() - { - $u = $this->getInstance(); - $child = $u->getChild('calendar-proxy-write'); - $this->assertInstanceOf('Sabre\\CalDAV\\Principal\\ProxyWrite', $child); - } - - public function testGetChildNotFound() - { - $this->expectException('Sabre\DAV\Exception\NotFound'); - $u = $this->getInstance(); - $child = $u->getChild('foo'); - } - - public function testGetChildNotFound2() - { - $this->expectException('Sabre\DAV\Exception\NotFound'); - $u = $this->getInstance(); - $child = $u->getChild('random'); - } - - public function testGetChildren() - { - $u = $this->getInstance(); - $children = $u->getChildren(); - $this->assertEquals(2, count($children)); - $this->assertInstanceOf('Sabre\\CalDAV\\Principal\\ProxyRead', $children[0]); - $this->assertInstanceOf('Sabre\\CalDAV\\Principal\\ProxyWrite', $children[1]); - } - - public function testChildExist() - { - $u = $this->getInstance(); - $this->assertTrue($u->childExists('calendar-proxy-read')); - $this->assertTrue($u->childExists('calendar-proxy-write')); - $this->assertFalse($u->childExists('foo')); - } - - public function testGetACL() - { - $expected = [ - [ - 'privilege' => '{DAV:}all', - 'principal' => '{DAV:}owner', - 'protected' => true, - ], - [ - 'privilege' => '{DAV:}read', - 'principal' => 'principals/user/calendar-proxy-read', - 'protected' => true, - ], - [ - 'privilege' => '{DAV:}read', - 'principal' => 'principals/user/calendar-proxy-write', - 'protected' => true, - ], - ]; - - $u = $this->getInstance(); - $this->assertEquals($expected, $u->getACL()); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/Schedule/OutboxTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/Schedule/OutboxTest.php deleted file mode 100644 index df70fe7ec..000000000 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/Schedule/OutboxTest.php +++ /dev/null @@ -1,47 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\CalDAV\Schedule; - -use Sabre\CalDAV; - -class OutboxTest extends \PHPUnit\Framework\TestCase -{ - public function testSetup() - { - $outbox = new Outbox('principals/user1'); - $this->assertEquals('outbox', $outbox->getName()); - $this->assertEquals([], $outbox->getChildren()); - $this->assertEquals('principals/user1', $outbox->getOwner()); - $this->assertEquals(null, $outbox->getGroup()); - - $this->assertEquals([ - [ - 'privilege' => '{'.CalDAV\Plugin::NS_CALDAV.'}schedule-send', - 'principal' => 'principals/user1', - 'protected' => true, - ], - [ - 'privilege' => '{DAV:}read', - 'principal' => 'principals/user1', - 'protected' => true, - ], - [ - 'privilege' => '{'.CalDAV\Plugin::NS_CALDAV.'}schedule-send', - 'principal' => 'principals/user1/calendar-proxy-write', - 'protected' => true, - ], - [ - 'privilege' => '{DAV:}read', - 'principal' => 'principals/user1/calendar-proxy-read', - 'protected' => true, - ], - [ - 'privilege' => '{DAV:}read', - 'principal' => 'principals/user1/calendar-proxy-write', - 'protected' => true, - ], - ], $outbox->getACL()); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/SharedCalendarTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/SharedCalendarTest.php deleted file mode 100644 index 735bbef41..000000000 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/SharedCalendarTest.php +++ /dev/null @@ -1,172 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\CalDAV; - -use Sabre\DAV\Sharing; -use Sabre\DAV\Xml\Element\Sharee; - -class SharedCalendarTest extends \PHPUnit\Framework\TestCase -{ - protected $backend; - - public function getInstance(array $props = null) - { - if (is_null($props)) { - $props = [ - 'id' => 1, - '{http://calendarserver.org/ns/}shared-url' => 'calendars/owner/original', - '{http://sabredav.org/ns}owner-principal' => 'principals/owner', - '{http://sabredav.org/ns}read-only' => false, - 'share-access' => Sharing\Plugin::ACCESS_READWRITE, - 'principaluri' => 'principals/sharee', - ]; - } - - $this->backend = new Backend\MockSharing( - [$props], - [], - [] - ); - - $sharee = new Sharee(); - $sharee->href = 'mailto:removeme@example.org'; - $sharee->properties['{DAV:}displayname'] = 'To be removed'; - $sharee->access = Sharing\Plugin::ACCESS_READ; - $this->backend->updateInvites(1, [$sharee]); - - return new SharedCalendar($this->backend, $props); - } - - public function testGetInvites() - { - $sharee = new Sharee(); - $sharee->href = 'mailto:removeme@example.org'; - $sharee->properties['{DAV:}displayname'] = 'To be removed'; - $sharee->access = Sharing\Plugin::ACCESS_READ; - $sharee->inviteStatus = Sharing\Plugin::INVITE_NORESPONSE; - - $this->assertEquals( - [$sharee], - $this->getInstance()->getInvites() - ); - } - - public function testGetOwner() - { - $this->assertEquals('principals/sharee', $this->getInstance()->getOwner()); - } - - public function testGetACL() - { - $expected = [ - [ - 'privilege' => '{DAV:}write', - 'principal' => 'principals/sharee', - 'protected' => true, - ], - [ - 'privilege' => '{DAV:}write', - 'principal' => 'principals/sharee/calendar-proxy-write', - 'protected' => true, - ], - [ - 'privilege' => '{DAV:}write-properties', - 'principal' => 'principals/sharee', - 'protected' => true, - ], - [ - 'privilege' => '{DAV:}write-properties', - 'principal' => 'principals/sharee/calendar-proxy-write', - 'protected' => true, - ], - [ - 'privilege' => '{DAV:}read', - 'principal' => 'principals/sharee', - 'protected' => true, - ], - [ - 'privilege' => '{DAV:}read', - 'principal' => 'principals/sharee/calendar-proxy-read', - 'protected' => true, - ], - [ - 'privilege' => '{DAV:}read', - 'principal' => 'principals/sharee/calendar-proxy-write', - 'protected' => true, - ], - [ - 'privilege' => '{'.Plugin::NS_CALDAV.'}read-free-busy', - 'principal' => '{DAV:}authenticated', - 'protected' => true, - ], - ]; - - $this->assertEquals($expected, $this->getInstance()->getACL()); - } - - public function testGetChildACL() - { - $expected = [ - [ - 'privilege' => '{DAV:}write', - 'principal' => 'principals/sharee', - 'protected' => true, - ], - [ - 'privilege' => '{DAV:}write', - 'principal' => 'principals/sharee/calendar-proxy-write', - 'protected' => true, - ], - [ - 'privilege' => '{DAV:}read', - 'principal' => 'principals/sharee', - 'protected' => true, - ], - [ - 'privilege' => '{DAV:}read', - 'principal' => 'principals/sharee/calendar-proxy-write', - 'protected' => true, - ], - [ - 'privilege' => '{DAV:}read', - 'principal' => 'principals/sharee/calendar-proxy-read', - 'protected' => true, - ], - ]; - - $this->assertEquals($expected, $this->getInstance()->getChildACL()); - } - - public function testUpdateInvites() - { - $instance = $this->getInstance(); - $newSharees = [ - new Sharee(), - new Sharee(), - ]; - $newSharees[0]->href = 'mailto:test@example.org'; - $newSharees[0]->properties['{DAV:}displayname'] = 'Foo Bar'; - $newSharees[0]->comment = 'Booh'; - $newSharees[0]->access = Sharing\Plugin::ACCESS_READWRITE; - - $newSharees[1]->href = 'mailto:removeme@example.org'; - $newSharees[1]->access = Sharing\Plugin::ACCESS_NOACCESS; - - $instance->updateInvites($newSharees); - - $expected = [ - clone $newSharees[0], - ]; - $expected[0]->inviteStatus = Sharing\Plugin::INVITE_NORESPONSE; - $this->assertEquals($expected, $instance->getInvites()); - } - - public function testPublish() - { - $instance = $this->getInstance(); - $this->assertNull($instance->setPublishStatus(true)); - $this->assertNull($instance->setPublishStatus(false)); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/SharingPluginTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/SharingPluginTest.php deleted file mode 100644 index f11af8b95..000000000 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/SharingPluginTest.php +++ /dev/null @@ -1,383 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\CalDAV; - -use Sabre\DAV; -use Sabre\DAV\Xml\Element\Sharee; -use Sabre\DAVServerTest; -use Sabre\HTTP; - -class SharingPluginTest extends DAVServerTest -{ - protected $setupCalDAV = true; - protected $setupCalDAVSharing = true; - protected $setupACL = true; - protected $autoLogin = 'user1'; - - public function setup(): void - { - $this->caldavCalendars = [ - [ - 'principaluri' => 'principals/user1', - 'id' => 1, - 'uri' => 'cal1', - ], - [ - 'principaluri' => 'principals/user1', - 'id' => 2, - 'uri' => 'cal2', - 'share-access' => \Sabre\DAV\Sharing\Plugin::ACCESS_READWRITE, - ], - [ - 'principaluri' => 'principals/user1', - 'id' => 3, - 'uri' => 'cal3', - ], - ]; - - parent::setUp(); - - // Making the logged in user an admin, for full access: - $this->aclPlugin->adminPrincipals[] = 'principals/user2'; - } - - public function testSimple() - { - $this->assertInstanceOf('Sabre\\CalDAV\\SharingPlugin', $this->server->getPlugin('caldav-sharing')); - $this->assertEquals( - 'caldav-sharing', - $this->caldavSharingPlugin->getPluginInfo()['name'] - ); - } - - public function testSetupWithoutCoreSharingPlugin() - { - $this->expectException('LogicException'); - $server = new DAV\Server(); - $server->addPlugin( - new SharingPlugin() - ); - } - - public function testGetFeatures() - { - $this->assertEquals(['calendarserver-sharing'], $this->caldavSharingPlugin->getFeatures()); - } - - public function testBeforeGetShareableCalendar() - { - // Forcing the server to authenticate: - $this->authPlugin->beforeMethod(new HTTP\Request('GET', '/'), new HTTP\Response()); - $props = $this->server->getProperties('calendars/user1/cal1', [ - '{'.Plugin::NS_CALENDARSERVER.'}invite', - '{'.Plugin::NS_CALENDARSERVER.'}allowed-sharing-modes', - ]); - - $this->assertInstanceOf('Sabre\\CalDAV\\Xml\\Property\\Invite', $props['{'.Plugin::NS_CALENDARSERVER.'}invite']); - $this->assertInstanceOf('Sabre\\CalDAV\\Xml\\Property\\AllowedSharingModes', $props['{'.Plugin::NS_CALENDARSERVER.'}allowed-sharing-modes']); - } - - public function testBeforeGetSharedCalendar() - { - $props = $this->server->getProperties('calendars/user1/cal2', [ - '{'.Plugin::NS_CALENDARSERVER.'}shared-url', - '{'.Plugin::NS_CALENDARSERVER.'}invite', - ]); - - $this->assertInstanceOf('Sabre\\CalDAV\\Xml\\Property\\Invite', $props['{'.Plugin::NS_CALENDARSERVER.'}invite']); - //$this->assertInstanceOf('Sabre\\DAV\\Xml\\Property\\Href', $props['{' . Plugin::NS_CALENDARSERVER . '}shared-url']); - } - - public function testUpdateResourceType() - { - $this->caldavBackend->updateInvites(1, - [ - new Sharee([ - 'href' => 'mailto:joe@example.org', - ]), - ] - ); - $result = $this->server->updateProperties('calendars/user1/cal1', [ - '{DAV:}resourcetype' => new DAV\Xml\Property\ResourceType(['{DAV:}collection']), - ]); - - $this->assertEquals([ - '{DAV:}resourcetype' => 200, - ], $result); - - $this->assertEquals(0, count($this->caldavBackend->getInvites(1))); - } - - public function testUpdatePropertiesPassThru() - { - $result = $this->server->updateProperties('calendars/user1/cal3', [ - '{DAV:}foo' => 'bar', - ]); - - $this->assertEquals([ - '{DAV:}foo' => 200, - ], $result); - } - - public function testUnknownMethodNoPOST() - { - $request = HTTP\Sapi::createFromServerArray([ - 'REQUEST_METHOD' => 'PATCH', - 'REQUEST_URI' => '/', - ]); - - $response = $this->request($request); - - $this->assertEquals(501, $response->status, $response->getBodyAsString()); - } - - public function testUnknownMethodNoXML() - { - $request = HTTP\Sapi::createFromServerArray([ - 'REQUEST_METHOD' => 'POST', - 'REQUEST_URI' => '/', - 'CONTENT_TYPE' => 'text/plain', - ]); - - $response = $this->request($request); - - $this->assertEquals(501, $response->status, $response->getBodyAsString()); - } - - public function testUnknownMethodNoNode() - { - $request = HTTP\Sapi::createFromServerArray([ - 'REQUEST_METHOD' => 'POST', - 'REQUEST_URI' => '/foo', - 'CONTENT_TYPE' => 'text/xml', - ]); - - $response = $this->request($request); - - $this->assertEquals(501, $response->status, $response->getBodyAsString()); - } - - public function testShareRequest() - { - $request = new HTTP\Request('POST', '/calendars/user1/cal1', ['Content-Type' => 'text/xml']); - - $xml = <<<RRR -<?xml version="1.0"?> -<cs:share xmlns:cs="http://calendarserver.org/ns/" xmlns:d="DAV:"> - <cs:set> - <d:href>mailto:joe@example.org</d:href> - <cs:common-name>Joe Shmoe</cs:common-name> - <cs:read-write /> - </cs:set> - <cs:remove> - <d:href>mailto:nancy@example.org</d:href> - </cs:remove> -</cs:share> -RRR; - - $request->setBody($xml); - - $this->request($request, 200); - - $this->assertEquals( - [ - new Sharee([ - 'href' => 'mailto:joe@example.org', - 'properties' => [ - '{DAV:}displayname' => 'Joe Shmoe', - ], - 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_READWRITE, - 'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_NORESPONSE, - 'comment' => '', - ]), - ], - $this->caldavBackend->getInvites(1) - ); - - // Wiping out tree cache - $this->server->tree->markDirty(''); - - // Verifying that the calendar is now marked shared. - $props = $this->server->getProperties('calendars/user1/cal1', ['{DAV:}resourcetype']); - $this->assertTrue( - $props['{DAV:}resourcetype']->is('{http://calendarserver.org/ns/}shared-owner') - ); - } - - public function testShareRequestNoShareableCalendar() - { - $request = new HTTP\Request( - 'POST', - '/calendars/user1/cal2', - ['Content-Type' => 'text/xml'] - ); - - $xml = '<?xml version="1.0"?> -<cs:share xmlns:cs="'.Plugin::NS_CALENDARSERVER.'" xmlns:d="DAV:"> - <cs:set> - <d:href>mailto:joe@example.org</d:href> - <cs:common-name>Joe Shmoe</cs:common-name> - <cs:read-write /> - </cs:set> - <cs:remove> - <d:href>mailto:nancy@example.org</d:href> - </cs:remove> -</cs:share> -'; - - $request->setBody($xml); - - $this->request($request, 403); - } - - public function testInviteReply() - { - $request = HTTP\Sapi::createFromServerArray([ - 'REQUEST_METHOD' => 'POST', - 'REQUEST_URI' => '/calendars/user1', - 'CONTENT_TYPE' => 'text/xml', - ]); - - $xml = '<?xml version="1.0"?> -<cs:invite-reply xmlns:cs="'.Plugin::NS_CALENDARSERVER.'" xmlns:d="DAV:"> - <cs:hosturl><d:href>/principals/owner</d:href></cs:hosturl> - <cs:invite-accepted /> -</cs:invite-reply> -'; - - $request->setBody($xml); - $response = $this->request($request); - $this->assertEquals(200, $response->status, $response->getBodyAsString()); - } - - public function testInviteBadXML() - { - $request = HTTP\Sapi::createFromServerArray([ - 'REQUEST_METHOD' => 'POST', - 'REQUEST_URI' => '/calendars/user1', - 'CONTENT_TYPE' => 'text/xml', - ]); - - $xml = '<?xml version="1.0"?> -<cs:invite-reply xmlns:cs="'.Plugin::NS_CALENDARSERVER.'" xmlns:d="DAV:"> -</cs:invite-reply> -'; - $request->setBody($xml); - $response = $this->request($request); - $this->assertEquals(400, $response->status, $response->getBodyAsString()); - } - - public function testInviteWrongUrl() - { - $request = HTTP\Sapi::createFromServerArray([ - 'REQUEST_METHOD' => 'POST', - 'REQUEST_URI' => '/calendars/user1/cal1', - 'CONTENT_TYPE' => 'text/xml', - ]); - - $xml = '<?xml version="1.0"?> -<cs:invite-reply xmlns:cs="'.Plugin::NS_CALENDARSERVER.'" xmlns:d="DAV:"> - <cs:hosturl><d:href>/principals/owner</d:href></cs:hosturl> -</cs:invite-reply> -'; - $request->setBody($xml); - $response = $this->request($request); - $this->assertEquals(501, $response->status, $response->getBodyAsString()); - - // If the plugin did not handle this request, it must ensure that the - // body is still accessible by other plugins. - $this->assertEquals($xml, $request->getBody()); - } - - public function testPostWithoutContentType() - { - $request = new HTTP\Request('POST', '/'); - $response = new HTTP\ResponseMock(); - - $this->caldavSharingPlugin->httpPost($request, $response); - $this->assertTrue(true); - } - - public function testPublish() - { - $request = new HTTP\Request('POST', '/calendars/user1/cal1', ['Content-Type' => 'text/xml']); - - $xml = '<?xml version="1.0"?> -<cs:publish-calendar xmlns:cs="'.Plugin::NS_CALENDARSERVER.'" xmlns:d="DAV:" /> -'; - - $request->setBody($xml); - - $response = $this->request($request); - $this->assertEquals(202, $response->status, $response->getBodyAsString()); - } - - public function testUnpublish() - { - $request = new HTTP\Request( - 'POST', - '/calendars/user1/cal1', - ['Content-Type' => 'text/xml'] - ); - - $xml = '<?xml version="1.0"?> -<cs:unpublish-calendar xmlns:cs="'.Plugin::NS_CALENDARSERVER.'" xmlns:d="DAV:" /> -'; - - $request->setBody($xml); - - $response = $this->request($request); - $this->assertEquals(200, $response->status, $response->getBodyAsString()); - } - - public function testPublishWrongUrl() - { - $request = new HTTP\Request( - 'POST', - '/calendars/user1', - ['Content-Type' => 'text/xml'] - ); - - $xml = '<?xml version="1.0"?> -<cs:publish-calendar xmlns:cs="'.Plugin::NS_CALENDARSERVER.'" xmlns:d="DAV:" /> -'; - - $request->setBody($xml); - $this->request($request, 501); - } - - public function testUnpublishWrongUrl() - { - $request = new HTTP\Request( - 'POST', - '/calendars/user1', - ['Content-Type' => 'text/xml'] - ); - $xml = '<?xml version="1.0"?> -<cs:unpublish-calendar xmlns:cs="'.Plugin::NS_CALENDARSERVER.'" xmlns:d="DAV:" /> -'; - - $request->setBody($xml); - - $this->request($request, 501); - } - - public function testUnknownXmlDoc() - { - $request = new HTTP\Request( - 'POST', - '/calendars/user1/cal2', - ['Content-Type' => 'text/xml'] - ); - - $xml = '<?xml version="1.0"?> -<cs:foo-bar xmlns:cs="'.Plugin::NS_CALENDARSERVER.'" xmlns:d="DAV:" />'; - - $request->setBody($xml); - - $response = $this->request($request); - $this->assertEquals(501, $response->status, $response->getBodyAsString()); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/TestUtil.php b/vendor/sabre/dav/tests/Sabre/CalDAV/TestUtil.php deleted file mode 100644 index 5de11a31a..000000000 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/TestUtil.php +++ /dev/null @@ -1,102 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\CalDAV; - -class TestUtil -{ - public static function getBackend() - { - $backend = new Backend\Mock(); - $calendarId = $backend->createCalendar( - 'principals/user1', - 'UUID-123467', - [ - '{DAV:}displayname' => 'user1 calendar', - '{urn:ietf:params:xml:ns:caldav}calendar-description' => 'Calendar description', - '{http://apple.com/ns/ical/}calendar-order' => '1', - '{http://apple.com/ns/ical/}calendar-color' => '#FF0000', - ] - ); - $backend->createCalendar( - 'principals/user1', - 'UUID-123468', - [ - '{DAV:}displayname' => 'user1 calendar2', - '{urn:ietf:params:xml:ns:caldav}calendar-description' => 'Calendar description', - '{http://apple.com/ns/ical/}calendar-order' => '1', - '{http://apple.com/ns/ical/}calendar-color' => '#FF0000', - ] - ); - $backend->createCalendarObject($calendarId, 'UUID-2345', self::getTestCalendarData()); - - return $backend; - } - - public static function getTestCalendarData($type = 1) - { - $calendarData = 'BEGIN:VCALENDAR -VERSION:2.0 -PRODID:-//Apple Inc.//iCal 4.0.1//EN -CALSCALE:GREGORIAN -BEGIN:VTIMEZONE -TZID:Asia/Seoul -BEGIN:DAYLIGHT -TZOFFSETFROM:+0900 -RRULE:FREQ=YEARLY;UNTIL=19880507T150000Z;BYMONTH=5;BYDAY=2SU -DTSTART:19870510T000000 -TZNAME:GMT+09:00 -TZOFFSETTO:+1000 -END:DAYLIGHT -BEGIN:STANDARD -TZOFFSETFROM:+1000 -DTSTART:19881009T000000 -TZNAME:GMT+09:00 -TZOFFSETTO:+0900 -END:STANDARD -END:VTIMEZONE -BEGIN:VEVENT -CREATED:20100225T154229Z -UID:39A6B5ED-DD51-4AFE-A683-C35EE3749627 -TRANSP:TRANSPARENT -SUMMARY:Something here -DTSTAMP:20100228T130202Z'; - - switch ($type) { - case 1: - $calendarData .= "\nDTSTART;TZID=Asia/Seoul:20100223T060000\nDTEND;TZID=Asia/Seoul:20100223T070000\n"; - break; - case 2: - $calendarData .= "\nDTSTART:20100223T060000\nDTEND:20100223T070000\n"; - break; - case 3: - $calendarData .= "\nDTSTART;VALUE=DATE:20100223\nDTEND;VALUE=DATE:20100223\n"; - break; - case 4: - $calendarData .= "\nDTSTART;TZID=Asia/Seoul:20100223T060000\nDURATION:PT1H\n"; - break; - case 5: - $calendarData .= "\nDTSTART;TZID=Asia/Seoul:20100223T060000\nDURATION:-P5D\n"; - break; - case 6: - $calendarData .= "\nDTSTART;VALUE=DATE:20100223\n"; - break; - case 7: - $calendarData .= "\nDTSTART;VALUE=DATETIME:20100223T060000\n"; - break; - - // No DTSTART, so intentionally broken - case 'X': - $calendarData .= "\n"; - break; - } - - $calendarData .= 'ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:lisa@example.com -SEQUENCE:2 -END:VEVENT -END:VCALENDAR'; - - return $calendarData; - } -} diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/ValidateICalTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/ValidateICalTest.php deleted file mode 100644 index 4e2411391..000000000 --- a/vendor/sabre/dav/tests/Sabre/CalDAV/ValidateICalTest.php +++ /dev/null @@ -1,392 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\CalDAV; - -use Sabre\DAV; -use Sabre\DAVACL; -use Sabre\HTTP; - -class ValidateICalTest extends \PHPUnit\Framework\TestCase -{ - /** - * @var DAV\Server - */ - protected $server; - /** - * @var Sabre\CalDAV\Backend\Mock - */ - protected $calBackend; - - public function setup(): void - { - $calendars = [ - [ - 'id' => 'calendar1', - 'principaluri' => 'principals/admin', - 'uri' => 'calendar1', - '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set' => new Xml\Property\SupportedCalendarComponentSet(['VEVENT', 'VTODO', 'VJOURNAL']), - ], - [ - 'id' => 'calendar2', - 'principaluri' => 'principals/admin', - 'uri' => 'calendar2', - '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set' => new Xml\Property\SupportedCalendarComponentSet(['VTODO', 'VJOURNAL']), - ], - ]; - - $this->calBackend = new Backend\Mock($calendars, []); - $principalBackend = new DAVACL\PrincipalBackend\Mock(); - - $tree = [ - new CalendarRoot($principalBackend, $this->calBackend), - ]; - - $this->server = new DAV\Server($tree); - $this->server->sapi = new HTTP\SapiMock(); - $this->server->debugExceptions = true; - - $plugin = new Plugin(); - $this->server->addPlugin($plugin); - - $response = new HTTP\ResponseMock(); - $this->server->httpResponse = $response; - } - - /** - * @return Sabre\HTTP\ResponseMock - */ - public function request(HTTP\Request $request) - { - $this->server->httpRequest = $request; - $this->server->exec(); - - return $this->server->httpResponse; - } - - public function testCreateFile() - { - $request = HTTP\Sapi::createFromServerArray([ - 'REQUEST_METHOD' => 'PUT', - 'REQUEST_URI' => '/calendars/admin/calendar1/blabla.ics', - ]); - - $response = $this->request($request); - - $this->assertEquals(415, $response->status); - } - - public function testCreateFileValid() - { - $request = new HTTP\Request( - 'PUT', - '/calendars/admin/calendar1/blabla.ics', - ['Prefer' => 'handling=strict'] - ); - - $ics = <<<ICS -BEGIN:VCALENDAR -VERSION:2.0 -PRODID:foo -BEGIN:VEVENT -UID:foo -DTSTAMP:20160406T052348Z -DTSTART:20160706T140000Z -END:VEVENT -END:VCALENDAR -ICS; - - $request->setBody($ics); - - $response = $this->request($request); - - $this->assertEquals(201, $response->status, 'Incorrect status returned! Full response body: '.$response->getBodyAsString()); - $this->assertEquals([ - 'X-Sabre-Version' => [DAV\Version::VERSION], - 'Content-Length' => ['0'], - 'ETag' => ['"'.md5($ics).'"'], - ], $response->getHeaders()); - - $expected = [ - 'uri' => 'blabla.ics', - 'calendardata' => $ics, - 'calendarid' => 'calendar1', - 'lastmodified' => null, - ]; - - $this->assertEquals($expected, $this->calBackend->getCalendarObject('calendar1', 'blabla.ics')); - } - - public function testCreateFileNoVersion() - { - $request = new HTTP\Request( - 'PUT', - '/calendars/admin/calendar1/blabla.ics', - ['Prefer' => 'handling=strict'] - ); - - $ics = <<<ICS -BEGIN:VCALENDAR -PRODID:foo -BEGIN:VEVENT -UID:foo -DTSTAMP:20160406T052348Z -DTSTART:20160706T140000Z -END:VEVENT -END:VCALENDAR -ICS; - - $request->setBody($ics); - - $response = $this->request($request); - - $this->assertEquals(415, $response->status, 'Incorrect status returned! Full response body: '.$response->getBodyAsString()); - } - - public function testCreateFileNoVersionFixed() - { - $request = new HTTP\Request( - 'PUT', - '/calendars/admin/calendar1/blabla.ics', - ['Prefer' => 'handling=lenient'] - ); - - $ics = <<<ICS -BEGIN:VCALENDAR -PRODID:foo -BEGIN:VEVENT -UID:foo -DTSTAMP:20160406T052348Z -DTSTART:20160706T140000Z -END:VEVENT -END:VCALENDAR -ICS; - - $request->setBody($ics); - - $response = $this->request($request); - - $this->assertEquals(201, $response->status, 'Incorrect status returned! Full response body: '.$response->getBodyAsString()); - $this->assertEquals([ - 'X-Sabre-Version' => [DAV\Version::VERSION], - 'Content-Length' => ['0'], - 'X-Sabre-Ew-Gross' => ['iCalendar validation warning: VERSION MUST appear exactly once in a VCALENDAR component'], - ], $response->getHeaders()); - - $ics = <<<ICS -BEGIN:VCALENDAR\r -VERSION:2.0\r -PRODID:foo\r -BEGIN:VEVENT\r -UID:foo\r -DTSTAMP:20160406T052348Z\r -DTSTART:20160706T140000Z\r -END:VEVENT\r -END:VCALENDAR\r - -ICS; - - $expected = [ - 'uri' => 'blabla.ics', - 'calendardata' => $ics, - 'calendarid' => 'calendar1', - 'lastmodified' => null, - ]; - - $this->assertEquals($expected, $this->calBackend->getCalendarObject('calendar1', 'blabla.ics')); - } - - public function testCreateFileNoComponents() - { - $request = new HTTP\Request( - 'PUT', - '/calendars/admin/calendar1/blabla.ics', - ['Prefer' => 'handling=strict'] - ); - $ics = <<<ICS -BEGIN:VCALENDAR -VERSION:2.0 -PRODID:foo -END:VCALENDAR -ICS; - - $request->setBody($ics); - - $response = $this->request($request); - $this->assertEquals(403, $response->status, 'Incorrect status returned! Full response body: '.$response->getBodyAsString()); - } - - public function testCreateFileNoUID() - { - $request = HTTP\Sapi::createFromServerArray([ - 'REQUEST_METHOD' => 'PUT', - 'REQUEST_URI' => '/calendars/admin/calendar1/blabla.ics', - ]); - $request->setBody("BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n"); - - $response = $this->request($request); - - $this->assertEquals(415, $response->status, 'Incorrect status returned! Full response body: '.$response->getBodyAsString()); - } - - public function testCreateFileVCard() - { - $request = HTTP\Sapi::createFromServerArray([ - 'REQUEST_METHOD' => 'PUT', - 'REQUEST_URI' => '/calendars/admin/calendar1/blabla.ics', - ]); - $request->setBody("BEGIN:VCARD\r\nEND:VCARD\r\n"); - - $response = $this->request($request); - - $this->assertEquals(415, $response->status, 'Incorrect status returned! Full response body: '.$response->getBodyAsString()); - } - - public function testCreateFile2Components() - { - $request = HTTP\Sapi::createFromServerArray([ - 'REQUEST_METHOD' => 'PUT', - 'REQUEST_URI' => '/calendars/admin/calendar1/blabla.ics', - ]); - $request->setBody("BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nUID:foo\r\nEND:VEVENT\r\nBEGIN:VJOURNAL\r\nUID:foo\r\nEND:VJOURNAL\r\nEND:VCALENDAR\r\n"); - - $response = $this->request($request); - - $this->assertEquals(415, $response->status, 'Incorrect status returned! Full response body: '.$response->getBodyAsString()); - } - - public function testCreateFile2UIDS() - { - $request = HTTP\Sapi::createFromServerArray([ - 'REQUEST_METHOD' => 'PUT', - 'REQUEST_URI' => '/calendars/admin/calendar1/blabla.ics', - ]); - $request->setBody("BEGIN:VCALENDAR\r\nBEGIN:VTIMEZONE\r\nEND:VTIMEZONE\r\nBEGIN:VEVENT\r\nUID:foo\r\nEND:VEVENT\r\nBEGIN:VEVENT\r\nUID:bar\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n"); - - $response = $this->request($request); - - $this->assertEquals(415, $response->status, 'Incorrect status returned! Full response body: '.$response->getBodyAsString()); - } - - public function testCreateFileWrongComponent() - { - $request = HTTP\Sapi::createFromServerArray([ - 'REQUEST_METHOD' => 'PUT', - 'REQUEST_URI' => '/calendars/admin/calendar1/blabla.ics', - ]); - $request->setBody("BEGIN:VCALENDAR\r\nBEGIN:VTIMEZONE\r\nEND:VTIMEZONE\r\nBEGIN:VFREEBUSY\r\nUID:foo\r\nEND:VFREEBUSY\r\nEND:VCALENDAR\r\n"); - - $response = $this->request($request); - - $this->assertEquals(403, $response->status, 'Incorrect status returned! Full response body: '.$response->getBodyAsString()); - } - - public function testUpdateFile() - { - $this->calBackend->createCalendarObject('calendar1', 'blabla.ics', 'foo'); - $request = HTTP\Sapi::createFromServerArray([ - 'REQUEST_METHOD' => 'PUT', - 'REQUEST_URI' => '/calendars/admin/calendar1/blabla.ics', - ]); - - $response = $this->request($request); - - $this->assertEquals(415, $response->status); - } - - public function testUpdateFileParsableBody() - { - $this->calBackend->createCalendarObject('calendar1', 'blabla.ics', 'foo'); - $request = new HTTP\Request( - 'PUT', - '/calendars/admin/calendar1/blabla.ics' - ); - $ics = <<<ICS -BEGIN:VCALENDAR -VERSION:2.0 -PRODID:foo -BEGIN:VEVENT -UID:foo -DTSTAMP:20160406T052348Z -DTSTART:20160706T140000Z -END:VEVENT -END:VCALENDAR -ICS; - - $request->setBody($ics); - $response = $this->request($request); - - $this->assertEquals(204, $response->status); - - $expected = [ - 'uri' => 'blabla.ics', - 'calendardata' => $ics, - 'calendarid' => 'calendar1', - 'lastmodified' => null, - ]; - - $this->assertEquals($expected, $this->calBackend->getCalendarObject('calendar1', 'blabla.ics')); - } - - public function testCreateFileInvalidComponent() - { - $request = HTTP\Sapi::createFromServerArray([ - 'REQUEST_METHOD' => 'PUT', - 'REQUEST_URI' => '/calendars/admin/calendar2/blabla.ics', - ]); - $request->setBody("BEGIN:VCALENDAR\r\nBEGIN:VTIMEZONE\r\nEND:VTIMEZONE\r\nBEGIN:VEVENT\r\nUID:foo\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n"); - - $response = $this->request($request); - - $this->assertEquals(403, $response->status, 'Incorrect status returned! Full response body: '.$response->getBodyAsString()); - } - - public function testUpdateFileInvalidComponent() - { - $this->calBackend->createCalendarObject('calendar2', 'blabla.ics', 'foo'); - $request = HTTP\Sapi::createFromServerArray([ - 'REQUEST_METHOD' => 'PUT', - 'REQUEST_URI' => '/calendars/admin/calendar2/blabla.ics', - ]); - $request->setBody("BEGIN:VCALENDAR\r\nBEGIN:VTIMEZONE\r\nEND:VTIMEZONE\r\nBEGIN:VEVENT\r\nUID:foo\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n"); - - $response = $this->request($request); - - $this->assertEquals(403, $response->status, 'Incorrect status returned! Full response body: '.$response->getBodyAsString()); - } - - /** - * What we are testing here, is if we send in a latin1 character, the - * server should automatically transform this into UTF-8. - * - * More importantly. If any transformation happens, the etag must no longer - * be returned by the server. - */ - public function testCreateFileModified() - { - $request = new HTTP\Request( - 'PUT', - '/calendars/admin/calendar1/blabla.ics' - ); - $ics = <<<ICS -BEGIN:VCALENDAR -VERSION:2.0 -PRODID:foo -BEGIN:VEVENT -UID:foo -SUMMARY:Meeting in M\xfcnster -DTSTAMP:20160406T052348Z -DTSTART:20160706T140000Z -END:VEVENT -END:VCALENDAR -ICS; - - $request->setBody($ics); - - $response = $this->request($request); - - $this->assertEquals(201, $response->status, 'Incorrect status returned! Full response body: '.$response->getBodyAsString()); - $this->assertNull($response->getHeader('ETag')); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/CardDAV/AbstractPluginTest.php b/vendor/sabre/dav/tests/Sabre/CardDAV/AbstractPluginTest.php deleted file mode 100644 index 6565fc459..000000000 --- a/vendor/sabre/dav/tests/Sabre/CardDAV/AbstractPluginTest.php +++ /dev/null @@ -1,43 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\CardDAV; - -use Sabre\DAV; -use Sabre\DAVACL; -use Sabre\HTTP; - -abstract class AbstractPluginTest extends \PHPUnit\Framework\TestCase -{ - /** - * @var Sabre\CardDAV\Plugin - */ - protected $plugin; - /** - * @var Sabre\DAV\Server - */ - protected $server; - /** - * @var Sabre\CardDAV\Backend\Mock; - */ - protected $backend; - - public function setup(): void - { - $this->backend = new Backend\Mock(); - $principalBackend = new DAVACL\PrincipalBackend\Mock(); - - $tree = [ - new AddressBookRoot($principalBackend, $this->backend), - new DAVACL\PrincipalCollection($principalBackend), - ]; - - $this->plugin = new Plugin(); - $this->plugin->directories = ['directory']; - $this->server = new DAV\Server($tree); - $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 deleted file mode 100644 index a86d85144..000000000 --- a/vendor/sabre/dav/tests/Sabre/CardDAV/AddressBookQueryTest.php +++ /dev/null @@ -1,351 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\CardDAV; - -use Sabre\DAV; -use Sabre\HTTP; - -class AddressBookQueryTest extends AbstractPluginTest -{ - public function testQuery() - { - $request = new HTTP\Request( - 'REPORT', - '/addressbooks/user1/book1', - ['Depth' => '1'] - ); - - $request->setBody( -'<?xml version="1.0"?> -<c:addressbook-query xmlns:d="DAV:" xmlns:c="urn:ietf:params:xml:ns:carddav"> - <d:prop> - <d:getetag /> - </d:prop> - <c:filter> - <c:prop-filter name="uid" /> - </c:filter> -</c:addressbook-query>' - ); - - $response = new HTTP\ResponseMock(); - - $this->server->httpRequest = $request; - $this->server->httpResponse = $response; - - $this->server->exec(); - - $bodyAsString = $response->getBodyAsString(); - $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:'.$bodyAsString); - - // using the client for parsing - $client = new DAV\Client(['baseUri' => '/']); - - $result = $client->parseMultiStatus($bodyAsString); - - $this->assertEquals([ - '/addressbooks/user1/book1/card1' => [ - 200 => [ - '{DAV:}getetag' => '"'.md5("BEGIN:VCARD\nVERSION:3.0\nUID:12345\nEND:VCARD").'"', - ], - ], - '/addressbooks/user1/book1/card2' => [ - 404 => [ - '{DAV:}getetag' => null, - ], - ], - ], $result); - } - - public function testQueryDepth0() - { - $request = new HTTP\Request( - 'REPORT', - '/addressbooks/user1/book1/card1', - ['Depth' => '0'] - ); - - $request->setBody( -'<?xml version="1.0"?> -<c:addressbook-query xmlns:d="DAV:" xmlns:c="urn:ietf:params:xml:ns:carddav"> - <d:prop> - <d:getetag /> - </d:prop> - <c:filter> - <c:prop-filter name="uid" /> - </c:filter> -</c:addressbook-query>' - ); - - $response = new HTTP\ResponseMock(); - - $this->server->httpRequest = $request; - $this->server->httpResponse = $response; - - $this->server->exec(); - - $bodyAsString = $response->getBodyAsString(); - $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:'.$bodyAsString); - - // using the client for parsing - $client = new DAV\Client(['baseUri' => '/']); - - $result = $client->parseMultiStatus($bodyAsString); - - $this->assertEquals([ - '/addressbooks/user1/book1/card1' => [ - 200 => [ - '{DAV:}getetag' => '"'.md5("BEGIN:VCARD\nVERSION:3.0\nUID:12345\nEND:VCARD").'"', - ], - ], - ], $result); - } - - public function testQueryNoMatch() - { - $request = new HTTP\Request( - 'REPORT', - '/addressbooks/user1/book1', - ['Depth' => '1'] - ); - - $request->setBody( -'<?xml version="1.0"?> -<c:addressbook-query xmlns:d="DAV:" xmlns:c="urn:ietf:params:xml:ns:carddav"> - <d:prop> - <d:getetag /> - </d:prop> - <c:filter> - <c:prop-filter name="email" /> - </c:filter> -</c:addressbook-query>' - ); - - $response = new HTTP\ResponseMock(); - - $this->server->httpRequest = $request; - $this->server->httpResponse = $response; - - $this->server->exec(); - - $bodyAsString = $response->getBodyAsString(); - $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:'.$bodyAsString); - - // using the client for parsing - $client = new DAV\Client(['baseUri' => '/']); - - $result = $client->parseMultiStatus($bodyAsString); - - $this->assertEquals([], $result); - } - - public function testQueryLimit() - { - $request = HTTP\Sapi::createFromServerArray([ - 'REQUEST_METHOD' => 'REPORT', - 'REQUEST_URI' => '/addressbooks/user1/book1', - 'HTTP_DEPTH' => '1', - ]); - - $request->setBody( -'<?xml version="1.0"?> -<c:addressbook-query xmlns:d="DAV:" xmlns:c="urn:ietf:params:xml:ns:carddav"> - <d:prop> - <d:getetag /> - </d:prop> - <c:filter> - <c:prop-filter name="uid" /> - </c:filter> - <c:limit><c:nresults>1</c:nresults></c:limit> -</c:addressbook-query>' - ); - - $response = new HTTP\ResponseMock(); - - $this->server->httpRequest = $request; - $this->server->httpResponse = $response; - - $this->server->exec(); - - $bodyAsString = $response->getBodyAsString(); - $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:'.$bodyAsString); - - // using the client for parsing - $client = new DAV\Client(['baseUri' => '/']); - - $result = $client->parseMultiStatus($bodyAsString); - - $this->assertEquals([ - '/addressbooks/user1/book1/card1' => [ - 200 => [ - '{DAV:}getetag' => '"'.md5("BEGIN:VCARD\nVERSION:3.0\nUID:12345\nEND:VCARD").'"', - ], - ], - ], $result); - } - - public function testJson() - { - $request = new HTTP\Request( - 'REPORT', - '/addressbooks/user1/book1/card1', - ['Depth' => '0'] - ); - - $request->setBody( -'<?xml version="1.0"?> -<c:addressbook-query xmlns:d="DAV:" xmlns:c="urn:ietf:params:xml:ns:carddav"> - <d:prop> - <c:address-data content-type="application/vcard+json" /> - <d:getetag /> - </d:prop> -</c:addressbook-query>' - ); - - $response = new HTTP\ResponseMock(); - - $this->server->httpRequest = $request; - $this->server->httpResponse = $response; - - $this->server->exec(); - - $bodyAsString = $response->getBodyAsString(); - $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:'.$bodyAsString); - - // using the client for parsing - $client = new DAV\Client(['baseUri' => '/']); - - $result = $client->parseMultiStatus($bodyAsString); - - $vobjVersion = \Sabre\VObject\Version::VERSION; - - $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"]]]', - ], - ], - ], $result); - } - - public function testVCard4() - { - $request = new HTTP\Request( - 'REPORT', - '/addressbooks/user1/book1/card1', - ['Depth' => '0'] - ); - - $request->setBody( -'<?xml version="1.0"?> -<c:addressbook-query xmlns:d="DAV:" xmlns:c="urn:ietf:params:xml:ns:carddav"> - <d:prop> - <c:address-data content-type="text/vcard" version="4.0" /> - <d:getetag /> - </d:prop> -</c:addressbook-query>' - ); - - $response = new HTTP\ResponseMock(); - - $this->server->httpRequest = $request; - $this->server->httpResponse = $response; - - $this->server->exec(); - - $bodyAsString = $response->getBodyAsString(); - $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:'.$bodyAsString); - - // using the client for parsing - $client = new DAV\Client(['baseUri' => '/']); - - $result = $client->parseMultiStatus($bodyAsString); - - $vobjVersion = \Sabre\VObject\Version::VERSION; - - $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' => "BEGIN:VCARD\r\nVERSION:4.0\r\nPRODID:-//Sabre//Sabre VObject $vobjVersion//EN\r\nUID:12345\r\nEND:VCARD\r\n", - ], - ], - ], $result); - } - - public function testAddressBookDepth0() - { - $request = new HTTP\Request( - 'REPORT', - '/addressbooks/user1/book1', - ['Depth' => '0'] - ); - - $request->setBody( - '<?xml version="1.0"?> -<c:addressbook-query xmlns:d="DAV:" xmlns:c="urn:ietf:params:xml:ns:carddav"> - <d:prop> - <c:address-data content-type="application/vcard+json" /> - <d:getetag /> - </d:prop> -</c:addressbook-query>' - ); - - $response = new HTTP\ResponseMock(); - - $this->server->httpRequest = $request; - $this->server->httpResponse = $response; - - $this->server->exec(); - - $this->assertEquals(415, $response->status, 'Incorrect status code. Full response body:'.$response->getBodyAsString()); - } - - public function testAddressBookProperties() - { - $request = new HTTP\Request( - 'REPORT', - '/addressbooks/user1/book3', - ['Depth' => '1'] - ); - - $request->setBody( - '<?xml version="1.0"?> -<c:addressbook-query xmlns:d="DAV:" xmlns:c="urn:ietf:params:xml:ns:carddav"> - <d:prop> - <c:address-data> - <c:prop name="FN"/> - <c:prop name="BDAY"/> - </c:address-data> - <d:getetag /> - </d:prop> -</c:addressbook-query>' - ); - - $response = new HTTP\ResponseMock(); - - $this->server->httpRequest = $request; - $this->server->httpResponse = $response; - - $this->server->exec(); - - $bodyAsString = $response->getBodyAsString(); - $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:'.$bodyAsString); - - // using the client for parsing - $client = new DAV\Client(['baseUri' => '/']); - - $result = $client->parseMultiStatus($bodyAsString); - - $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").'"', - '{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 deleted file mode 100644 index c4aff2712..000000000 --- a/vendor/sabre/dav/tests/Sabre/CardDAV/AddressBookRootTest.php +++ /dev/null @@ -1,31 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\CardDAV; - -use Sabre\DAVACL; - -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()); - } - - public function testGetChildForPrincipal() - { - $pBackend = new DAVACL\PrincipalBackend\Mock(); - $cBackend = new Backend\Mock(); - $root = new AddressBookRoot($pBackend, $cBackend); - - $children = $root->getChildren(); - $this->assertEquals(3, count($children)); - - $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 deleted file mode 100644 index e985c54ff..000000000 --- a/vendor/sabre/dav/tests/Sabre/CardDAV/AddressBookTest.php +++ /dev/null @@ -1,171 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\CardDAV; - -use Sabre\DAV\PropPatch; - -class AddressBookTest extends \PHPUnit\Framework\TestCase -{ - use \Sabre\DAV\DbTestHelperTrait; - - /** - * @var Sabre\CardDAV\AddressBook - */ - protected $ab; - protected $backend; - - public function setup(): void - { - $this->backend = new Backend\Mock(); - $this->ab = new AddressBook( - $this->backend, - [ - 'uri' => 'book1', - 'id' => 'foo', - '{DAV:}displayname' => 'd-name', - 'principaluri' => 'principals/user1', - ] - ); - } - - public function testGetName() - { - $this->assertEquals('book1', $this->ab->getName()); - } - - public function testGetChild() - { - $card = $this->ab->getChild('card1'); - $this->assertInstanceOf('Sabre\\CardDAV\\Card', $card); - $this->assertEquals('card1', $card->getName()); - } - - public function testGetChildNotFound() - { - $this->expectException('Sabre\DAV\Exception\NotFound'); - $card = $this->ab->getChild('card3'); - } - - public function testGetChildren() - { - $cards = $this->ab->getChildren(); - $this->assertEquals(2, count($cards)); - - $this->assertEquals('card1', $cards[0]->getName()); - $this->assertEquals('card2', $cards[1]->getName()); - } - - public function testCreateDirectory() - { - $this->expectException('Sabre\DAV\Exception\MethodNotAllowed'); - $this->ab->createDirectory('name'); - } - - 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']); - } - - public function testDelete() - { - $this->ab->delete(); - $this->assertEquals(1, count($this->backend->addressBooks)); - } - - public function testSetName() - { - $this->expectException('Sabre\DAV\Exception\MethodNotAllowed'); - $this->ab->setName('foo'); - } - - public function testGetLastModified() - { - $this->assertNull($this->ab->getLastModified()); - } - - public function testUpdateProperties() - { - $propPatch = new PropPatch([ - '{DAV:}displayname' => 'barrr', - ]); - $this->ab->propPatch($propPatch); - $this->assertTrue($propPatch->commit()); - - $this->assertEquals('barrr', $this->backend->addressBooks[0]['{DAV:}displayname']); - } - - public function testGetProperties() - { - $props = $this->ab->getProperties(['{DAV:}displayname']); - $this->assertEquals([ - '{DAV:}displayname' => 'd-name', - ], $props); - } - - public function testACLMethods() - { - $this->assertEquals('principals/user1', $this->ab->getOwner()); - $this->assertNull($this->ab->getGroup()); - $this->assertEquals([ - [ - 'privilege' => '{DAV:}all', - 'principal' => '{DAV:}owner', - 'protected' => true, - ], - ], $this->ab->getACL()); - } - - public function testSetACL() - { - $this->expectException('Sabre\DAV\Exception\Forbidden'); - $this->ab->setACL([]); - } - - public function testGetSupportedPrivilegeSet() - { - $this->assertNull( - $this->ab->getSupportedPrivilegeSet() - ); - } - - public function testGetSyncTokenNoSyncSupport() - { - $this->assertNull($this->ab->getSyncToken()); - } - - public function testGetChangesNoSyncSupport() - { - $this->assertNull($this->ab->getChanges(1, null)); - } - - public function testGetSyncToken() - { - $this->driver = 'sqlite'; - $this->dropTables(['addressbooks', 'cards', 'addressbookchanges']); - $this->createSchema('addressbooks'); - $backend = new Backend\PDO( - $this->getPDO() - ); - $ab = new AddressBook($backend, ['id' => 1, '{DAV:}sync-token' => 2]); - $this->assertEquals(2, $ab->getSyncToken()); - } - - public function testGetSyncToken2() - { - $this->driver = 'sqlite'; - $this->dropTables(['addressbooks', 'cards', 'addressbookchanges']); - $this->createSchema('addressbooks'); - $backend = new Backend\PDO( - $this->getPDO() - ); - $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 deleted file mode 100644 index bac3b2b22..000000000 --- a/vendor/sabre/dav/tests/Sabre/CardDAV/Backend/AbstractPDOTest.php +++ /dev/null @@ -1,351 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\CardDAV\Backend; - -use Sabre\CardDAV; -use Sabre\DAV\PropPatch; - -abstract class AbstractPDOTest extends \PHPUnit\Framework\TestCase -{ - use \Sabre\DAV\DbTestHelperTrait; - - /** - * @var CardDAV\Backend\PDO - */ - protected $backend; - - public function setup(): void - { - $this->dropTables([ - 'addressbooks', - 'cards', - 'addressbookchanges', - ]); - $this->createSchema('addressbooks'); - $pdo = $this->getPDO(); - - $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)"); - } - - 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, - ], - ]; - - $this->assertEquals($expected, $result); - } - - public function testUpdateAddressBookInvalidProp() - { - $propPatch = new PropPatch([ - '{DAV:}displayname' => 'updated', - '{'.CardDAV\Plugin::NS_CARDDAV.'}addressbook-description' => 'updated', - '{DAV:}foo' => 'bar', - ]); - - $this->backend->updateAddressBook(1, $propPatch); - $result = $propPatch->commit(); - - $this->assertFalse($result); - - $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, - ], - ]; - - $this->assertEquals($expected, $result); - } - - public function testUpdateAddressBookNoProps() - { - $propPatch = new PropPatch([ - ]); - - $this->backend->updateAddressBook(1, $propPatch); - $result = $propPatch->commit(); - $this->assertTrue($result); - - $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, - ], - ]; - - $this->assertEquals($expected, $result); - } - - public function testUpdateAddressBookSuccess() - { - $propPatch = new PropPatch([ - '{DAV:}displayname' => 'updated', - '{'.CardDAV\Plugin::NS_CARDDAV.'}addressbook-description' => 'updated', - ]); - - $this->backend->updateAddressBook(1, $propPatch); - $result = $propPatch->commit(); - - $this->assertTrue($result); - - $result = $this->backend->getAddressBooksForUser('principals/user1'); - - $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, - ], - ]; - - $this->assertEquals($expected, $result); - } - - public function testDeleteAddressBook() - { - $this->backend->deleteAddressBook(1); - - $this->assertEquals([], $this->backend->getAddressBooksForUser('principals/user1')); - } - - public function testCreateAddressBookUnsupportedProp() - { - $this->expectException('Sabre\DAV\Exception\BadRequest'); - $this->backend->createAddressBook('principals/user1', 'book2', [ - '{DAV:}foo' => 'bar', - ]); - } - - public function testCreateAddressBookSuccess() - { - $this->backend->createAddressBook('principals/user1', 'book2', [ - '{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' => 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); - } - - public function testGetCards() - { - $result = $this->backend->getCards(1); - - $expected = [ - [ - 'id' => 1, - 'uri' => 'card1', - 'lastmodified' => 0, - 'etag' => '"'.md5('card1').'"', - 'size' => 5, - ], - ]; - - $this->assertEquals($expected, $result); - } - - public function testGetCard() - { - $result = $this->backend->getCard(1, 'card1'); - - $expected = [ - 'id' => 1, - 'uri' => 'card1', - 'carddata' => 'card1', - 'lastmodified' => 0, - 'etag' => '"'.md5('card1').'"', - 'size' => 5, - ]; - - if (is_resource($result['carddata'])) { - $result['carddata'] = stream_get_contents($result['carddata']); - } - - $this->assertEquals($expected, $result); - } - - /** - * @depends testGetCard - */ - public function testCreateCard() - { - $result = $this->backend->createCard(1, 'card2', 'data2'); - $this->assertEquals('"'.md5('data2').'"', $result); - $result = $this->backend->getCard(1, 'card2'); - $this->assertEquals(2, $result['id']); - $this->assertEquals('card2', $result['uri']); - if (is_resource($result['carddata'])) { - $result['carddata'] = stream_get_contents($result['carddata']); - } - $this->assertEquals('data2', $result['carddata']); - } - - /** - * @depends testCreateCard - */ - public function testGetMultiple() - { - $result = $this->backend->createCard(1, 'card2', 'data2'); - $result = $this->backend->createCard(1, 'card3', 'data3'); - $check = [ - [ - 'id' => 1, - 'uri' => 'card1', - 'carddata' => 'card1', - 'lastmodified' => 0, - ], - [ - 'id' => 2, - 'uri' => 'card2', - 'carddata' => 'data2', - 'lastmodified' => time(), - ], - [ - 'id' => 3, - 'uri' => 'card3', - 'carddata' => 'data3', - 'lastmodified' => time(), - ], - ]; - - $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': - $this->assertIsInt($actual); - break; - case 'carddata': - if (is_resource($actual)) { - $actual = stream_get_contents($actual); - } - // no break intended. - default: - $this->assertEquals($expected, $actual); - break; - } - } - } - } - - /** - * @depends testGetCard - */ - public function testUpdateCard() - { - $result = $this->backend->updateCard(1, 'card1', 'newdata'); - $this->assertEquals('"'.md5('newdata').'"', $result); - - $result = $this->backend->getCard(1, 'card1'); - $this->assertEquals(1, $result['id']); - if (is_resource($result['carddata'])) { - $result['carddata'] = stream_get_contents($result['carddata']); - } - $this->assertEquals('newdata', $result['carddata']); - } - - /** - * @depends testGetCard - */ - public function testDeleteCard() - { - $this->backend->deleteCard(1, 'card1'); - $result = $this->backend->getCard(1, 'card1'); - $this->assertFalse($result); - } - - public function testGetChanges() - { - $backend = $this->backend; - $id = $backend->createAddressBook( - 'principals/user1', - 'bla', - [] - ); - $result = $backend->getChangesForAddressBook($id, null, 1); - - $this->assertEquals([ - 'syncToken' => 1, - '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'); - - $result = $backend->getChangesForAddressBook($id, $currentToken, 1); - - $this->assertEquals([ - 'syncToken' => 6, - '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 deleted file mode 100644 index 630465cc8..000000000 --- a/vendor/sabre/dav/tests/Sabre/CardDAV/Backend/Mock.php +++ /dev/null @@ -1,257 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\CardDAV\Backend; - -class Mock extends AbstractBackend -{ - public $addressBooks; - public $cards; - - 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', - '{DAV:}displayname' => 'd-name', - ], - [ - 'id' => 'bar', - 'uri' => 'book3', - 'principaluri' => 'principals/user1', - '{DAV:}displayname' => 'd-name', - ], - ]; - - $card2 = fopen('php://memory', 'r+'); - fwrite($card2, "BEGIN:VCARD\nVERSION:3.0\nUID:45678\nEND:VCARD"); - rewind($card2); - $this->cards = [ - 'foo' => [ - 'card1' => "BEGIN:VCARD\nVERSION:3.0\nUID:12345\nEND:VCARD", - 'card2' => $card2, - ], - 'bar' => [ - 'card3' => "BEGIN:VCARD\nVERSION:3.0\nUID:12345\nFN:Test-Card\nEMAIL;TYPE=home:bar@example.org\nEND:VCARD", - ], - ]; - } - } - - public function getAddressBooksForUser($principalUri) - { - $books = []; - foreach ($this->addressBooks as $book) { - if ($book['principaluri'] === $principalUri) { - $books[] = $book; - } - } - - return $books; - } - - /** - * Updates properties for an address book. - * - * The list of mutations is stored in a Sabre\DAV\PropPatch object. - * To do the actual updates, you must tell this object which properties - * you're going to process with the handle() method. - * - * Calling the handle method is like telling the PropPatch object "I - * promise I can handle updating this property". - * - * Read the PropPatch documentation for more info and examples. - * - * @param string $addressBookId - */ - public function updateAddressBook($addressBookId, \Sabre\DAV\PropPatch $propPatch) - { - foreach ($this->addressBooks as &$book) { - if ($book['id'] !== $addressBookId) { - continue; - } - - $propPatch->handleRemaining(function ($mutations) use (&$book) { - foreach ($mutations as $key => $value) { - $book[$key] = $value; - } - - return true; - }); - } - } - - public function createAddressBook($principalUri, $url, array $properties) - { - $this->addressBooks[] = array_merge($properties, [ - 'id' => $url, - 'uri' => $url, - 'principaluri' => $principalUri, - ]); - } - - public function deleteAddressBook($addressBookId) - { - foreach ($this->addressBooks as $key => $value) { - if ($value['id'] === $addressBookId) { - unset($this->addressBooks[$key]); - } - } - unset($this->cards[$addressBookId]); - } - - /** - * Returns all cards for a specific addressbook id. - * - * This method should return the following properties for each card: - * * carddata - raw vcard data - * * uri - Some unique url - * * lastmodified - A unix timestamp - * - * It's recommended to also return the following properties: - * * etag - A unique etag. This must change every time the card changes. - * * size - The size of the card in bytes. - * - * If these last two properties are provided, less time will be spent - * calculating them. If they are specified, you can also ommit carddata. - * This may speed up certain requests, especially with large cards. - * - * @param mixed $addressBookId - * - * @return array - */ - public function getCards($addressBookId) - { - $cards = []; - foreach ($this->cards[$addressBookId] as $uri => $data) { - if (is_resource($data)) { - $cards[] = [ - 'uri' => $uri, - 'carddata' => $data, - ]; - } else { - $cards[] = [ - 'uri' => $uri, - 'carddata' => $data, - 'etag' => '"'.md5($data).'"', - 'size' => strlen($data), - ]; - } - } - - return $cards; - } - - /** - * Returns a specfic card. - * - * The same set of properties must be returned as with getCards. The only - * exception is that 'carddata' is absolutely required. - * - * If the card does not exist, you must return false. - * - * @param mixed $addressBookId - * @param string $cardUri - * - * @return array - */ - public function getCard($addressBookId, $cardUri) - { - if (!isset($this->cards[$addressBookId][$cardUri])) { - return false; - } - - $data = $this->cards[$addressBookId][$cardUri]; - - return [ - 'uri' => $cardUri, - 'carddata' => $data, - 'etag' => '"'.md5($data).'"', - 'size' => strlen($data), - ]; - } - - /** - * Creates a new card. - * - * The addressbook id will be passed as the first argument. This is the - * same id as it is returned from the getAddressBooksForUser method. - * - * The cardUri is a base uri, and doesn't include the full path. The - * cardData argument is the vcard body, and is passed as a string. - * - * It is possible to return an ETag from this method. This ETag is for the - * newly created resource, and must be enclosed with double quotes (that - * is, the string itself must contain the double quotes). - * - * You should only return the ETag if you store the carddata as-is. If a - * subsequent GET request on the same card does not have the same body, - * byte-by-byte and you did return an ETag here, clients tend to get - * confused. - * - * If you don't return an ETag, you can just return null. - * - * @param mixed $addressBookId - * @param string $cardUri - * @param string $cardData - * - * @return string|null - */ - public function createCard($addressBookId, $cardUri, $cardData) - { - if (is_resource($cardData)) { - $cardData = stream_get_contents($cardData); - } - $this->cards[$addressBookId][$cardUri] = $cardData; - - return '"'.md5($cardData).'"'; - } - - /** - * Updates a card. - * - * The addressbook id will be passed as the first argument. This is the - * same id as it is returned from the getAddressBooksForUser method. - * - * The cardUri is a base uri, and doesn't include the full path. The - * cardData argument is the vcard body, and is passed as a string. - * - * It is possible to return an ETag from this method. This ETag should - * match that of the updated resource, and must be enclosed with double - * quotes (that is: the string itself must contain the actual quotes). - * - * You should only return the ETag if you store the carddata as-is. If a - * subsequent GET request on the same card does not have the same body, - * byte-by-byte and you did return an ETag here, clients tend to get - * confused. - * - * If you don't return an ETag, you can just return null. - * - * @param mixed $addressBookId - * @param string $cardUri - * @param string $cardData - * - * @return string|null - */ - public function updateCard($addressBookId, $cardUri, $cardData) - { - if (is_resource($cardData)) { - $cardData = stream_get_contents($cardData); - } - $this->cards[$addressBookId][$cardUri] = $cardData; - - return '"'.md5($cardData).'"'; - } - - 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 deleted file mode 100644 index 718eec6be..000000000 --- a/vendor/sabre/dav/tests/Sabre/CardDAV/Backend/PDOMySQLTest.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php - -declare(strict_types=1); - -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 deleted file mode 100644 index b16a00ce2..000000000 --- a/vendor/sabre/dav/tests/Sabre/CardDAV/Backend/PDOSqliteTest.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php - -declare(strict_types=1); - -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 deleted file mode 100644 index 1de10b719..000000000 --- a/vendor/sabre/dav/tests/Sabre/CardDAV/CardTest.php +++ /dev/null @@ -1,194 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\CardDAV; - -class CardTest extends \PHPUnit\Framework\TestCase -{ - /** - * @var Sabre\CardDAV\Card - */ - protected $card; - /** - * @var Sabre\CardDAV\MockBackend - */ - protected $backend; - - public function setup(): void - { - $this->backend = new Backend\Mock(); - $this->card = new Card( - $this->backend, - [ - 'uri' => 'book1', - 'id' => 'foo', - 'principaluri' => 'principals/user1', - ], - [ - 'uri' => 'card1', - 'addressbookid' => 'foo', - 'carddata' => 'card', - ] - ); - } - - public function testGet() - { - $result = $this->card->get(); - $this->assertEquals('card', $result); - } - - public function testGet2() - { - $this->card = new Card( - $this->backend, - [ - 'uri' => 'book1', - 'id' => 'foo', - 'principaluri' => 'principals/user1', - ], - [ - 'uri' => 'card1', - 'addressbookid' => 'foo', - ] - ); - $result = $this->card->get(); - $this->assertEquals("BEGIN:VCARD\nVERSION:3.0\nUID:12345\nEND:VCARD", $result); - } - - /** - * @depends testGet - */ - 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); - } - - public function testDelete() - { - $this->card->delete(); - $this->assertEquals(1, count($this->backend->cards['foo'])); - } - - public function testGetContentType() - { - $this->assertEquals('text/vcard; charset=utf-8', $this->card->getContentType()); - } - - public function testGetETag() - { - $this->assertEquals('"'.md5('card').'"', $this->card->getETag()); - } - - public function testGetETag2() - { - $card = new Card( - $this->backend, - [ - 'uri' => 'book1', - 'id' => 'foo', - 'principaluri' => 'principals/user1', - ], - [ - 'uri' => 'card1', - 'addressbookid' => 'foo', - 'carddata' => 'card', - 'etag' => '"blabla"', - ] - ); - $this->assertEquals('"blabla"', $card->getETag()); - } - - public function testGetLastModified() - { - $this->assertEquals(null, $this->card->getLastModified()); - } - - public function testGetSize() - { - $this->assertEquals(4, $this->card->getSize()); - $this->assertEquals(4, $this->card->getSize()); - } - - public function testGetSize2() - { - $card = new Card( - $this->backend, - [ - 'uri' => 'book1', - 'id' => 'foo', - 'principaluri' => 'principals/user1', - ], - [ - 'uri' => 'card1', - 'addressbookid' => 'foo', - 'etag' => '"blabla"', - 'size' => 4, - ] - ); - $this->assertEquals(4, $card->getSize()); - } - - public function testACLMethods() - { - $this->assertEquals('principals/user1', $this->card->getOwner()); - $this->assertNull($this->card->getGroup()); - $this->assertEquals([ - [ - 'privilege' => '{DAV:}all', - 'principal' => 'principals/user1', - 'protected' => true, - ], - ], $this->card->getACL()); - } - - public function testOverrideACL() - { - $card = new Card( - $this->backend, - [ - 'uri' => 'book1', - 'id' => 'foo', - 'principaluri' => 'principals/user1', - ], - [ - 'uri' => 'card1', - 'addressbookid' => 'foo', - 'carddata' => 'card', - 'acl' => [ - [ - 'privilege' => '{DAV:}read', - 'principal' => 'principals/user1', - 'protected' => true, - ], - ], - ] - ); - $this->assertEquals([ - [ - 'privilege' => '{DAV:}read', - 'principal' => 'principals/user1', - 'protected' => true, - ], - ], $card->getACL()); - } - - public function testSetACL() - { - $this->expectException('Sabre\DAV\Exception\Forbidden'); - $this->card->setACL([]); - } - - 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 deleted file mode 100644 index 760749f6c..000000000 --- a/vendor/sabre/dav/tests/Sabre/CardDAV/IDirectoryTest.php +++ /dev/null @@ -1,28 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\CardDAV; - -use Sabre\DAV; - -class IDirectoryTest extends \PHPUnit\Framework\TestCase -{ - public function testResourceType() - { - $tree = [ - new DirectoryMock('directory'), - ]; - - $server = new DAV\Server($tree); - $plugin = new Plugin(); - $server->addPlugin($plugin); - - $props = $server->getProperties('directory', ['{DAV:}resourcetype']); - $this->assertTrue($props['{DAV:}resourcetype']->is('{'.Plugin::NS_CARDDAV.'}directory')); - } -} - -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 deleted file mode 100644 index ac0cd5e91..000000000 --- a/vendor/sabre/dav/tests/Sabre/CardDAV/MultiGetTest.php +++ /dev/null @@ -1,99 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\CardDAV; - -use Sabre\DAV; -use Sabre\HTTP; - -class MultiGetTest extends AbstractPluginTest -{ - public function testMultiGet() - { - $request = HTTP\Sapi::createFromServerArray([ - 'REQUEST_METHOD' => 'REPORT', - 'REQUEST_URI' => '/addressbooks/user1/book1', - ]); - - $request->setBody( -'<?xml version="1.0"?> -<c:addressbook-multiget xmlns:d="DAV:" xmlns:c="urn:ietf:params:xml:ns:carddav"> - <d:prop> - <d:getetag /> - <c:address-data /> - </d:prop> - <d:href>/addressbooks/user1/book1/card1</d:href> -</c:addressbook-multiget>' - ); - - $response = new HTTP\ResponseMock(); - - $this->server->httpRequest = $request; - $this->server->httpResponse = $response; - - $this->server->exec(); - - $bodyAsString = $response->getBodyAsString(); - $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:'.$bodyAsString); - - // using the client for parsing - $client = new DAV\Client(['baseUri' => '/']); - - $result = $client->parseMultiStatus($bodyAsString); - - $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' => "BEGIN:VCARD\nVERSION:3.0\nUID:12345\nEND:VCARD", - ], - ], - ], $result); - } - - public function testMultiGetVCard4() - { - $request = HTTP\Sapi::createFromServerArray([ - 'REQUEST_METHOD' => 'REPORT', - 'REQUEST_URI' => '/addressbooks/user1/book1', - ]); - - $request->setBody( -'<?xml version="1.0"?> -<c:addressbook-multiget xmlns:d="DAV:" xmlns:c="urn:ietf:params:xml:ns:carddav"> - <d:prop> - <d:getetag /> - <c:address-data content-type="text/vcard" version="4.0" /> - </d:prop> - <d:href>/addressbooks/user1/book1/card1</d:href> -</c:addressbook-multiget>' - ); - - $response = new HTTP\ResponseMock(); - - $this->server->httpRequest = $request; - $this->server->httpResponse = $response; - - $this->server->exec(); - - $bodyAsString = $response->getBodyAsString(); - $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:'.$bodyAsString); - - // using the client for parsing - $client = new DAV\Client(['baseUri' => '/']); - - $result = $client->parseMultiStatus($bodyAsString); - - $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").'"', - '{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 deleted file mode 100644 index b5a68dc48..000000000 --- a/vendor/sabre/dav/tests/Sabre/CardDAV/PluginTest.php +++ /dev/null @@ -1,101 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\CardDAV; - -use Sabre\DAV; - -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']); - } - - public function testSupportedReportSet() - { - $this->assertEquals([ - '{'.Plugin::NS_CARDDAV.'}addressbook-multiget', - '{'.Plugin::NS_CARDDAV.'}addressbook-query', - ], $this->plugin->getSupportedReportSet('addressbooks/user1/book1')); - } - - public function testSupportedReportSetEmpty() - { - $this->assertEquals([ - ], $this->plugin->getSupportedReportSet('')); - } - - 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()); - } - - 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()); - } - - public function testReportPassThrough() - { - $this->assertNull($this->plugin->report('{DAV:}foo', new \DomDocument(), '')); - } - - public function testHTMLActionsPanel() - { - $output = ''; - $r = $this->server->emit('onHTMLActionsPanel', [$this->server->tree->getNodeForPath('addressbooks/user1'), &$output]); - $this->assertFalse($r); - - $this->assertTrue((bool) strpos($output, 'Display name')); - } - - public function testAddressbookPluginProperties() - { - $ns = '{'.Plugin::NS_CARDDAV.'}'; - $propFind = new DAV\PropFind('addressbooks/user1/book1', [ - $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') - ); - $this->assertInstanceOf( - 'Sabre\\CardDAV\\Xml\\Property\\SupportedCollationSet', - $propFind->get($ns.'supported-collation-set') - ); - } - - 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 deleted file mode 100644 index 8d045569c..000000000 --- a/vendor/sabre/dav/tests/Sabre/CardDAV/SogoStripContentTypeTest.php +++ /dev/null @@ -1,67 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\CardDAV; - -use Sabre\DAV\PropFind; -use Sabre\HTTP; - -class SogoStripContentTypeTest extends \Sabre\DAVServerTest -{ - protected $setupCardDAV = true; - protected $carddavAddressBooks = [ - [ - 'id' => 1, - 'uri' => 'book1', - 'principaluri' => 'principals/user1', - ], - ]; - protected $carddavCards = [ - 1 => [ - 'card1.vcf' => "BEGIN:VCARD\nVERSION:3.0\nUID:12345\nEND:VCARD", - ], - ]; - - public function testDontStrip() - { - $result = $this->server->getProperties('addressbooks/user1/book1/card1.vcf', ['{DAV:}getcontenttype']); - $this->assertEquals([ - '{DAV:}getcontenttype' => 'text/vcard; charset=utf-8', - ], $result); - } - - 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', - ], $result); - } - - 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', - ]); - - $propFind = new PropFind('hello', ['{DAV:}getcontenttype']); - $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/VCFExportTest.php b/vendor/sabre/dav/tests/Sabre/CardDAV/VCFExportTest.php deleted file mode 100644 index 546a4ccfb..000000000 --- a/vendor/sabre/dav/tests/Sabre/CardDAV/VCFExportTest.php +++ /dev/null @@ -1,130 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\CardDAV; - -use Sabre\HTTP; - -class VCFExportTest extends \Sabre\DAVServerTest -{ - protected $setupCardDAV = true; - protected $autoLogin = 'user1'; - protected $setupACL = true; - - protected $carddavAddressBooks = [ - [ - '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", - ], - ]; - - public function setup(): void - { - parent::setUp(); - $plugin = new VCFExportPlugin(); - $this->server->addPlugin( - $plugin - ); - } - - public function testSimple() - { - $plugin = $this->server->getPlugin('vcf-export'); - $this->assertInstanceOf('Sabre\\CardDAV\\VCFExportPlugin', $plugin); - - $this->assertEquals( - 'vcf-export', - $plugin->getPluginInfo()['name'] - ); - } - - public function testExport() - { - $request = HTTP\Sapi::createFromServerArray([ - 'REQUEST_URI' => '/addressbooks/user1/book1?export', - 'QUERY_STRING' => 'export', - 'REQUEST_METHOD' => 'GET', - ]); - - $response = $this->request($request); - $this->assertEquals(200, $response->status, $response->getBodyAsString()); - - $expected = 'BEGIN:VCARD -FN:Person1 -END:VCARD -BEGIN:VCARD -FN:Person2 -END:VCARD -BEGIN:VCARD -FN:Person3 -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->getBodyAsString()); - } - - public function testBrowserIntegration() - { - $plugin = $this->server->getPlugin('vcf-export'); - $actions = ''; - $addressbook = new AddressBook($this->carddavBackend, []); - $this->server->emit('browserButtonActions', ['/foo', $addressbook, &$actions]); - $this->assertStringContainsString('/foo?export', $actions); - } - - public function testContentDisposition() - { - $request = new HTTP\Request( - 'GET', - '/addressbooks/user1/book1?export' - ); - - $response = $this->request($request, 200); - $this->assertEquals('text/directory', $response->getHeader('Content-Type')); - $this->assertEquals( - 'attachment; filename="book1-'.date('Y-m-d').'.vcf"', - $response->getHeader('Content-Disposition') - ); - } - - public function testContentDispositionBadChars() - { - $this->carddavBackend->createAddressBook( - 'principals/user1', - 'book-b_ad"(ch)ars', - [] - ); - $this->carddavBackend->createCard( - 'book-b_ad"(ch)ars', - 'card1', - "BEGIN:VCARD\r\nFN:Person1\r\nEND:VCARD\r\n" - ); - - $request = new HTTP\Request( - 'GET', - '/addressbooks/user1/book-b_ad"(ch)ars?export' - ); - - $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"', - $response->getHeader('Content-Disposition') - ); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/CardDAV/ValidateFilterTest.php b/vendor/sabre/dav/tests/Sabre/CardDAV/ValidateFilterTest.php deleted file mode 100644 index de7de19cd..000000000 --- a/vendor/sabre/dav/tests/Sabre/CardDAV/ValidateFilterTest.php +++ /dev/null @@ -1,204 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\CardDAV; - -class ValidateFilterTest extends AbstractPluginTest -{ - /** - * @param string $input - * @param array $filters - * @param string $test - * @param bool $result - * @param string|null $message - * @dataProvider data - */ - public function testFilter($input, $filters, $test, $result, $message = '') - { - if ($result) { - $this->assertTrue($this->plugin->validateFilters($input, $filters, $test), $message); - } else { - $this->assertFalse($this->plugin->validateFilters($input, $filters, $test), $message); - } - } - - public function data() - { - $body1 = <<<HELLO -BEGIN:VCARD -VERSION:3.0 -ORG:Company; -TITLE:Title -TEL;TYPE=IPHONE;TYPE=pref:(222) 22 22 22 -TEL;TYPE=HOME:(33) 333 66 66 -TEL;TYPE=WORK:(444) 44 44 44 -TEL;TYPE=MAIN:(55) 555 55 55 -ITEM4.TEL:(111) 11 11 11 -ITEM5.TEL:(6) 66 66 66 66 -ITEM6.TEL:(77) 777 77 77 -UID:3151DE6A-BC35-4612-B340-B53A034A2B27 -ITEM1.EMAIL:1111@111.com -ITEM2.EMAIL:bbbbb@bbbb.com -ITEM3.EMAIL:ccccc@ccccc.com -FN:First Last -N:Last;First;Middle;Dr -BDAY:1985-07-20 -ADR;TYPE=HOME:;;Street;City;;3556;Montenegro -ADR;TYPE=WORK:;;Street\\nStreet2;Harkema;;35444;Australia -URL:http://google.com -END:VCARD -HELLO; - - // Check if TITLE is defined - $filter1 = - ['name' => 'title', 'is-not-defined' => false, 'param-filters' => [], 'text-matches' => []]; - - // Check if FOO is defined - $filter2 = - ['name' => 'foo', 'is-not-defined' => false, 'param-filters' => [], 'text-matches' => []]; - - // Check if TITLE is not defined - $filter3 = - ['name' => 'title', 'is-not-defined' => true, 'param-filters' => [], 'text-matches' => []]; - - // Check if FOO is not defined - $filter4 = - ['name' => 'foo', 'is-not-defined' => true, 'param-filters' => [], 'text-matches' => []]; - - // Check if TEL[TYPE] is defined - $filter5 = - [ - 'name' => 'tel', - 'is-not-defined' => false, - 'test' => 'anyof', - 'param-filters' => [ - [ - 'name' => 'type', - 'is-not-defined' => false, - 'text-match' => null, - ], - ], - 'text-matches' => [], - ]; - - // Check if TEL[FOO] is defined - $filter6 = $filter5; - $filter6['param-filters'][0]['name'] = 'FOO'; - - // Check if TEL[TYPE] is not defined - $filter7 = $filter5; - $filter7['param-filters'][0]['is-not-defined'] = true; - - // Check if TEL[FOO] is not defined - $filter8 = $filter5; - $filter8['param-filters'][0]['name'] = 'FOO'; - $filter8['param-filters'][0]['is-not-defined'] = true; - - // Combining property filters - $filter9 = $filter5; - $filter9['param-filters'][] = $filter6['param-filters'][0]; - - $filter10 = $filter5; - $filter10['param-filters'][] = $filter6['param-filters'][0]; - $filter10['test'] = 'allof'; - - // Check if URL contains 'google' - $filter11 = - [ - 'name' => 'url', - 'is-not-defined' => false, - 'test' => 'anyof', - 'param-filters' => [], - 'text-matches' => [ - [ - 'match-type' => 'contains', - 'value' => 'google', - 'negate-condition' => false, - 'collation' => 'i;octet', - ], - ], - ]; - - // Check if URL contains 'bing' - $filter12 = $filter11; - $filter12['text-matches'][0]['value'] = 'bing'; - - // Check if URL does not contain 'google' - $filter13 = $filter11; - $filter13['text-matches'][0]['negate-condition'] = true; - - // Check if URL does not contain 'bing' - $filter14 = $filter11; - $filter14['text-matches'][0]['value'] = 'bing'; - $filter14['text-matches'][0]['negate-condition'] = true; - - // Param filter with text - $filter15 = $filter5; - $filter15['param-filters'][0]['text-match'] = [ - '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', - 'negate-condition' => false, - ]; - - $filter18 = $filter17; - $filter18['text-matches'][0]['negate-condition'] = true; - - $filter18['test'] = 'allof'; - - return [ - // Basic filters - [$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], - - // Basic parameters - [$body1, [$filter5], 'anyof', true, 'TEL;TYPE is defined, so this should return true'], - [$body1, [$filter6], 'anyof', false, 'TEL;FOO is not defined, so this should return false'], - - [$body1, [$filter7], 'anyof', false, 'TEL;TYPE is defined, so this should return false'], - [$body1, [$filter8], 'anyof', true, 'TEL;TYPE is not defined, so this should return true'], - - // Combined parameters - [$body1, [$filter9], 'anyof', true], - [$body1, [$filter10], 'anyof', false], - - // Text-filters - [$body1, [$filter11], 'anyof', true], - [$body1, [$filter12], 'anyof', false], - [$body1, [$filter13], 'anyof', false], - [$body1, [$filter14], 'anyof', true], - - // Param filter with text-match - [$body1, [$filter15], 'anyof', true], - [$body1, [$filter16], 'anyof', false], - - // Param filter + text filter - [$body1, [$filter17], 'anyof', true], - [$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 deleted file mode 100644 index 571cce3f0..000000000 --- a/vendor/sabre/dav/tests/Sabre/CardDAV/ValidateVCardTest.php +++ /dev/null @@ -1,293 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\CardDAV; - -use Sabre\DAV; -use Sabre\DAVACL; -use Sabre\HTTP; - -class ValidateVCardTest extends \PHPUnit\Framework\TestCase -{ - protected $server; - protected $cardBackend; - - public function setup(): void - { - $addressbooks = [ - [ - 'id' => 'addressbook1', - 'principaluri' => 'principals/admin', - 'uri' => 'addressbook1', - ], - ]; - - $this->cardBackend = new Backend\Mock($addressbooks, []); - $principalBackend = new DAVACL\PrincipalBackend\Mock(); - - $tree = [ - new AddressBookRoot($principalBackend, $this->cardBackend), - ]; - - $this->server = new DAV\Server($tree); - $this->server->sapi = new HTTP\SapiMock(); - $this->server->debugExceptions = true; - - $plugin = new Plugin(); - $this->server->addPlugin($plugin); - - $response = new HTTP\ResponseMock(); - $this->server->httpResponse = $response; - } - - 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(); - } - $this->assertEquals( - $expectedStatus, - $realStatus, - $msg - ); - } - - return $this->server->httpResponse; - } - - public function testCreateFile() - { - $request = HTTP\Sapi::createFromServerArray([ - 'REQUEST_METHOD' => 'PUT', - 'REQUEST_URI' => '/addressbooks/admin/addressbook1/blabla.vcf', - ]); - - $response = $this->request($request); - - $this->assertEquals(415, $response->status); - } - - public function testCreateFileValid() - { - $request = new HTTP\Request( - 'PUT', - '/addressbooks/admin/addressbook1/blabla.vcf' - ); - - $vcard = <<<VCF -BEGIN:VCARD -VERSION:4.0 -UID:foo -FN:Firstname LastName -N:LastName;FirstName;;; -END:VCARD -VCF; - $request->setBody($vcard); - - $response = $this->request($request, 201); - - // The custom Ew header should not be set - $this->assertNull( - $response->getHeader('X-Sabre-Ew-Gross') - ); - // Valid, non-auto-fixed responses should contain an ETag. - $this->assertTrue( - null !== $response->getHeader('ETag'), - 'We did not receive an etag' - ); - - $expected = [ - 'uri' => 'blabla.vcf', - 'carddata' => $vcard, - 'size' => strlen($vcard), - 'etag' => '"'.md5($vcard).'"', - ]; - - $this->assertEquals($expected, $this->cardBackend->getCard('addressbook1', 'blabla.vcf')); - } - - /** - * This test creates an intentionally broken vCard that vobject is able - * to automatically repair. - * - * @depends testCreateFileValid - */ - public function testCreateVCardAutoFix() - { - $request = new HTTP\Request( - 'PUT', - '/addressbooks/admin/addressbook1/blabla.vcf' - ); - - // The error in this vcard is that there's not enough semi-colons in N - $vcard = <<<VCF -BEGIN:VCARD -VERSION:4.0 -UID:foo -FN:Firstname LastName -N:LastName;FirstName;; -END:VCARD -VCF; - - $request->setBody($vcard); - - $response = $this->request($request, 201); - - // Auto-fixed vcards should NOT return an etag - $this->assertNull( - $response->getHeader('ETag') - ); - - // We should have gotten an Ew header - $this->assertNotNull( - $response->getHeader('X-Sabre-Ew-Gross') - ); - - $expectedVCard = <<<VCF -BEGIN:VCARD\r -VERSION:4.0\r -UID:foo\r -FN:Firstname LastName\r -N:LastName;FirstName;;;\r -END:VCARD\r - -VCF; - - $expected = [ - 'uri' => 'blabla.vcf', - 'carddata' => $expectedVCard, - 'size' => strlen($expectedVCard), - 'etag' => '"'.md5($expectedVCard).'"', - ]; - - $this->assertEquals($expected, $this->cardBackend->getCard('addressbook1', 'blabla.vcf')); - } - - /** - * This test creates an intentionally broken vCard that vobject is able - * to automatically repair. - * - * However, we're supplying a heading asking the server to treat the - * request as strict, so the server should still let the request fail. - * - * @depends testCreateFileValid - */ - public function testCreateVCardStrictFail() - { - $request = new HTTP\Request( - 'PUT', - '/addressbooks/admin/addressbook1/blabla.vcf', - [ - 'Prefer' => 'handling=strict', - ] - ); - - // The error in this vcard is that there's not enough semi-colons in N - $vcard = <<<VCF -BEGIN:VCARD -VERSION:4.0 -UID:foo -FN:Firstname LastName -N:LastName;FirstName;; -END:VCARD -VCF; - - $request->setBody($vcard); - $this->request($request, 415); - } - - public function testCreateFileNoUID() - { - $request = new HTTP\Request( - 'PUT', - '/addressbooks/admin/addressbook1/blabla.vcf' - ); - $vcard = <<<VCF -BEGIN:VCARD -VERSION:4.0 -FN:Firstname LastName -N:LastName;FirstName;;; -END:VCARD -VCF; - $request->setBody($vcard); - - $response = $this->request($request, 201); - - $foo = $this->cardBackend->getCard('addressbook1', 'blabla.vcf'); - $this->assertTrue( - false !== strpos($foo['carddata'], 'UID'), - print_r($foo, true) - ); - } - - public function testCreateFileJson() - { - $request = new HTTP\Request( - 'PUT', - '/addressbooks/admin/addressbook1/blabla.vcf' - ); - $request->setBody('[ "vcard" , [ [ "VERSION", {}, "text", "4.0"], [ "UID" , {}, "text", "foo" ], [ "FN", {}, "text", "FirstName LastName"] ] ]'); - - $response = $this->request($request); - - $this->assertEquals(201, $response->status, 'Incorrect status returned! Full response body: '.$response->getBodyAsString()); - - $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']); - } - - public function testCreateFileVCalendar() - { - $request = HTTP\Sapi::createFromServerArray([ - 'REQUEST_METHOD' => 'PUT', - '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->getBodyAsString()); - } - - public function testUpdateFile() - { - $this->cardBackend->createCard('addressbook1', 'blabla.vcf', 'foo'); - $request = new HTTP\Request( - 'PUT', - '/addressbooks/admin/addressbook1/blabla.vcf' - ); - - $response = $this->request($request, 415); - } - - public function testUpdateFileParsableBody() - { - $this->cardBackend->createCard('addressbook1', 'blabla.vcf', 'foo'); - $request = new HTTP\Request( - 'PUT', - '/addressbooks/admin/addressbook1/blabla.vcf' - ); - - $body = "BEGIN:VCARD\r\nVERSION:4.0\r\nUID:foo\r\nFN:FirstName LastName\r\nEND:VCARD\r\n"; - $request->setBody($body); - - $response = $this->request($request, 204); - - $expected = [ - 'uri' => 'blabla.vcf', - 'carddata' => $body, - 'size' => strlen($body), - 'etag' => '"'.md5($body).'"', - ]; - - $this->assertEquals($expected, $this->cardBackend->getCard('addressbook1', 'blabla.vcf')); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAV/AbstractServer.php b/vendor/sabre/dav/tests/Sabre/DAV/AbstractServer.php deleted file mode 100644 index 49fedf062..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAV/AbstractServer.php +++ /dev/null @@ -1,62 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAV; - -use Sabre\HTTP; - -abstract class AbstractServer extends \PHPUnit\Framework\TestCase -{ - /** - * @var \Sabre\HTTP\ResponseMock - */ - protected $response; - protected $request; - /** - * @var \Sabre\DAV\Server - */ - protected $server; - protected $tempDir = SABRE_TEMPDIR; - - public function setup(): void - { - $this->response = new HTTP\ResponseMock(); - $this->server = new Server($this->getRootNode()); - $this->server->sapi = new HTTP\SapiMock(); - $this->server->httpResponse = $this->response; - $this->server->debugExceptions = true; - $this->deleteTree(SABRE_TEMPDIR, false); - file_put_contents(SABRE_TEMPDIR.'/test.txt', 'Test contents'); - mkdir(SABRE_TEMPDIR.'/dir'); - file_put_contents(SABRE_TEMPDIR.'/dir/child.txt', 'Child contents'); - } - - public function teardown(): void - { - $this->deleteTree(SABRE_TEMPDIR, false); - } - - protected function getRootNode() - { - return new FS\Directory(SABRE_TEMPDIR); - } - - private function deleteTree($path, $deleteRoot = true) - { - foreach (scandir($path) as $node) { - if ('.' == $node || '.svn' == $node || '..' == $node) { - continue; - } - $myPath = $path.'/'.$node; - if (is_file($myPath)) { - unlink($myPath); - } else { - $this->deleteTree($myPath); - } - } - if ($deleteRoot) { - rmdir($path); - } - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/AbstractBasicTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/AbstractBasicTest.php deleted file mode 100644 index ebc1e3f7b..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/AbstractBasicTest.php +++ /dev/null @@ -1,90 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAV\Auth\Backend; - -use Sabre\HTTP; - -class AbstractBasicTest extends \PHPUnit\Framework\TestCase -{ - public function testCheckNoHeaders() - { - $request = new HTTP\Request('GET', '/'); - $response = new HTTP\Response(); - - $backend = new AbstractBasicMock(); - - $this->assertFalse( - $backend->check($request, $response)[0] - ); - } - - public function testCheckUnknownUser() - { - $request = HTTP\Sapi::createFromServerArray([ - 'REQUEST_METHOD' => 'GET', - 'REQUEST_URI' => '/', - 'PHP_AUTH_USER' => 'username', - 'PHP_AUTH_PW' => 'wrongpassword', - ]); - $response = new HTTP\Response(); - - $backend = new AbstractBasicMock(); - - $this->assertFalse( - $backend->check($request, $response)[0] - ); - } - - public function testCheckSuccess() - { - $request = HTTP\Sapi::createFromServerArray([ - 'REQUEST_METHOD' => 'GET', - 'REQUEST_URI' => '/', - 'PHP_AUTH_USER' => 'username', - 'PHP_AUTH_PW' => 'password', - ]); - $response = new HTTP\Response(); - - $backend = new AbstractBasicMock(); - $this->assertEquals( - [true, 'principals/username'], - $backend->check($request, $response) - ); - } - - public function testRequireAuth() - { - $request = new HTTP\Request('GET', '/'); - $response = new HTTP\Response(); - - $backend = new AbstractBasicMock(); - $backend->setRealm('writing unittests on a saturday night'); - $backend->challenge($request, $response); - - $this->assertEquals( - 'Basic realm="writing unittests on a saturday night", charset="UTF-8"', - $response->getHeader('WWW-Authenticate') - ); - } -} - -class AbstractBasicMock extends AbstractBasic -{ - /** - * Validates a username and password. - * - * This method should return true or false depending on if login - * succeeded. - * - * @param string $username - * @param string $password - * - * @return bool - */ - public function validateUserPass($username, $password) - { - return 'username' == $username && 'password' == $password; - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/AbstractDigestTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/AbstractDigestTest.php deleted file mode 100644 index a751efdc2..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/AbstractDigestTest.php +++ /dev/null @@ -1,134 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAV\Auth\Backend; - -use Sabre\HTTP; - -class AbstractDigestTest extends \PHPUnit\Framework\TestCase -{ - public function testCheckNoHeaders() - { - $request = new HTTP\Request('GET', '/'); - $response = new HTTP\Response(); - - $backend = new AbstractDigestMock(); - $this->assertFalse( - $backend->check($request, $response)[0] - ); - } - - public function testCheckBadGetUserInfoResponse() - { - $header = 'username=null, realm=myRealm, nonce=12345, uri=/, response=HASH, opaque=1, qop=auth, nc=1, cnonce=1'; - $request = HTTP\Sapi::createFromServerArray([ - 'REQUEST_METHOD' => 'GET', - 'REQUEST_URI' => '/', - 'PHP_AUTH_DIGEST' => $header, - ]); - $response = new HTTP\Response(); - - $backend = new AbstractDigestMock(); - $this->assertFalse( - $backend->check($request, $response)[0] - ); - } - - public function testCheckBadGetUserInfoResponse2() - { - $this->expectException('Sabre\DAV\Exception'); - $header = 'username=array, realm=myRealm, nonce=12345, uri=/, response=HASH, opaque=1, qop=auth, nc=1, cnonce=1'; - $request = HTTP\Sapi::createFromServerArray([ - 'REQUEST_METHOD' => 'GET', - 'REQUEST_URI' => '/', - 'PHP_AUTH_DIGEST' => $header, - ]); - - $response = new HTTP\Response(); - - $backend = new AbstractDigestMock(); - $backend->check($request, $response); - } - - public function testCheckUnknownUser() - { - $header = 'username=false, realm=myRealm, nonce=12345, uri=/, response=HASH, opaque=1, qop=auth, nc=1, cnonce=1'; - $request = HTTP\Sapi::createFromServerArray([ - 'REQUEST_METHOD' => 'GET', - 'REQUEST_URI' => '/', - 'PHP_AUTH_DIGEST' => $header, - ]); - - $response = new HTTP\Response(); - - $backend = new AbstractDigestMock(); - $this->assertFalse( - $backend->check($request, $response)[0] - ); - } - - public function testCheckBadPassword() - { - $header = 'username=user, realm=myRealm, nonce=12345, uri=/, response=HASH, opaque=1, qop=auth, nc=1, cnonce=1'; - $request = HTTP\Sapi::createFromServerArray([ - 'REQUEST_METHOD' => 'PUT', - 'REQUEST_URI' => '/', - 'PHP_AUTH_DIGEST' => $header, - ]); - - $response = new HTTP\Response(); - - $backend = new AbstractDigestMock(); - $this->assertFalse( - $backend->check($request, $response)[0] - ); - } - - public function testCheck() - { - $digestHash = md5('HELLO:12345:1:1:auth:'.md5('GET:/')); - $header = 'username=user, realm=myRealm, nonce=12345, uri=/, response='.$digestHash.', opaque=1, qop=auth, nc=1, cnonce=1'; - $request = HTTP\Sapi::createFromServerArray([ - 'REQUEST_METHOD' => 'GET', - 'REQUEST_URI' => '/', - 'PHP_AUTH_DIGEST' => $header, - ]); - - $response = new HTTP\Response(); - - $backend = new AbstractDigestMock(); - $this->assertEquals( - [true, 'principals/user'], - $backend->check($request, $response) - ); - } - - public function testRequireAuth() - { - $request = new HTTP\Request('GET', '/'); - $response = new HTTP\Response(); - - $backend = new AbstractDigestMock(); - $backend->setRealm('writing unittests on a saturday night'); - $backend->challenge($request, $response); - - $this->assertStringStartsWith( - 'Digest realm="writing unittests on a saturday night"', - $response->getHeader('WWW-Authenticate') - ); - } -} - -class AbstractDigestMock extends AbstractDigest -{ - public function getDigestHash($realm, $userName) - { - switch ($userName) { - case 'null': return null; - case 'false': return false; - case 'array': return []; - case 'user': return 'HELLO'; - } - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/AbstractPDOTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/AbstractPDOTest.php deleted file mode 100644 index 8b874f884..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/AbstractPDOTest.php +++ /dev/null @@ -1,42 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAV\Auth\Backend; - -abstract class AbstractPDOTest extends \PHPUnit\Framework\TestCase -{ - use \Sabre\DAV\DbTestHelperTrait; - - public function setup(): void - { - $this->dropTables('users'); - $this->createSchema('users'); - - $this->getPDO()->query( - "INSERT INTO users (username,digesta1) VALUES ('user','hash')" - ); - } - - public function testConstruct() - { - $pdo = $this->getPDO(); - $backend = new PDO($pdo); - $this->assertTrue($backend instanceof PDO); - } - - /** - * @depends testConstruct - */ - public function testUserInfo() - { - $pdo = $this->getPDO(); - $backend = new PDO($pdo); - - $this->assertNull($backend->getDigestHash('realm', 'blabla')); - - $expected = 'hash'; - - $this->assertEquals($expected, $backend->getDigestHash('realm', 'user')); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/ApacheTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/ApacheTest.php deleted file mode 100644 index a0086518f..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/ApacheTest.php +++ /dev/null @@ -1,72 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAV\Auth\Backend; - -use Sabre\HTTP; - -class ApacheTest extends \PHPUnit\Framework\TestCase -{ - public function testConstruct() - { - $backend = new Apache(); - $this->assertInstanceOf('Sabre\DAV\Auth\Backend\Apache', $backend); - } - - public function testNoHeader() - { - $request = new HTTP\Request('GET', '/'); - $response = new HTTP\Response(); - $backend = new Apache(); - - $this->assertFalse( - $backend->check($request, $response)[0] - ); - } - - public function testRemoteUser() - { - $request = HTTP\Sapi::createFromServerArray([ - 'REQUEST_METHOD' => 'GET', - 'REQUEST_URI' => '/', - 'REMOTE_USER' => 'username', - ]); - $response = new HTTP\Response(); - $backend = new Apache(); - - $this->assertEquals( - [true, 'principals/username'], - $backend->check($request, $response) - ); - } - - public function testRedirectRemoteUser() - { - $request = HTTP\Sapi::createFromServerArray([ - 'REQUEST_METHOD' => 'GET', - 'REQUEST_URI' => '/', - 'REDIRECT_REMOTE_USER' => 'username', - ]); - $response = new HTTP\Response(); - $backend = new Apache(); - - $this->assertEquals( - [true, 'principals/username'], - $backend->check($request, $response) - ); - } - - public function testRequireAuth() - { - $request = new HTTP\Request('GET', '/'); - $response = new HTTP\Response(); - - $backend = new Apache(); - $backend->challenge($request, $response); - - $this->assertNull( - $response->getHeader('WWW-Authenticate') - ); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/FileTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/FileTest.php deleted file mode 100644 index 31a86f9ed..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/FileTest.php +++ /dev/null @@ -1,38 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAV\Auth\Backend; - -class FileTest extends \PHPUnit\Framework\TestCase -{ - public function teardown(): void - { - if (file_exists(SABRE_TEMPDIR.'/filebackend')) { - unlink(SABRE_TEMPDIR.'/filebackend'); - } - } - - public function testConstruct() - { - $file = new File(); - $this->assertTrue($file instanceof File); - } - - public function testLoadFileBroken() - { - $this->expectException('Sabre\DAV\Exception'); - file_put_contents(SABRE_TEMPDIR.'/backend', 'user:realm:hash'); - $file = new File(SABRE_TEMPDIR.'/backend'); - } - - public function testLoadFile() - { - file_put_contents(SABRE_TEMPDIR.'/backend', 'user:realm:'.md5('user:realm:password')); - $file = new File(); - $file->loadFile(SABRE_TEMPDIR.'/backend'); - - $this->assertFalse($file->getDigestHash('realm', 'blabla')); - $this->assertEquals(md5('user:realm:password'), $file->getDigestHash('realm', 'user')); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/Mock.php b/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/Mock.php deleted file mode 100644 index fca7f722f..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/Mock.php +++ /dev/null @@ -1,81 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAV\Auth\Backend; - -use Sabre\HTTP\RequestInterface; -use Sabre\HTTP\ResponseInterface; - -class Mock implements BackendInterface -{ - public $fail = false; - - public $invalidCheckResponse = false; - - public $principal = 'principals/admin'; - - public function setPrincipal($principal) - { - $this->principal = $principal; - } - - /** - * When this method is called, the backend must check if authentication was - * successful. - * - * The returned value must be one of the following - * - * [true, "principals/username"] - * [false, "reason for failure"] - * - * If authentication was successful, it's expected that the authentication - * backend returns a so-called principal url. - * - * Examples of a principal url: - * - * principals/admin - * principals/user1 - * principals/users/joe - * principals/uid/123457 - * - * If you don't use WebDAV ACL (RFC3744) we recommend that you simply - * return a string such as: - * - * principals/users/[username] - * - * @return array - */ - public function check(RequestInterface $request, ResponseInterface $response) - { - if ($this->invalidCheckResponse) { - return 'incorrect!'; - } - if ($this->fail) { - return [false, 'fail!']; - } - - return [true, $this->principal]; - } - - /** - * This method is called when a user could not be authenticated, and - * authentication was required for the current request. - * - * This gives you the oppurtunity to set authentication headers. The 401 - * status code will already be set. - * - * In this case of Basic Auth, this would for example mean that the - * following header needs to be set: - * - * $response->addHeader('WWW-Authenticate', 'Basic realm=SabreDAV'); - * - * Keep in mind that in the case of multiple authentication backends, other - * WWW-Authenticate headers may already have been set, and you'll want to - * append your own WWW-Authenticate header instead of overwriting the - * existing one. - */ - public function challenge(RequestInterface $request, ResponseInterface $response) - { - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/PDOMySQLTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/PDOMySQLTest.php deleted file mode 100644 index 6ad7906c4..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/PDOMySQLTest.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAV\Auth\Backend; - -class PDOMySQLTest extends AbstractPDOTest -{ - public $driver = 'mysql'; -} diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/PDOSqliteTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/PDOSqliteTest.php deleted file mode 100644 index b42b40eff..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/PDOSqliteTest.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAV\Auth\Backend; - -class PDOSqliteTest extends AbstractPDOTest -{ - public $driver = 'sqlite'; -} diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Auth/PluginTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Auth/PluginTest.php deleted file mode 100644 index f4810d524..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAV/Auth/PluginTest.php +++ /dev/null @@ -1,127 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAV\Auth; - -use Sabre\DAV; -use Sabre\HTTP; - -class PluginTest extends \PHPUnit\Framework\TestCase -{ - public function testInit() - { - $fakeServer = new DAV\Server(new DAV\SimpleCollection('bla')); - $plugin = new Plugin(new Backend\Mock()); - $this->assertTrue($plugin instanceof Plugin); - $fakeServer->addPlugin($plugin); - $this->assertEquals($plugin, $fakeServer->getPlugin('auth')); - $this->assertIsArray($plugin->getPluginInfo()); - } - - /** - * @depends testInit - */ - public function testAuthenticate() - { - $fakeServer = new DAV\Server(new DAV\SimpleCollection('bla')); - $plugin = new Plugin(new Backend\Mock()); - $fakeServer->addPlugin($plugin); - $this->assertTrue( - $fakeServer->emit('beforeMethod:GET', [new HTTP\Request('GET', '/'), new HTTP\Response()]) - ); - } - - /** - * @depends testInit - */ - public function testAuthenticateFail() - { - $this->expectException('Sabre\DAV\Exception\NotAuthenticated'); - $fakeServer = new DAV\Server(new DAV\SimpleCollection('bla')); - $backend = new Backend\Mock(); - $backend->fail = true; - - $plugin = new Plugin($backend); - $fakeServer->addPlugin($plugin); - $fakeServer->emit('beforeMethod:GET', [new HTTP\Request('GET', '/'), new HTTP\Response()]); - } - - /** - * @depends testAuthenticateFail - */ - public function testAuthenticateFailDontAutoRequire() - { - $fakeServer = new DAV\Server(new DAV\SimpleCollection('bla')); - $backend = new Backend\Mock(); - $backend->fail = true; - - $plugin = new Plugin($backend); - $plugin->autoRequireLogin = false; - $fakeServer->addPlugin($plugin); - $this->assertTrue( - $fakeServer->emit('beforeMethod:GET', [new HTTP\Request('GET', '/'), new HTTP\Response()]) - ); - $this->assertEquals(1, count($plugin->getLoginFailedReasons())); - } - - /** - * @depends testAuthenticate - */ - public function testMultipleBackend() - { - $fakeServer = new DAV\Server(new DAV\SimpleCollection('bla')); - $backend1 = new Backend\Mock(); - $backend2 = new Backend\Mock(); - $backend2->fail = true; - - $plugin = new Plugin(); - $plugin->addBackend($backend1); - $plugin->addBackend($backend2); - - $fakeServer->addPlugin($plugin); - $fakeServer->emit('beforeMethod:GET', [new HTTP\Request('GET', '/'), new HTTP\Response()]); - - $this->assertEquals('principals/admin', $plugin->getCurrentPrincipal()); - } - - /** - * @depends testInit - */ - public function testNoAuthBackend() - { - $this->expectException('Sabre\DAV\Exception'); - $fakeServer = new DAV\Server(new DAV\SimpleCollection('bla')); - - $plugin = new Plugin(); - $fakeServer->addPlugin($plugin); - $fakeServer->emit('beforeMethod:GET', [new HTTP\Request('GET', '/'), new HTTP\Response()]); - } - - /** - * @depends testInit - */ - public function testInvalidCheckResponse() - { - $this->expectException('Sabre\DAV\Exception'); - $fakeServer = new DAV\Server(new DAV\SimpleCollection('bla')); - $backend = new Backend\Mock(); - $backend->invalidCheckResponse = true; - - $plugin = new Plugin($backend); - $fakeServer->addPlugin($plugin); - $fakeServer->emit('beforeMethod:GET', [new HTTP\Request('GET', '/'), new HTTP\Response()]); - } - - /** - * @depends testAuthenticate - */ - public function testGetCurrentPrincipal() - { - $fakeServer = new DAV\Server(new DAV\SimpleCollection('bla')); - $plugin = new Plugin(new Backend\Mock()); - $fakeServer->addPlugin($plugin); - $fakeServer->emit('beforeMethod:GET', [new HTTP\Request('GET', '/'), new HTTP\Response()]); - $this->assertEquals('principals/admin', $plugin->getCurrentPrincipal()); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAV/BasicNodeTest.php b/vendor/sabre/dav/tests/Sabre/DAV/BasicNodeTest.php deleted file mode 100644 index e9a8eddad..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAV/BasicNodeTest.php +++ /dev/null @@ -1,124 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAV; - -class BasicNodeTest extends \PHPUnit\Framework\TestCase -{ - public function testPut() - { - $this->expectException('Sabre\DAV\Exception\Forbidden'); - $file = new FileMock(); - $file->put('hi'); - } - - public function testGet() - { - $this->expectException('Sabre\DAV\Exception\Forbidden'); - $file = new FileMock(); - $file->get(); - } - - public function testGetSize() - { - $file = new FileMock(); - $this->assertEquals(0, $file->getSize()); - } - - public function testGetETag() - { - $file = new FileMock(); - $this->assertNull($file->getETag()); - } - - public function testGetContentType() - { - $file = new FileMock(); - $this->assertNull($file->getContentType()); - } - - public function testDelete() - { - $this->expectException('Sabre\DAV\Exception\Forbidden'); - $file = new FileMock(); - $file->delete(); - } - - public function testSetName() - { - $this->expectException('Sabre\DAV\Exception\Forbidden'); - $file = new FileMock(); - $file->setName('hi'); - } - - public function testGetLastModified() - { - $file = new FileMock(); - // checking if lastmod is within the range of a few seconds - $lastMod = $file->getLastModified(); - $compareTime = ($lastMod + 1) - time(); - $this->assertTrue($compareTime < 3); - } - - public function testGetChild() - { - $dir = new DirectoryMock(); - $file = $dir->getChild('mockfile'); - $this->assertTrue($file instanceof FileMock); - } - - public function testChildExists() - { - $dir = new DirectoryMock(); - $this->assertTrue($dir->childExists('mockfile')); - } - - public function testChildExistsFalse() - { - $dir = new DirectoryMock(); - $this->assertFalse($dir->childExists('mockfile2')); - } - - public function testGetChild404() - { - $this->expectException('Sabre\DAV\Exception\NotFound'); - $dir = new DirectoryMock(); - $file = $dir->getChild('blabla'); - } - - public function testCreateFile() - { - $this->expectException('Sabre\DAV\Exception\Forbidden'); - $dir = new DirectoryMock(); - $dir->createFile('hello', 'data'); - } - - public function testCreateDirectory() - { - $this->expectException('Sabre\DAV\Exception\Forbidden'); - $dir = new DirectoryMock(); - $dir->createDirectory('hello'); - } -} - -class DirectoryMock extends Collection -{ - public function getName() - { - return 'mockdir'; - } - - public function getChildren() - { - return [new FileMock()]; - } -} - -class FileMock extends File -{ - public function getName() - { - return 'mockfile'; - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Browser/GuessContentTypeTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Browser/GuessContentTypeTest.php deleted file mode 100644 index cb4d3ce03..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAV/Browser/GuessContentTypeTest.php +++ /dev/null @@ -1,67 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAV\Browser; - -use Sabre\DAV; - -class GuessContentTypeTest extends DAV\AbstractServer -{ - public function setUp(): void - { - parent::setUp(); - \Sabre\TestUtil::clearTempDir(); - file_put_contents(SABRE_TEMPDIR.'/somefile.jpg', 'blabla'); - file_put_contents(SABRE_TEMPDIR.'/somefile.hoi', 'blabla'); - } - - public function tearDown(): void - { - \Sabre\TestUtil::clearTempDir(); - parent::tearDown(); - } - - public function testGetProperties() - { - $properties = [ - '{DAV:}getcontenttype', - ]; - $result = $this->server->getPropertiesForPath('/somefile.jpg', $properties); - $this->assertArrayHasKey(0, $result); - $this->assertArrayHasKey(404, $result[0]); - $this->assertArrayHasKey('{DAV:}getcontenttype', $result[0][404]); - } - - /** - * @depends testGetProperties - */ - public function testGetPropertiesPluginEnabled() - { - $this->server->addPlugin(new GuessContentType()); - $properties = [ - '{DAV:}getcontenttype', - ]; - $result = $this->server->getPropertiesForPath('/somefile.jpg', $properties); - $this->assertArrayHasKey(0, $result); - $this->assertArrayHasKey(200, $result[0], 'We received: '.print_r($result, true)); - $this->assertArrayHasKey('{DAV:}getcontenttype', $result[0][200]); - $this->assertEquals('image/jpeg', $result[0][200]['{DAV:}getcontenttype']); - } - - /** - * @depends testGetPropertiesPluginEnabled - */ - public function testGetPropertiesUnknown() - { - $this->server->addPlugin(new GuessContentType()); - $properties = [ - '{DAV:}getcontenttype', - ]; - $result = $this->server->getPropertiesForPath('/somefile.hoi', $properties); - $this->assertArrayHasKey(0, $result); - $this->assertArrayHasKey(200, $result[0]); - $this->assertArrayHasKey('{DAV:}getcontenttype', $result[0][200]); - $this->assertEquals('application/octet-stream', $result[0][200]['{DAV:}getcontenttype']); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Browser/MapGetToPropFindTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Browser/MapGetToPropFindTest.php deleted file mode 100644 index 00b2661ac..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAV/Browser/MapGetToPropFindTest.php +++ /dev/null @@ -1,40 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAV\Browser; - -use Sabre\DAV; -use Sabre\HTTP; - -class MapGetToPropFindTest extends DAV\AbstractServer -{ - public function setUp(): void - { - parent::setUp(); - $this->server->addPlugin(new MapGetToPropFind()); - } - - public function testCollectionGet() - { - $serverVars = [ - 'REQUEST_URI' => '/', - 'REQUEST_METHOD' => 'GET', - ]; - - $request = HTTP\Sapi::createFromServerArray($serverVars); - $request->setBody(''); - $this->server->httpRequest = ($request); - $this->server->exec(); - - $this->assertEquals(207, $this->response->status, 'Incorrect status response received. Full response body: '.$this->response->getBodyAsString()); - $this->assertEquals([ - 'X-Sabre-Version' => [DAV\Version::VERSION], - 'Content-Type' => ['application/xml; charset=utf-8'], - 'DAV' => ['1, 3, extended-mkcol'], - 'Vary' => ['Brief,Prefer'], - ], - $this->response->getHeaders() - ); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Browser/PluginTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Browser/PluginTest.php deleted file mode 100644 index a987525c0..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAV/Browser/PluginTest.php +++ /dev/null @@ -1,176 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAV\Browser; - -use Sabre\DAV; -use Sabre\HTTP; - -class PluginTest extends DAV\AbstractServer -{ - protected $plugin; - - public function setUp(): void - { - parent::setUp(); - $this->server->addPlugin($this->plugin = new Plugin()); - $this->server->tree->getNodeForPath('')->createDirectory('dir2'); - } - - public function testCollectionGet() - { - $request = new HTTP\Request('GET', '/dir'); - $this->server->httpRequest = $request; - $this->server->exec(); - - $this->assertEquals(200, $this->response->getStatus(), 'Incorrect status received. Full response body: '.$this->response->getBodyAsString()); - $this->assertEquals( - [ - 'X-Sabre-Version' => [DAV\Version::VERSION], - 'Content-Type' => ['text/html; charset=utf-8'], - 'Content-Security-Policy' => ["default-src 'none'; img-src 'self'; style-src 'self'; font-src 'self';"], - ], - $this->response->getHeaders() - ); - - $body = $this->response->getBodyAsString(); - $this->assertTrue(false !== strpos($body, '<title>dir'), $body); - $this->assertTrue(false !== strpos($body, '<a href="/dir/child.txt">')); - } - - /** - * Adding the If-None-Match should have 0 effect, but it threw an error. - */ - public function testCollectionGetIfNoneMatch() - { - $request = new HTTP\Request('GET', '/dir'); - $request->setHeader('If-None-Match', '"foo-bar"'); - $this->server->httpRequest = $request; - $this->server->exec(); - - $this->assertEquals(200, $this->response->getStatus(), 'Incorrect status received. Full response body: '.$this->response->getBodyAsString()); - $this->assertEquals( - [ - 'X-Sabre-Version' => [DAV\Version::VERSION], - 'Content-Type' => ['text/html; charset=utf-8'], - 'Content-Security-Policy' => ["default-src 'none'; img-src 'self'; style-src 'self'; font-src 'self';"], - ], - $this->response->getHeaders() - ); - - $body = $this->response->getBodyAsString(); - $this->assertTrue(false !== strpos($body, '<title>dir'), $body); - $this->assertTrue(false !== strpos($body, '<a href="/dir/child.txt">')); - } - - public function testCollectionGetRoot() - { - $request = new HTTP\Request('GET', '/'); - $this->server->httpRequest = ($request); - $this->server->exec(); - - $this->assertEquals(200, $this->response->status, 'Incorrect status received. Full response body: '.$this->response->getBodyAsString()); - $this->assertEquals( - [ - 'X-Sabre-Version' => [DAV\Version::VERSION], - 'Content-Type' => ['text/html; charset=utf-8'], - 'Content-Security-Policy' => ["default-src 'none'; img-src 'self'; style-src 'self'; font-src 'self';"], - ], - $this->response->getHeaders() - ); - - $body = $this->response->getBodyAsString(); - $this->assertTrue(false !== strpos($body, '<title>/'), $body); - $this->assertTrue(false !== strpos($body, '<a href="/dir/">')); - $this->assertTrue(false !== strpos($body, '<span class="btn disabled">')); - } - - public function testGETPassthru() - { - $request = new HTTP\Request('GET', '/random'); - $response = new HTTP\Response(); - $this->assertNull( - $this->plugin->httpGet($request, $response) - ); - } - - public function testPostOtherContentType() - { - $request = new HTTP\Request('POST', '/', ['Content-Type' => 'text/xml']); - $this->server->httpRequest = $request; - $this->server->exec(); - - $this->assertEquals(501, $this->response->status); - } - - public function testPostNoSabreAction() - { - $request = new HTTP\Request('POST', '/', ['Content-Type' => 'application/x-www-form-urlencoded']); - $request->setPostData([]); - $this->server->httpRequest = $request; - $this->server->exec(); - - $this->assertEquals(501, $this->response->status); - } - - public function testPostMkCol() - { - $serverVars = [ - 'REQUEST_URI' => '/', - 'REQUEST_METHOD' => 'POST', - 'CONTENT_TYPE' => 'application/x-www-form-urlencoded', - ]; - $postVars = [ - 'sabreAction' => 'mkcol', - 'name' => 'new_collection', - ]; - - $request = HTTP\Sapi::createFromServerArray($serverVars); - $request->setPostData($postVars); - $this->server->httpRequest = $request; - $this->server->exec(); - - $this->assertEquals(302, $this->response->status); - $this->assertEquals([ - 'X-Sabre-Version' => [DAV\Version::VERSION], - 'Location' => ['/'], - ], $this->response->getHeaders()); - - $this->assertTrue(is_dir(SABRE_TEMPDIR.'/new_collection')); - } - - public function testGetAsset() - { - $request = new HTTP\Request('GET', '/?sabreAction=asset&assetName=favicon.ico'); - $this->server->httpRequest = $request; - $this->server->exec(); - - $this->assertEquals(200, $this->response->getStatus(), 'Error: '.$this->response->getBodyAsString()); - $this->assertEquals([ - 'X-Sabre-Version' => [DAV\Version::VERSION], - 'Content-Type' => ['image/vnd.microsoft.icon'], - 'Content-Length' => ['4286'], - 'Cache-Control' => ['public, max-age=1209600'], - 'Content-Security-Policy' => ["default-src 'none'; img-src 'self'; style-src 'self'; font-src 'self';"], - ], $this->response->getHeaders()); - } - - public function testGetAsset404() - { - $request = new HTTP\Request('GET', '/?sabreAction=asset&assetName=flavicon.ico'); - $this->server->httpRequest = $request; - $this->server->exec(); - - $this->assertEquals(404, $this->response->getStatus(), 'Error: '.$this->response->getBodyAsString()); - } - - public function testGetAssetEscapeBasePath() - { - $request = new HTTP\Request('GET', '/?sabreAction=asset&assetName=./../assets/favicon.ico'); - $this->server->httpRequest = $request; - $this->server->exec(); - - $this->assertEquals(404, $this->response->getStatus(), 'Error: '.$this->response->getBodyAsString()); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAV/ClientMock.php b/vendor/sabre/dav/tests/Sabre/DAV/ClientMock.php deleted file mode 100644 index 7d787744a..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAV/ClientMock.php +++ /dev/null @@ -1,36 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAV; - -use Sabre\HTTP\RequestInterface; -use Sabre\HTTP\ResponseInterface; - -class ClientMock extends Client -{ - public $request; - public $response; - - public $url; - public $curlSettings; - - /** - * Just making this method public. - * - * @param string $url - * - * @return string - */ - public function getAbsoluteUrl($url) - { - return parent::getAbsoluteUrl($url); - } - - public function doRequest(RequestInterface $request): ResponseInterface - { - $this->request = $request; - - return $this->response; - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAV/ClientTest.php b/vendor/sabre/dav/tests/Sabre/DAV/ClientTest.php deleted file mode 100644 index 85a95c90e..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAV/ClientTest.php +++ /dev/null @@ -1,285 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAV; - -use Sabre\HTTP\Response; - -class ClientTest extends \PHPUnit\Framework\TestCase -{ - public function setup(): void - { - if (!function_exists('curl_init')) { - $this->markTestSkipped('CURL must be installed to test the client'); - } - } - - public function testConstruct() - { - $client = new ClientMock([ - 'baseUri' => '/', - ]); - $this->assertInstanceOf('Sabre\DAV\ClientMock', $client); - } - - public function testConstructNoBaseUri() - { - $this->expectException('InvalidArgumentException'); - $client = new ClientMock([]); - } - - public function testAuth() - { - $client = new ClientMock([ - 'baseUri' => '/', - 'userName' => 'foo', - 'password' => 'bar', - ]); - - $this->assertEquals('foo:bar', $client->curlSettings[CURLOPT_USERPWD]); - $this->assertEquals(CURLAUTH_BASIC | CURLAUTH_DIGEST, $client->curlSettings[CURLOPT_HTTPAUTH]); - } - - public function testBasicAuth() - { - $client = new ClientMock([ - 'baseUri' => '/', - 'userName' => 'foo', - 'password' => 'bar', - 'authType' => Client::AUTH_BASIC, - ]); - - $this->assertEquals('foo:bar', $client->curlSettings[CURLOPT_USERPWD]); - $this->assertEquals(CURLAUTH_BASIC, $client->curlSettings[CURLOPT_HTTPAUTH]); - } - - public function testDigestAuth() - { - $client = new ClientMock([ - 'baseUri' => '/', - 'userName' => 'foo', - 'password' => 'bar', - 'authType' => Client::AUTH_DIGEST, - ]); - - $this->assertEquals('foo:bar', $client->curlSettings[CURLOPT_USERPWD]); - $this->assertEquals(CURLAUTH_DIGEST, $client->curlSettings[CURLOPT_HTTPAUTH]); - } - - public function testNTLMAuth() - { - $client = new ClientMock([ - 'baseUri' => '/', - 'userName' => 'foo', - 'password' => 'bar', - 'authType' => Client::AUTH_NTLM, - ]); - - $this->assertEquals('foo:bar', $client->curlSettings[CURLOPT_USERPWD]); - $this->assertEquals(CURLAUTH_NTLM, $client->curlSettings[CURLOPT_HTTPAUTH]); - } - - public function testProxy() - { - $client = new ClientMock([ - 'baseUri' => '/', - 'proxy' => 'localhost:8888', - ]); - - $this->assertEquals('localhost:8888', $client->curlSettings[CURLOPT_PROXY]); - } - - public function testEncoding() - { - $client = new ClientMock([ - 'baseUri' => '/', - 'encoding' => Client::ENCODING_IDENTITY | Client::ENCODING_GZIP | Client::ENCODING_DEFLATE, - ]); - - $this->assertEquals('identity,deflate,gzip', $client->curlSettings[CURLOPT_ENCODING]); - } - - public function testPropFind() - { - $client = new ClientMock([ - 'baseUri' => '/', - ]); - - $responseBody = <<<XML -<?xml version="1.0"?> -<multistatus xmlns="DAV:"> - <response> - <href>/foo</href> - <propstat> - <prop> - <displayname>bar</displayname> - </prop> - <status>HTTP/1.1 200 OK</status> - </propstat> - </response> -</multistatus> -XML; - - $client->response = new Response(207, [], $responseBody); - $result = $client->propFind('foo', ['{DAV:}displayname', '{urn:zim}gir']); - - $this->assertEquals(['{DAV:}displayname' => 'bar'], $result); - - $request = $client->request; - $this->assertEquals('PROPFIND', $request->getMethod()); - $this->assertEquals('/foo', $request->getUrl()); - $this->assertEquals([ - 'Depth' => ['0'], - 'Content-Type' => ['application/xml'], - ], $request->getHeaders()); - } - - public function testPropFindError() - { - $this->expectException('Sabre\HTTP\ClientHttpException'); - $client = new ClientMock([ - 'baseUri' => '/', - ]); - - $client->response = new Response(405, []); - $client->propFind('foo', ['{DAV:}displayname', '{urn:zim}gir']); - } - - public function testPropFindDepth1() - { - $client = new ClientMock([ - 'baseUri' => '/', - ]); - - $responseBody = <<<XML -<?xml version="1.0"?> -<multistatus xmlns="DAV:"> - <response> - <href>/foo</href> - <propstat> - <prop> - <displayname>bar</displayname> - </prop> - <status>HTTP/1.1 200 OK</status> - </propstat> - </response> -</multistatus> -XML; - - $client->response = new Response(207, [], $responseBody); - $result = $client->propFind('foo', ['{DAV:}displayname', '{urn:zim}gir'], 1); - - $this->assertEquals([ - '/foo' => [ - '{DAV:}displayname' => 'bar', - ], - ], $result); - - $request = $client->request; - $this->assertEquals('PROPFIND', $request->getMethod()); - $this->assertEquals('/foo', $request->getUrl()); - $this->assertEquals([ - 'Depth' => ['1'], - 'Content-Type' => ['application/xml'], - ], $request->getHeaders()); - } - - public function testPropPatch() - { - $client = new ClientMock([ - 'baseUri' => '/', - ]); - - $responseBody = <<<XML -<?xml version="1.0"?> -<multistatus xmlns="DAV:"> - <response> - <href>/foo</href> - <propstat> - <prop> - <displayname>bar</displayname> - </prop> - <status>HTTP/1.1 200 OK</status> - </propstat> - </response> -</multistatus> -XML; - - $client->response = new Response(207, [], $responseBody); - $result = $client->propPatch('foo', ['{DAV:}displayname' => 'hi', '{urn:zim}gir' => null]); - $this->assertTrue($result); - $request = $client->request; - $this->assertEquals('PROPPATCH', $request->getMethod()); - $this->assertEquals('/foo', $request->getUrl()); - $this->assertEquals([ - 'Content-Type' => ['application/xml'], - ], $request->getHeaders()); - } - - /** - * @depends testPropPatch - */ - public function testPropPatchHTTPError() - { - $this->expectException('Sabre\HTTP\ClientHttpException'); - $client = new ClientMock([ - 'baseUri' => '/', - ]); - - $client->response = new Response(403, [], ''); - $client->propPatch('foo', ['{DAV:}displayname' => 'hi', '{urn:zim}gir' => null]); - } - - /** - * @depends testPropPatch - */ - public function testPropPatchMultiStatusError() - { - $this->expectException('Sabre\HTTP\ClientException'); - $client = new ClientMock([ - 'baseUri' => '/', - ]); - - $responseBody = <<<XML -<?xml version="1.0"?> -<multistatus xmlns="DAV:"> -<response> - <href>/foo</href> - <propstat> - <prop> - <displayname /> - </prop> - <status>HTTP/1.1 403 Forbidden</status> - </propstat> -</response> -</multistatus> -XML; - - $client->response = new Response(207, [], $responseBody); - $client->propPatch('foo', ['{DAV:}displayname' => 'hi', '{urn:zim}gir' => null]); - } - - public function testOPTIONS() - { - $client = new ClientMock([ - 'baseUri' => '/', - ]); - - $client->response = new Response(207, [ - 'DAV' => 'calendar-access, extended-mkcol', - ]); - $result = $client->options(); - - $this->assertEquals( - ['calendar-access', 'extended-mkcol'], - $result - ); - - $request = $client->request; - $this->assertEquals('OPTIONS', $request->getMethod()); - $this->assertEquals('/', $request->getUrl()); - $this->assertEquals([ - ], $request->getHeaders()); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Exception/LockedTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Exception/LockedTest.php deleted file mode 100644 index 5fc271587..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAV/Exception/LockedTest.php +++ /dev/null @@ -1,67 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAV\Exception; - -use DOMDocument; -use Sabre\DAV; - -class LockedTest extends \PHPUnit\Framework\TestCase -{ - public function testSerialize() - { - $dom = new DOMDocument('1.0'); - $dom->formatOutput = true; - $root = $dom->createElement('d:root'); - - $dom->appendChild($root); - $root->setAttribute('xmlns:d', 'DAV:'); - - $lockInfo = new DAV\Locks\LockInfo(); - $lockInfo->uri = '/foo'; - $locked = new Locked($lockInfo); - - $locked->serialize(new DAV\Server(), $root); - - $output = $dom->saveXML(); - - $expected = '<?xml version="1.0"?> -<d:root xmlns:d="DAV:"> - <d:lock-token-submitted xmlns:d="DAV:"> - <d:href>/foo</d:href> - </d:lock-token-submitted> -</d:root> -'; - - $this->assertEquals($expected, $output); - } - - public function testSerializeAmpersand() - { - $dom = new DOMDocument('1.0'); - $dom->formatOutput = true; - $root = $dom->createElement('d:root'); - - $dom->appendChild($root); - $root->setAttribute('xmlns:d', 'DAV:'); - - $lockInfo = new DAV\Locks\LockInfo(); - $lockInfo->uri = '/foo&bar'; - $locked = new Locked($lockInfo); - - $locked->serialize(new DAV\Server(), $root); - - $output = $dom->saveXML(); - - $expected = '<?xml version="1.0"?> -<d:root xmlns:d="DAV:"> - <d:lock-token-submitted xmlns:d="DAV:"> - <d:href>/foo&bar</d:href> - </d:lock-token-submitted> -</d:root> -'; - - $this->assertEquals($expected, $output); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Exception/PaymentRequiredTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Exception/PaymentRequiredTest.php deleted file mode 100644 index 42775a313..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAV/Exception/PaymentRequiredTest.php +++ /dev/null @@ -1,14 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAV\Exception; - -class PaymentRequiredTest extends \PHPUnit\Framework\TestCase -{ - public function testGetHTTPCode() - { - $ex = new PaymentRequired(); - $this->assertEquals(402, $ex->getHTTPCode()); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAV/ExceptionTest.php b/vendor/sabre/dav/tests/Sabre/DAV/ExceptionTest.php deleted file mode 100644 index 7237aea0d..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAV/ExceptionTest.php +++ /dev/null @@ -1,27 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAV; - -class ExceptionTest extends \PHPUnit\Framework\TestCase -{ - public function testStatus() - { - $e = new Exception(); - $this->assertEquals(500, $e->getHTTPCode()); - } - - public function testExceptionStatuses() - { - $c = [ - 'Sabre\\DAV\\Exception\\NotAuthenticated' => 401, - 'Sabre\\DAV\\Exception\\InsufficientStorage' => 507, - ]; - - foreach ($c as $class => $status) { - $obj = new $class(); - $this->assertEquals($status, $obj->getHTTPCode()); - } - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAV/FSExt/FileTest.php b/vendor/sabre/dav/tests/Sabre/DAV/FSExt/FileTest.php deleted file mode 100644 index 2b759e5d0..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAV/FSExt/FileTest.php +++ /dev/null @@ -1,99 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAV\FSExt; - -class FileTest extends \PHPUnit\Framework\TestCase -{ - public function setup(): void - { - file_put_contents(SABRE_TEMPDIR.'/file.txt', 'Contents'); - } - - public function teardown(): void - { - \Sabre\TestUtil::clearTempDir(); - } - - public function testPut() - { - $filename = SABRE_TEMPDIR.'/file.txt'; - $file = new File($filename); - $result = $file->put('New contents'); - - $this->assertEquals('New contents', file_get_contents(SABRE_TEMPDIR.'/file.txt')); - $this->assertEquals( - '"'. - sha1( - fileinode($filename). - filesize($filename). - filemtime($filename) - ).'"', - $result - ); - } - - public function testRange() - { - $file = new File(SABRE_TEMPDIR.'/file.txt'); - $file->put('0000000'); - $file->patch('111', 2, 3); - - $this->assertEquals('0001110', file_get_contents(SABRE_TEMPDIR.'/file.txt')); - } - - public function testRangeStream() - { - $stream = fopen('php://memory', 'r+'); - fwrite($stream, '222'); - rewind($stream); - - $file = new File(SABRE_TEMPDIR.'/file.txt'); - $file->put('0000000'); - $file->patch($stream, 2, 3); - - $this->assertEquals('0002220', file_get_contents(SABRE_TEMPDIR.'/file.txt')); - } - - public function testGet() - { - $file = new File(SABRE_TEMPDIR.'/file.txt'); - $this->assertEquals('Contents', stream_get_contents($file->get())); - } - - public function testDelete() - { - $file = new File(SABRE_TEMPDIR.'/file.txt'); - $file->delete(); - - $this->assertFalse(file_exists(SABRE_TEMPDIR.'/file.txt')); - } - - public function testGetETag() - { - $filename = SABRE_TEMPDIR.'/file.txt'; - $file = new File($filename); - $this->assertEquals( - '"'. - sha1( - fileinode($filename). - filesize($filename). - filemtime($filename) - ).'"', - $file->getETag() - ); - } - - public function testGetContentType() - { - $file = new File(SABRE_TEMPDIR.'/file.txt'); - $this->assertNull($file->getContentType()); - } - - public function testGetSize() - { - $file = new File(SABRE_TEMPDIR.'/file.txt'); - $this->assertEquals(8, $file->getSize()); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAV/FSExt/ServerTest.php b/vendor/sabre/dav/tests/Sabre/DAV/FSExt/ServerTest.php deleted file mode 100644 index 79ffb0186..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAV/FSExt/ServerTest.php +++ /dev/null @@ -1,252 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAV\FSExt; - -use Sabre\DAV; -use Sabre\HTTP; - -class ServerTest extends DAV\AbstractServer -{ - protected function getRootNode() - { - return new Directory($this->tempDir); - } - - public function testGet() - { - $request = new HTTP\Request('GET', '/test.txt'); - $filename = $this->tempDir.'/test.txt'; - $this->server->httpRequest = $request; - $this->server->exec(); - - $this->assertEquals(200, $this->response->getStatus(), 'Invalid status code received.'); - $this->assertEquals([ - 'X-Sabre-Version' => [DAV\Version::VERSION], - 'Content-Type' => ['application/octet-stream'], - 'Content-Length' => [13], - 'Last-Modified' => [HTTP\toDate(new \DateTime('@'.filemtime($filename)))], - 'ETag' => ['"'.sha1(fileinode($filename).filesize($filename).filemtime($filename)).'"'], - ], - $this->response->getHeaders() - ); - - $this->assertEquals('Test contents', $this->response->getBodyAsString()); - } - - public function testHEAD() - { - $request = new HTTP\Request('HEAD', '/test.txt'); - $filename = $this->tempDir.'/test.txt'; - $this->server->httpRequest = ($request); - $this->server->exec(); - - $this->assertEquals([ - 'X-Sabre-Version' => [DAV\Version::VERSION], - 'Content-Type' => ['application/octet-stream'], - 'Content-Length' => [13], - 'Last-Modified' => [HTTP\toDate(new \DateTime('@'.filemtime($this->tempDir.'/test.txt')))], - 'ETag' => ['"'.sha1(fileinode($filename).filesize($filename).filemtime($filename)).'"'], - ], - $this->response->getHeaders() - ); - - $this->assertEquals(200, $this->response->status); - $this->assertEquals('', $this->response->getBodyAsString()); - } - - public function testPut() - { - $request = new HTTP\Request('PUT', '/testput.txt'); - $filename = $this->tempDir.'/testput.txt'; - $request->setBody('Testing new file'); - $this->server->httpRequest = ($request); - $this->server->exec(); - - $this->assertEquals([ - 'X-Sabre-Version' => [DAV\Version::VERSION], - 'Content-Length' => ['0'], - 'ETag' => ['"'.sha1(fileinode($filename).filesize($filename).filemtime($filename)).'"'], - ], $this->response->getHeaders()); - - $this->assertEquals(201, $this->response->status); - $this->assertEquals('', $this->response->getBodyAsString()); - $this->assertEquals('Testing new file', file_get_contents($filename)); - } - - public function testPutAlreadyExists() - { - $request = new HTTP\Request('PUT', '/test.txt', ['If-None-Match' => '*']); - $request->setBody('Testing new file'); - $this->server->httpRequest = ($request); - $this->server->exec(); - - $this->assertEquals([ - 'X-Sabre-Version' => [DAV\Version::VERSION], - 'Content-Type' => ['application/xml; charset=utf-8'], - ], $this->response->getHeaders()); - - $this->assertEquals(412, $this->response->status); - $this->assertNotEquals('Testing new file', file_get_contents($this->tempDir.'/test.txt')); - } - - public function testMkcol() - { - $request = new HTTP\Request('MKCOL', '/testcol'); - $this->server->httpRequest = ($request); - $this->server->exec(); - - $this->assertEquals([ - 'X-Sabre-Version' => [DAV\Version::VERSION], - 'Content-Length' => ['0'], - ], $this->response->getHeaders()); - - $this->assertEquals(201, $this->response->status); - $this->assertEquals('', $this->response->getBodyAsString()); - $this->assertTrue(is_dir($this->tempDir.'/testcol')); - } - - public function testPutUpdate() - { - $request = new HTTP\Request('PUT', '/test.txt'); - $request->setBody('Testing updated file'); - $this->server->httpRequest = ($request); - $this->server->exec(); - - $this->assertEquals('0', $this->response->getHeader('Content-Length')); - - $this->assertEquals(204, $this->response->status); - $this->assertEquals('', $this->response->getBodyAsString()); - $this->assertEquals('Testing updated file', file_get_contents($this->tempDir.'/test.txt')); - } - - public function testDelete() - { - $request = new HTTP\Request('DELETE', '/test.txt'); - $this->server->httpRequest = ($request); - $this->server->exec(); - - $this->assertEquals([ - 'X-Sabre-Version' => [DAV\Version::VERSION], - 'Content-Length' => ['0'], - ], $this->response->getHeaders()); - - $this->assertEquals(204, $this->response->status); - $this->assertEquals('', $this->response->getBodyAsString()); - $this->assertFalse(file_exists($this->tempDir.'/test.txt')); - } - - public function testDeleteDirectory() - { - mkdir($this->tempDir.'/testcol'); - file_put_contents($this->tempDir.'/testcol/test.txt', 'Hi! I\'m a file with a short lifespan'); - - $request = new HTTP\Request('DELETE', '/testcol'); - $this->server->httpRequest = ($request); - $this->server->exec(); - - $this->assertEquals([ - 'X-Sabre-Version' => [DAV\Version::VERSION], - 'Content-Length' => ['0'], - ], $this->response->getHeaders()); - $this->assertEquals(204, $this->response->status); - $this->assertEquals('', $this->response->getBodyAsString()); - $this->assertFalse(file_exists($this->tempDir.'/testcol')); - } - - public function testOptions() - { - $request = new HTTP\Request('OPTIONS', '/'); - $this->server->httpRequest = ($request); - $this->server->exec(); - - $this->assertEquals([ - 'DAV' => ['1, 3, extended-mkcol'], - 'MS-Author-Via' => ['DAV'], - 'Allow' => ['OPTIONS, GET, HEAD, DELETE, PROPFIND, PUT, PROPPATCH, COPY, MOVE, REPORT'], - 'Accept-Ranges' => ['bytes'], - 'Content-Length' => ['0'], - 'X-Sabre-Version' => [DAV\Version::VERSION], - ], $this->response->getHeaders()); - - $this->assertEquals(200, $this->response->status); - $this->assertEquals('', $this->response->getBodyAsString()); - } - - public function testMove() - { - mkdir($this->tempDir.'/testcol'); - - $request = new HTTP\Request('MOVE', '/test.txt', ['Destination' => '/testcol/test2.txt']); - $this->server->httpRequest = ($request); - $this->server->exec(); - - $this->assertEquals(201, $this->response->status); - $this->assertEquals('', $this->response->getBodyAsString()); - - $this->assertEquals([ - 'Content-Length' => ['0'], - 'X-Sabre-Version' => [DAV\Version::VERSION], - ], $this->response->getHeaders()); - - $this->assertTrue( - is_file($this->tempDir.'/testcol/test2.txt') - ); - } - - /** - * This test checks if it's possible to move a non-FSExt collection into a - * FSExt collection. - * - * The moveInto function *should* ignore the object and let sabredav itself - * execute the slow move. - */ - public function testMoveOtherObject() - { - mkdir($this->tempDir.'/tree1'); - mkdir($this->tempDir.'/tree2'); - - $tree = new DAV\Tree(new DAV\SimpleCollection('root', [ - new DAV\FS\Directory($this->tempDir.'/tree1'), - new DAV\FSExt\Directory($this->tempDir.'/tree2'), - ])); - $this->server->tree = $tree; - - $request = new HTTP\Request('MOVE', '/tree1', ['Destination' => '/tree2/tree1']); - $this->server->httpRequest = ($request); - $this->server->exec(); - - $this->assertEquals(201, $this->response->status); - $this->assertEquals('', $this->response->getBodyAsString()); - - $this->assertEquals([ - 'Content-Length' => ['0'], - 'X-Sabre-Version' => [DAV\Version::VERSION], - ], $this->response->getHeaders()); - - $this->assertTrue( - is_dir($this->tempDir.'/tree2/tree1') - ); - } - - public function testCopy() - { - mkdir($this->tempDir.'/testcol'); - - $request = new HTTP\Request('COPY', '/test.txt', ['Destination' => '/testcol/test2.txt']); - $this->server->httpRequest = ($request); - $this->server->exec(); - - $this->assertEquals(201, $this->response->status); - $this->assertEquals('', $this->response->getBodyAsString()); - - $this->assertEquals([ - 'Content-Length' => ['0'], - 'X-Sabre-Version' => [DAV\Version::VERSION], - ], $this->response->getHeaders()); - - $this->assertTrue(is_file($this->tempDir.'/test.txt')); - $this->assertTrue(is_file($this->tempDir.'/testcol/test2.txt')); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAV/HTTPPreferParsingTest.php b/vendor/sabre/dav/tests/Sabre/DAV/HTTPPreferParsingTest.php deleted file mode 100644 index 7d6825612..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAV/HTTPPreferParsingTest.php +++ /dev/null @@ -1,175 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAV; - -use Sabre\HTTP; - -class HTTPPreferParsingTest extends \Sabre\DAVServerTest -{ - public function assertParseResult($input, $expected) - { - $httpRequest = new HTTP\Request('GET', '/foo', [ - 'Prefer' => $input, - ]); - - $server = new Server(); - $server->httpRequest = $httpRequest; - - $this->assertEquals( - $expected, - $server->getHTTPPrefer() - ); - } - - public function testParseSimple() - { - $this->assertParseResult( - 'return-asynch', - [ - 'respond-async' => true, - 'return' => null, - 'handling' => null, - 'wait' => null, - ] - ); - } - - public function testParseValue() - { - $this->assertParseResult( - 'wait=10', - [ - 'respond-async' => false, - 'return' => null, - 'handling' => null, - 'wait' => '10', - ] - ); - } - - public function testParseMultiple() - { - $this->assertParseResult( - 'return-minimal, strict,lenient', - [ - 'respond-async' => false, - 'return' => 'minimal', - 'handling' => 'lenient', - 'wait' => null, - ] - ); - } - - public function testParseWeirdValue() - { - $this->assertParseResult( - 'BOOOH', - [ - 'respond-async' => false, - 'return' => null, - 'handling' => null, - 'wait' => null, - 'boooh' => true, - ] - ); - } - - public function testBrief() - { - $httpRequest = new HTTP\Request('GET', '/foo', [ - 'Brief' => 't', - ]); - - $server = new Server(); - $server->httpRequest = $httpRequest; - - $this->assertEquals([ - 'respond-async' => false, - 'return' => 'minimal', - 'handling' => null, - 'wait' => null, - ], $server->getHTTPPrefer()); - } - - /** - * propfindMinimal. - */ - public function testpropfindMinimal() - { - $request = new HTTP\Request('PROPFIND', '/', [ - 'Prefer' => 'return-minimal', - ]); - $request->setBody(<<<BLA -<?xml version="1.0"?> -<d:propfind xmlns:d="DAV:"> - <d:prop> - <d:something /> - <d:resourcetype /> - </d:prop> -</d:propfind> -BLA - ); - - $response = $this->request($request); - - $body = $response->getBodyAsString(); - - $this->assertEquals(207, $response->getStatus(), $body); - - $this->assertTrue(false !== strpos($body, 'resourcetype'), $body); - $this->assertTrue(false === strpos($body, 'something'), $body); - } - - public function testproppatchMinimal() - { - $request = new HTTP\Request('PROPPATCH', '/', ['Prefer' => 'return-minimal']); - $request->setBody(<<<BLA -<?xml version="1.0"?> -<d:propertyupdate xmlns:d="DAV:"> - <d:set> - <d:prop> - <d:something>nope!</d:something> - </d:prop> - </d:set> -</d:propertyupdate> -BLA - ); - - $this->server->on('propPatch', function ($path, PropPatch $propPatch) { - $propPatch->handle('{DAV:}something', function ($props) { - return true; - }); - }); - - $response = $this->request($request); - - $this->assertEquals('', $response->getBodyAsString(), 'Expected empty body: '.$response->getBodyAsString()); - $this->assertEquals(204, $response->status); - } - - public function testproppatchMinimalError() - { - $request = new HTTP\Request('PROPPATCH', '/', ['Prefer' => 'return-minimal']); - $request->setBody(<<<BLA -<?xml version="1.0"?> -<d:propertyupdate xmlns:d="DAV:"> - <d:set> - <d:prop> - <d:something>nope!</d:something> - </d:prop> - </d:set> -</d:propertyupdate> -BLA - ); - - $response = $this->request($request); - - $body = $response->getBodyAsString(); - - $this->assertEquals(207, $response->status); - $this->assertTrue(false !== strpos($body, 'something')); - $this->assertTrue(false !== strpos($body, '403 Forbidden'), $body); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAV/HttpDeleteTest.php b/vendor/sabre/dav/tests/Sabre/DAV/HttpDeleteTest.php deleted file mode 100644 index f70febabd..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAV/HttpDeleteTest.php +++ /dev/null @@ -1,131 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAV; - -use Sabre\DAVServerTest; -use Sabre\HTTP; - -/** - * Tests related to the PUT request. - * - * @copyright Copyright (C) fruux GmbH (https://fruux.com/) - * @author Evert Pot (http://evertpot.com/) - * @license http://sabre.io/license/ Modified BSD License - */ -class HttpDeleteTest extends DAVServerTest -{ - /** - * Sets up the DAV tree. - */ - public function setUpTree() - { - $this->tree = new Mock\Collection('root', [ - 'file1' => 'foo', - 'dir' => [ - 'subfile' => 'bar', - 'subfile2' => 'baz', - ], - ]); - } - - /** - * A successful DELETE. - */ - public function testDelete() - { - $request = new HTTP\Request('DELETE', '/file1'); - - $response = $this->request($request); - - $this->assertEquals( - 204, - $response->getStatus(), - 'Incorrect status code. Response body: '.$response->getBodyAsString() - ); - - $this->assertEquals( - [ - 'X-Sabre-Version' => [Version::VERSION], - 'Content-Length' => ['0'], - ], - $response->getHeaders() - ); - } - - /** - * Deleting a Directory. - */ - public function testDeleteDirectory() - { - $request = new HTTP\Request('DELETE', '/dir'); - - $response = $this->request($request); - - $this->assertEquals( - 204, - $response->getStatus(), - 'Incorrect status code. Response body: '.$response->getBodyAsString() - ); - - $this->assertEquals( - [ - 'X-Sabre-Version' => [Version::VERSION], - 'Content-Length' => ['0'], - ], - $response->getHeaders() - ); - } - - /** - * DELETE on a node that does not exist. - */ - public function testDeleteNotFound() - { - $request = new HTTP\Request('DELETE', '/file2'); - $response = $this->request($request); - - $this->assertEquals( - 404, - $response->getStatus(), - 'Incorrect status code. Response body: '.$response->getBodyAsString() - ); - } - - /** - * DELETE with preconditions. - */ - public function testDeletePreconditions() - { - $request = new HTTP\Request('DELETE', '/file1', [ - 'If-Match' => '"'.md5('foo').'"', - ]); - - $response = $this->request($request); - - $this->assertEquals( - 204, - $response->getStatus(), - 'Incorrect status code. Response body: '.$response->getBodyAsString() - ); - } - - /** - * DELETE with incorrect preconditions. - */ - public function testDeletePreconditionsFailed() - { - $request = new HTTP\Request('DELETE', '/file1', [ - 'If-Match' => '"'.md5('bar').'"', - ]); - - $response = $this->request($request); - - $this->assertEquals( - 412, - $response->getStatus(), - 'Incorrect status code. Response body: '.$response->getBodyAsString() - ); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAV/HttpPutTest.php b/vendor/sabre/dav/tests/Sabre/DAV/HttpPutTest.php deleted file mode 100644 index 543ec652a..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAV/HttpPutTest.php +++ /dev/null @@ -1,354 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAV; - -use Sabre\DAVServerTest; -use Sabre\HTTP; - -/** - * Tests related to the PUT request. - * - * @copyright Copyright (C) fruux GmbH (https://fruux.com/) - * @author Evert Pot (http://evertpot.com/) - * @license http://sabre.io/license/ Modified BSD License - */ -class HttpPutTest extends DAVServerTest -{ - /** - * Sets up the DAV tree. - */ - public function setUpTree() - { - $this->tree = new Mock\Collection('root', [ - 'file1' => 'foo', - ]); - } - - /** - * A successful PUT of a new file. - */ - public function testPut() - { - $request = new HTTP\Request('PUT', '/file2', [], 'hello'); - - $response = $this->request($request); - - $this->assertEquals(201, $response->getStatus(), 'Incorrect status code received. Full response body:'.$response->getBodyAsString()); - - $this->assertEquals( - 'hello', - $this->server->tree->getNodeForPath('file2')->get() - ); - - $this->assertEquals( - [ - 'X-Sabre-Version' => [Version::VERSION], - 'Content-Length' => ['0'], - 'ETag' => ['"'.md5('hello').'"'], - ], - $response->getHeaders() - ); - } - - /** - * A successful PUT on an existing file. - * - * @depends testPut - */ - public function testPutExisting() - { - $request = new HTTP\Request('PUT', '/file1', [], 'bar'); - - $response = $this->request($request); - - $this->assertEquals(204, $response->getStatus()); - - $this->assertEquals( - 'bar', - $this->server->tree->getNodeForPath('file1')->get() - ); - - $this->assertEquals( - [ - 'X-Sabre-Version' => [Version::VERSION], - 'Content-Length' => ['0'], - 'ETag' => ['"'.md5('bar').'"'], - ], - $response->getHeaders() - ); - } - - /** - * PUT on existing file with If-Match: *. - * - * @depends testPutExisting - */ - public function testPutExistingIfMatchStar() - { - $request = new HTTP\Request( - 'PUT', - '/file1', - ['If-Match' => '*'], - 'hello' - ); - - $response = $this->request($request); - - $this->assertEquals(204, $response->getStatus()); - - $this->assertEquals( - 'hello', - $this->server->tree->getNodeForPath('file1')->get() - ); - - $this->assertEquals( - [ - 'X-Sabre-Version' => [Version::VERSION], - 'Content-Length' => ['0'], - 'ETag' => ['"'.md5('hello').'"'], - ], - $response->getHeaders() - ); - } - - /** - * PUT on existing file with If-Match: with a correct etag. - * - * @depends testPutExisting - */ - public function testPutExistingIfMatchCorrect() - { - $request = new HTTP\Request( - 'PUT', - '/file1', - ['If-Match' => '"'.md5('foo').'"'], - 'hello' - ); - - $response = $this->request($request); - - $this->assertEquals(204, $response->status); - - $this->assertEquals( - 'hello', - $this->server->tree->getNodeForPath('file1')->get() - ); - - $this->assertEquals( - [ - 'X-Sabre-Version' => [Version::VERSION], - 'Content-Length' => ['0'], - 'ETag' => ['"'.md5('hello').'"'], - ], - $response->getHeaders() - ); - } - - /** - * PUT with Content-Range should be rejected. - * - * @depends testPut - */ - public function testPutContentRange() - { - $request = new HTTP\Request( - 'PUT', - '/file2', - ['Content-Range' => 'bytes/100-200'], - 'hello' - ); - - $response = $this->request($request); - $this->assertEquals(400, $response->getStatus()); - } - - /** - * PUT on non-existing file with If-None-Match: * should work. - * - * @depends testPut - */ - public function testPutIfNoneMatchStar() - { - $request = new HTTP\Request( - 'PUT', - '/file2', - ['If-None-Match' => '*'], - 'hello' - ); - - $response = $this->request($request); - - $this->assertEquals(201, $response->getStatus()); - - $this->assertEquals( - 'hello', - $this->server->tree->getNodeForPath('file2')->get() - ); - - $this->assertEquals( - [ - 'X-Sabre-Version' => [Version::VERSION], - 'Content-Length' => ['0'], - 'ETag' => ['"'.md5('hello').'"'], - ], - $response->getHeaders() - ); - } - - /** - * PUT on non-existing file with If-Match: * should fail. - * - * @depends testPut - */ - public function testPutIfMatchStar() - { - $request = new HTTP\Request( - 'PUT', - '/file2', - ['If-Match' => '*'], - 'hello' - ); - - $response = $this->request($request); - - $this->assertEquals(412, $response->getStatus()); - } - - /** - * PUT on existing file with If-None-Match: * should fail. - * - * @depends testPut - */ - public function testPutExistingIfNoneMatchStar() - { - $request = new HTTP\Request( - 'PUT', - '/file1', - ['If-None-Match' => '*'], - 'hello' - ); - $request->setBody('hello'); - - $response = $this->request($request); - - $this->assertEquals(412, $response->getStatus()); - } - - /** - * PUT thats created in a non-collection should be rejected. - * - * @depends testPut - */ - public function testPutParentIsNotCollection() - { - $request = new HTTP\Request( - 'PUT', - '/file1/file2', - [], - 'hello' - ); - - $response = $this->request($request); - $this->assertEquals(409, $response->getStatus()); - } - - /** - * PUT thats created in a non-existent collection should be rejected. - * - * @depends testPut - */ - public function testPutParentCollectionDoesNotExist() - { - $request = new HTTP\Request( - 'PUT', - '/non-existent-collection/file2', - [], - 'hello' - ); - - $response = $this->request($request); - $this->assertEquals(409, $response->getStatus()); - } - - /** - * Finder may sometimes make a request, which gets its content-body - * stripped. We can't always prevent this from happening, but in some cases - * we can detected this and return an error instead. - * - * @depends testPut - */ - public function testFinderPutSuccess() - { - $request = new HTTP\Request( - 'PUT', - '/file2', - ['X-Expected-Entity-Length' => '5'], - 'hello' - ); - $response = $this->request($request); - - $this->assertEquals(201, $response->getStatus()); - - $this->assertEquals( - 'hello', - $this->server->tree->getNodeForPath('file2')->get() - ); - - $this->assertEquals( - [ - 'X-Sabre-Version' => [Version::VERSION], - 'Content-Length' => ['0'], - 'ETag' => ['"'.md5('hello').'"'], - ], - $response->getHeaders() - ); - } - - /** - * Same as the last one, but in this case we're mimicing a failed request. - * - * @depends testFinderPutSuccess - */ - public function testFinderPutFail() - { - $request = new HTTP\Request( - 'PUT', - '/file2', - ['X-Expected-Entity-Length' => '5'], - '' - ); - - $response = $this->request($request); - - $this->assertEquals(403, $response->getStatus()); - } - - /** - * Plugins can intercept PUT. We need to make sure that works. - * - * @depends testPut - */ - public function testPutIntercept() - { - $this->server->on('beforeBind', function ($uri) { - $this->server->httpResponse->setStatus(418); - - return false; - }); - - $request = new HTTP\Request('PUT', '/file2', [], 'hello'); - $response = $this->request($request); - - $this->assertEquals(418, $response->getStatus(), 'Incorrect status code received. Full response body: '.$response->getBodyAsString()); - - $this->assertFalse( - $this->server->tree->nodeExists('file2') - ); - - $this->assertEquals([ - 'X-Sabre-Version' => [Version::VERSION], - ], $response->getHeaders()); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Issue33Test.php b/vendor/sabre/dav/tests/Sabre/DAV/Issue33Test.php deleted file mode 100644 index 36b182c44..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAV/Issue33Test.php +++ /dev/null @@ -1,93 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAV; - -use Sabre\HTTP; - -class Issue33Test extends \PHPUnit\Framework\TestCase -{ - public function setup(): void - { - \Sabre\TestUtil::clearTempDir(); - } - - public function testCopyMoveInfo() - { - $bar = new SimpleCollection('bar'); - $root = new SimpleCollection('webdav', [$bar]); - - $server = new Server($root); - $server->setBaseUri('/webdav/'); - - $request = new HTTP\Request('GET', '/webdav/bar', [ - 'Destination' => 'http://dev2.tribalos.com/webdav/%C3%A0fo%C3%B3', - 'Overwrite' => 'F', - ]); - - $server->httpRequest = $request; - - $info = $server->getCopyAndMoveInfo($request); - - $this->assertEquals('%C3%A0fo%C3%B3', urlencode($info['destination'])); - $this->assertFalse($info['destinationExists']); - $this->assertFalse($info['destinationNode']); - } - - public function testTreeMove() - { - mkdir(SABRE_TEMPDIR.'/issue33'); - $dir = new FS\Directory(SABRE_TEMPDIR.'/issue33'); - - $dir->createDirectory('bar'); - - $tree = new Tree($dir); - $tree->move('bar', urldecode('%C3%A0fo%C3%B3')); - - $node = $tree->getNodeForPath(urldecode('%C3%A0fo%C3%B3')); - $this->assertEquals(urldecode('%C3%A0fo%C3%B3'), $node->getName()); - } - - public function testDirName() - { - $dirname1 = 'bar'; - $dirname2 = urlencode('%C3%A0fo%C3%B3'); - - $this->assertTrue(dirname($dirname1) == dirname($dirname2)); - } - - /** - * @depends testTreeMove - * @depends testCopyMoveInfo - */ - public function testEverything() - { - $request = new HTTP\Request('MOVE', '/webdav/bar', [ - 'Destination' => 'http://dev2.tribalos.com/webdav/%C3%A0fo%C3%B3', - 'Overwrite' => 'F', - ]); - - $request->setBody(''); - - $response = new HTTP\ResponseMock(); - - // Server setup - mkdir(SABRE_TEMPDIR.'/issue33'); - $dir = new FS\Directory(SABRE_TEMPDIR.'/issue33'); - - $dir->createDirectory('bar'); - - $tree = new Tree($dir); - - $server = new Server($tree); - $server->setBaseUri('/webdav/'); - - $server->httpRequest = $request; - $server->httpResponse = $response; - $server->sapi = new HTTP\SapiMock(); - $server->exec(); - - $this->assertTrue(file_exists(SABRE_TEMPDIR.'/issue33/'.urldecode('%C3%A0fo%C3%B3'))); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Locks/Backend/AbstractTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Locks/Backend/AbstractTest.php deleted file mode 100644 index d1cd1799c..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAV/Locks/Backend/AbstractTest.php +++ /dev/null @@ -1,189 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAV\Locks\Backend; - -use Sabre\DAV; - -abstract class AbstractTest extends \PHPUnit\Framework\TestCase -{ - /** - * @abstract - * - * @return AbstractBackend - */ - abstract public function getBackend(); - - public function testSetup() - { - $backend = $this->getBackend(); - $this->assertInstanceOf('Sabre\\DAV\\Locks\\Backend\\AbstractBackend', $backend); - } - - /** - * @depends testSetup - */ - public function testGetLocks() - { - $backend = $this->getBackend(); - - $lock = new DAV\Locks\LockInfo(); - $lock->owner = 'Sinterklaas'; - $lock->timeout = 60; - $lock->created = time(); - $lock->token = 'MY-UNIQUE-TOKEN'; - $lock->uri = 'someuri'; - - $this->assertTrue($backend->lock('someuri', $lock)); - - $locks = $backend->getLocks('someuri', false); - - $this->assertEquals(1, count($locks)); - $this->assertEquals('Sinterklaas', $locks[0]->owner); - $this->assertEquals('someuri', $locks[0]->uri); - } - - /** - * @depends testGetLocks - */ - public function testGetLocksParent() - { - $backend = $this->getBackend(); - - $lock = new DAV\Locks\LockInfo(); - $lock->owner = 'Sinterklaas'; - $lock->timeout = 60; - $lock->created = time(); - $lock->depth = DAV\Server::DEPTH_INFINITY; - $lock->token = 'MY-UNIQUE-TOKEN'; - - $this->assertTrue($backend->lock('someuri', $lock)); - - $locks = $backend->getLocks('someuri/child', false); - - $this->assertEquals(1, count($locks)); - $this->assertEquals('Sinterklaas', $locks[0]->owner); - $this->assertEquals('someuri', $locks[0]->uri); - } - - /** - * @depends testGetLocks - */ - public function testGetLocksParentDepth0() - { - $backend = $this->getBackend(); - - $lock = new DAV\Locks\LockInfo(); - $lock->owner = 'Sinterklaas'; - $lock->timeout = 60; - $lock->created = time(); - $lock->depth = 0; - $lock->token = 'MY-UNIQUE-TOKEN'; - - $this->assertTrue($backend->lock('someuri', $lock)); - - $locks = $backend->getLocks('someuri/child', false); - - $this->assertEquals(0, count($locks)); - } - - public function testGetLocksChildren() - { - $backend = $this->getBackend(); - - $lock = new DAV\Locks\LockInfo(); - $lock->owner = 'Sinterklaas'; - $lock->timeout = 60; - $lock->created = time(); - $lock->depth = 0; - $lock->token = 'MY-UNIQUE-TOKEN'; - - $this->assertTrue($backend->lock('someuri/child', $lock)); - - $locks = $backend->getLocks('someuri/child', false); - $this->assertEquals(1, count($locks)); - - $locks = $backend->getLocks('someuri', false); - $this->assertEquals(0, count($locks)); - - $locks = $backend->getLocks('someuri', true); - $this->assertEquals(1, count($locks)); - } - - /** - * @depends testGetLocks - */ - public function testLockRefresh() - { - $backend = $this->getBackend(); - - $lock = new DAV\Locks\LockInfo(); - $lock->owner = 'Sinterklaas'; - $lock->timeout = 60; - $lock->created = time(); - $lock->token = 'MY-UNIQUE-TOKEN'; - - $this->assertTrue($backend->lock('someuri', $lock)); - /* Second time */ - - $lock->owner = 'Santa Clause'; - $this->assertTrue($backend->lock('someuri', $lock)); - - $locks = $backend->getLocks('someuri', false); - - $this->assertEquals(1, count($locks)); - - $this->assertEquals('Santa Clause', $locks[0]->owner); - $this->assertEquals('someuri', $locks[0]->uri); - } - - /** - * @depends testGetLocks - */ - public function testUnlock() - { - $backend = $this->getBackend(); - - $lock = new DAV\Locks\LockInfo(); - $lock->owner = 'Sinterklaas'; - $lock->timeout = 60; - $lock->created = time(); - $lock->token = 'MY-UNIQUE-TOKEN'; - - $this->assertTrue($backend->lock('someuri', $lock)); - - $locks = $backend->getLocks('someuri', false); - $this->assertEquals(1, count($locks)); - - $this->assertTrue($backend->unlock('someuri', $lock)); - - $locks = $backend->getLocks('someuri', false); - $this->assertEquals(0, count($locks)); - } - - /** - * @depends testUnlock - */ - public function testUnlockUnknownToken() - { - $backend = $this->getBackend(); - - $lock = new DAV\Locks\LockInfo(); - $lock->owner = 'Sinterklaas'; - $lock->timeout = 60; - $lock->created = time(); - $lock->token = 'MY-UNIQUE-TOKEN'; - - $this->assertTrue($backend->lock('someuri', $lock)); - - $locks = $backend->getLocks('someuri', false); - $this->assertEquals(1, count($locks)); - - $lock->token = 'SOME-OTHER-TOKEN'; - $this->assertFalse($backend->unlock('someuri', $lock)); - - $locks = $backend->getLocks('someuri', false); - $this->assertEquals(1, count($locks)); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Locks/Backend/FileTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Locks/Backend/FileTest.php deleted file mode 100644 index 57a3255c7..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAV/Locks/Backend/FileTest.php +++ /dev/null @@ -1,21 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAV\Locks\Backend; - -class FileTest extends AbstractTest -{ - public function getBackend() - { - \Sabre\TestUtil::clearTempDir(); - $backend = new File(SABRE_TEMPDIR.'/lockdb'); - - return $backend; - } - - public function teardown(): void - { - \Sabre\TestUtil::clearTempDir(); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Locks/Backend/PDOMySQLTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Locks/Backend/PDOMySQLTest.php deleted file mode 100644 index 86ffc0bb3..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAV/Locks/Backend/PDOMySQLTest.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAV\Locks\Backend; - -class PDOMySQLTest extends PDOTest -{ - public $driver = 'mysql'; -} diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Locks/Backend/PDOTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Locks/Backend/PDOTest.php deleted file mode 100644 index f5ed98f50..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAV/Locks/Backend/PDOTest.php +++ /dev/null @@ -1,20 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAV\Locks\Backend; - -abstract class PDOTest extends AbstractTest -{ - use \Sabre\DAV\DbTestHelperTrait; - - public function getBackend() - { - $this->dropTables('locks'); - $this->createSchema('locks'); - - $pdo = $this->getPDO(); - - return new PDO($pdo); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Locks/MSWordTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Locks/MSWordTest.php deleted file mode 100644 index 02c3d39ba..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAV/Locks/MSWordTest.php +++ /dev/null @@ -1,119 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAV\Locks; - -use Sabre\DAV; -use Sabre\HTTP; - -class MSWordTest extends \PHPUnit\Framework\TestCase -{ - public function teardown(): void - { - \Sabre\TestUtil::clearTempDir(); - } - - public function testLockEtc() - { - mkdir(SABRE_TEMPDIR.'/mstest'); - $tree = new DAV\FS\Directory(SABRE_TEMPDIR.'/mstest'); - - $server = new DAV\Server($tree); - $server->debugExceptions = true; - $locksBackend = new Backend\File(SABRE_TEMPDIR.'/locksdb'); - $locksPlugin = new Plugin($locksBackend); - $server->addPlugin($locksPlugin); - - $response1 = new HTTP\ResponseMock(); - - $server->httpRequest = $this->getLockRequest(); - $server->httpResponse = $response1; - $server->sapi = new HTTP\SapiMock(); - $server->exec(); - - $this->assertEquals(201, $server->httpResponse->getStatus(), 'Full response body:'.$response1->getBodyAsString()); - $this->assertTrue((bool) $server->httpResponse->getHeaders('Lock-Token')); - $lockToken = $server->httpResponse->getHeader('Lock-Token'); - - //sleep(10); - - $response2 = new HTTP\ResponseMock(); - - $server->httpRequest = $this->getLockRequest2(); - $server->httpResponse = $response2; - $server->exec(); - - $this->assertEquals(201, $server->httpResponse->status); - $this->assertTrue((bool) $server->httpResponse->getHeaders('Lock-Token')); - - //sleep(10); - - $response3 = new HTTP\ResponseMock(); - $server->httpRequest = $this->getPutRequest($lockToken); - $server->httpResponse = $response3; - $server->exec(); - - $this->assertEquals(204, $server->httpResponse->status); - } - - public function getLockRequest() - { - $request = HTTP\Sapi::createFromServerArray([ - 'REQUEST_METHOD' => 'LOCK', - 'HTTP_CONTENT_TYPE' => 'application/xml', - 'HTTP_TIMEOUT' => 'Second-3600', - 'REQUEST_URI' => '/Nouveau%20Microsoft%20Office%20Excel%20Worksheet.xlsx', - ]); - - $request->setBody('<D:lockinfo xmlns:D="DAV:"> - <D:lockscope> - <D:exclusive /> - </D:lockscope> - <D:locktype> - <D:write /> - </D:locktype> - <D:owner> - <D:href>PC-Vista\User</D:href> - </D:owner> -</D:lockinfo>'); - - return $request; - } - - public function getLockRequest2() - { - $request = HTTP\Sapi::createFromServerArray([ - 'REQUEST_METHOD' => 'LOCK', - 'HTTP_CONTENT_TYPE' => 'application/xml', - 'HTTP_TIMEOUT' => 'Second-3600', - 'REQUEST_URI' => '/~$Nouveau%20Microsoft%20Office%20Excel%20Worksheet.xlsx', - ]); - - $request->setBody('<D:lockinfo xmlns:D="DAV:"> - <D:lockscope> - <D:exclusive /> - </D:lockscope> - <D:locktype> - <D:write /> - </D:locktype> - <D:owner> - <D:href>PC-Vista\User</D:href> - </D:owner> -</D:lockinfo>'); - - return $request; - } - - public function getPutRequest($lockToken) - { - $request = HTTP\Sapi::createFromServerArray([ - 'REQUEST_METHOD' => 'PUT', - 'REQUEST_URI' => '/Nouveau%20Microsoft%20Office%20Excel%20Worksheet.xlsx', - 'HTTP_IF' => 'If: ('.$lockToken.')', - ]); - $request->setBody('FAKE BODY'); - - return $request; - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Locks/PluginTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Locks/PluginTest.php deleted file mode 100644 index 9279afb5a..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAV/Locks/PluginTest.php +++ /dev/null @@ -1,886 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAV\Locks; - -use Sabre\DAV; -use Sabre\HTTP; - -class PluginTest extends DAV\AbstractServer -{ - /** - * @var Plugin - */ - protected $locksPlugin; - - public function setup(): void - { - parent::setUp(); - $locksBackend = new Backend\File(SABRE_TEMPDIR.'/locksdb'); - $locksPlugin = new Plugin($locksBackend); - $this->server->addPlugin($locksPlugin); - $this->locksPlugin = $locksPlugin; - } - - public function testGetInfo() - { - $this->assertArrayHasKey( - 'name', - $this->locksPlugin->getPluginInfo() - ); - } - - public function testGetFeatures() - { - $this->assertEquals([2], $this->locksPlugin->getFeatures()); - } - - public function testGetHTTPMethods() - { - $this->assertEquals(['LOCK', 'UNLOCK'], $this->locksPlugin->getHTTPMethods('')); - } - - public function testLockNoBody() - { - $request = new HTTP\Request('LOCK', '/test.txt'); - $this->server->httpRequest = $request; - $this->server->exec(); - - $this->assertEquals([ - 'X-Sabre-Version' => [DAV\Version::VERSION], - 'Content-Type' => ['application/xml; charset=utf-8'], - ], - $this->response->getHeaders() - ); - - $this->assertEquals(400, $this->response->status); - } - - public function testLock() - { - $request = new HTTP\Request('LOCK', '/test.txt'); - $request->setBody('<?xml version="1.0"?> -<D:lockinfo xmlns:D="DAV:"> - <D:lockscope><D:exclusive/></D:lockscope> - <D:locktype><D:write/></D:locktype> - <D:owner> - <D:href>http://example.org/~ejw/contact.html</D:href> - </D:owner> -</D:lockinfo>'); - - $this->server->httpRequest = $request; - $this->server->exec(); - - $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); - $this->assertTrue(1 === preg_match('/^<opaquelocktoken:(.*)>$/', $this->response->getHeader('Lock-Token')), 'We did not get a valid Locktoken back ('.$this->response->getHeader('Lock-Token').')'); - - $this->assertEquals(200, $this->response->status, 'Got an incorrect status back. Response body: '.$this->response->getBodyAsString()); - - $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/", 'xmlns\\1="urn:DAV"', $this->response->getBodyAsString()); - $xml = simplexml_load_string($body); - $xml->registerXPathNamespace('d', 'urn:DAV'); - - $elements = [ - '/d:prop', - '/d:prop/d:lockdiscovery', - '/d:prop/d:lockdiscovery/d:activelock', - '/d:prop/d:lockdiscovery/d:activelock/d:locktype', - '/d:prop/d:lockdiscovery/d:activelock/d:lockroot', - '/d:prop/d:lockdiscovery/d:activelock/d:lockroot/d:href', - '/d:prop/d:lockdiscovery/d:activelock/d:locktype/d:write', - '/d:prop/d:lockdiscovery/d:activelock/d:lockscope', - '/d:prop/d:lockdiscovery/d:activelock/d:lockscope/d:exclusive', - '/d:prop/d:lockdiscovery/d:activelock/d:depth', - '/d:prop/d:lockdiscovery/d:activelock/d:owner', - '/d:prop/d:lockdiscovery/d:activelock/d:timeout', - '/d:prop/d:lockdiscovery/d:activelock/d:locktoken', - '/d:prop/d:lockdiscovery/d:activelock/d:locktoken/d:href', - ]; - - foreach ($elements as $elem) { - $data = $xml->xpath($elem); - $this->assertEquals(1, count($data), 'We expected 1 match for the xpath expression "'.$elem.'". '.count($data).' were found. Full response body: '.$this->response->getBodyAsString()); - } - - $depth = $xml->xpath('/d:prop/d:lockdiscovery/d:activelock/d:depth'); - $this->assertEquals('infinity', (string) $depth[0]); - - $token = $xml->xpath('/d:prop/d:lockdiscovery/d:activelock/d:locktoken/d:href'); - $this->assertEquals($this->response->getHeader('Lock-Token'), '<'.(string) $token[0].'>', 'Token in response body didn\'t match token in response header.'); - } - - public function testLockWithContext() - { - $request = new HTTP\Request('LOCK', '/baseuri/test.txt'); - $request->setBody('<?xml version="1.0"?> -<D:lockinfo xmlns:D="DAV:"> - <D:lockscope><D:exclusive/></D:lockscope> - <D:locktype><D:write/></D:locktype> - <D:owner> - <D:href>http://example.org/~ejw/contact.html</D:href> - </D:owner> -</D:lockinfo>'); - - $this->server->setBaseUri('baseuri'); - $this->server->httpRequest = $request; - $this->server->exec(); - - $this->assertEquals(200, $this->response->status, 'Got an incorrect status back. Response body: '.$this->response->getBodyAsString()); - - $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/", 'xmlns\\1="urn:DAV"', $this->response->getBodyAsString()); - $xml = simplexml_load_string($body); - $xml->registerXPathNamespace('d', 'urn:DAV'); - - $lockRoot = $xml->xpath('/d:prop/d:lockdiscovery/d:activelock/d:lockroot/d:href'); - $this->assertEquals('baseuri/test.txt', (string) $lockRoot[0]); - } - - /** - * @depends testLock - */ - public function testDoubleLock() - { - $request = new HTTP\Request('LOCK', '/test.txt'); - $request->setBody('<?xml version="1.0"?> -<D:lockinfo xmlns:D="DAV:"> - <D:lockscope><D:exclusive/></D:lockscope> - <D:locktype><D:write/></D:locktype> - <D:owner> - <D:href>http://example.org/~ejw/contact.html</D:href> - </D:owner> -</D:lockinfo>'); - - $this->server->httpRequest = $request; - $this->server->exec(); - - $this->response = new HTTP\ResponseMock(); - $this->server->httpResponse = $this->response; - - $this->server->exec(); - - $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); - - $this->assertEquals(423, $this->response->status, 'Full response: '.$this->response->getBodyAsString()); - } - - /** - * @depends testLock - */ - public function testLockRefresh() - { - $request = new HTTP\Request('LOCK', '/test.txt'); - $request->setBody('<?xml version="1.0"?> -<D:lockinfo xmlns:D="DAV:"> - <D:lockscope><D:exclusive/></D:lockscope> - <D:locktype><D:write/></D:locktype> - <D:owner> - <D:href>http://example.org/~ejw/contact.html</D:href> - </D:owner> -</D:lockinfo>'); - - $this->server->httpRequest = $request; - $this->server->exec(); - - $lockToken = $this->response->getHeader('Lock-Token'); - - $this->response = new HTTP\ResponseMock(); - $this->server->httpResponse = $this->response; - - $request = new HTTP\Request('LOCK', '/test.txt', ['If' => '('.$lockToken.')']); - $request->setBody(''); - - $this->server->httpRequest = $request; - $this->server->exec(); - - $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); - - $this->assertEquals(200, $this->response->status, 'We received an incorrect status code. Full response body: '.$this->response->getBody()); - } - - /** - * @depends testLock - */ - public function testLockRefreshBadToken() - { - $request = new HTTP\Request('LOCK', '/test.txt'); - $request->setBody('<?xml version="1.0"?> -<D:lockinfo xmlns:D="DAV:"> - <D:lockscope><D:exclusive/></D:lockscope> - <D:locktype><D:write/></D:locktype> - <D:owner> - <D:href>http://example.org/~ejw/contact.html</D:href> - </D:owner> -</D:lockinfo>'); - - $this->server->httpRequest = $request; - $this->server->exec(); - - $lockToken = $this->response->getHeader('Lock-Token'); - - $this->response = new HTTP\ResponseMock(); - $this->server->httpResponse = $this->response; - - $request = new HTTP\Request('LOCK', '/test.txt', ['If' => '('.$lockToken.'foobar) (<opaquelocktoken:anotherbadtoken>)']); - $request->setBody(''); - - $this->server->httpRequest = $request; - $this->server->exec(); - - $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); - - $this->assertEquals(423, $this->response->getStatus(), 'We received an incorrect status code. Full response body: '.$this->response->getBody()); - } - - /** - * @depends testLock - */ - public function testLockNoFile() - { - $request = new HTTP\Request('LOCK', '/notfound.txt'); - $request->setBody('<?xml version="1.0"?> -<D:lockinfo xmlns:D="DAV:"> - <D:lockscope><D:exclusive/></D:lockscope> - <D:locktype><D:write/></D:locktype> - <D:owner> - <D:href>http://example.org/~ejw/contact.html</D:href> - </D:owner> -</D:lockinfo>'); - - $this->server->httpRequest = $request; - $this->server->exec(); - - $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); - $this->assertTrue(1 === preg_match('/^<opaquelocktoken:(.*)>$/', $this->response->getHeader('Lock-Token')), 'We did not get a valid Locktoken back ('.$this->response->getHeader('Lock-Token').')'); - - $this->assertEquals(201, $this->response->status); - } - - /** - * @depends testLock - */ - public function testUnlockNoToken() - { - $request = new HTTP\Request('UNLOCK', '/test.txt'); - $this->server->httpRequest = $request; - $this->server->exec(); - - $this->assertEquals([ - 'X-Sabre-Version' => [DAV\Version::VERSION], - 'Content-Type' => ['application/xml; charset=utf-8'], - ], - $this->response->getHeaders() - ); - - $this->assertEquals(400, $this->response->status); - } - - /** - * @depends testLock - */ - public function testUnlockBadToken() - { - $request = new HTTP\Request('UNLOCK', '/test.txt', ['Lock-Token' => '<opaquelocktoken:blablabla>']); - $this->server->httpRequest = $request; - $this->server->exec(); - - $this->assertEquals([ - 'X-Sabre-Version' => [DAV\Version::VERSION], - 'Content-Type' => ['application/xml; charset=utf-8'], - ], - $this->response->getHeaders() - ); - - $this->assertEquals(409, $this->response->status, 'Got an incorrect status code. Full response body: '.$this->response->getBodyAsString()); - } - - /** - * @depends testLock - */ - public function testLockPutNoToken() - { - $request = new HTTP\Request('LOCK', '/test.txt'); - $request->setBody('<?xml version="1.0"?> -<D:lockinfo xmlns:D="DAV:"> - <D:lockscope><D:exclusive/></D:lockscope> - <D:locktype><D:write/></D:locktype> - <D:owner> - <D:href>http://example.org/~ejw/contact.html</D:href> - </D:owner> -</D:lockinfo>'); - - $this->server->httpRequest = $request; - $this->server->exec(); - - $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); - $this->assertTrue(1 === preg_match('/^<opaquelocktoken:(.*)>$/', $this->response->getHeader('Lock-Token')), 'We did not get a valid Locktoken back ('.$this->response->getHeader('Lock-Token').')'); - - $this->assertEquals(200, $this->response->status); - - $request = new HTTP\Request('PUT', '/test.txt'); - $request->setBody('newbody'); - $this->server->httpRequest = $request; - $this->server->exec(); - - $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); - $this->assertTrue(1 === preg_match('/^<opaquelocktoken:(.*)>$/', $this->response->getHeader('Lock-Token')), 'We did not get a valid Locktoken back ('.$this->response->getHeader('Lock-Token').')'); - - $this->assertEquals(423, $this->response->status); - } - - /** - * @depends testLock - */ - public function testUnlock() - { - $request = new HTTP\Request('LOCK', '/test.txt'); - $this->server->httpRequest = $request; - - $request->setBody('<?xml version="1.0"?> -<D:lockinfo xmlns:D="DAV:"> - <D:lockscope><D:exclusive/></D:lockscope> - <D:locktype><D:write/></D:locktype> - <D:owner> - <D:href>http://example.org/~ejw/contact.html</D:href> - </D:owner> -</D:lockinfo>'); - - $this->server->invokeMethod($request, $this->server->httpResponse); - $lockToken = $this->server->httpResponse->getHeader('Lock-Token'); - - $request = new HTTP\Request('UNLOCK', '/test.txt', ['Lock-Token' => $lockToken]); - $this->server->httpRequest = $request; - $this->server->httpResponse = new HTTP\ResponseMock(); - $this->server->invokeMethod($request, $this->server->httpResponse); - - $this->assertEquals(204, $this->server->httpResponse->status, 'Got an incorrect status code. Full response body: '.$this->response->getBodyAsString()); - $this->assertEquals([ - 'X-Sabre-Version' => [DAV\Version::VERSION], - 'Content-Length' => ['0'], - ], - $this->server->httpResponse->getHeaders() - ); - } - - /** - * @depends testLock - */ - public function testUnlockWindowsBug() - { - $request = new HTTP\Request('LOCK', '/test.txt'); - $this->server->httpRequest = $request; - - $request->setBody('<?xml version="1.0"?> -<D:lockinfo xmlns:D="DAV:"> - <D:lockscope><D:exclusive/></D:lockscope> - <D:locktype><D:write/></D:locktype> - <D:owner> - <D:href>http://example.org/~ejw/contact.html</D:href> - </D:owner> -</D:lockinfo>'); - - $this->server->invokeMethod($request, $this->server->httpResponse); - $lockToken = $this->server->httpResponse->getHeader('Lock-Token'); - - // See Issue 123 - $lockToken = trim($lockToken, '<>'); - - $request = new HTTP\Request('UNLOCK', '/test.txt', ['Lock-Token' => $lockToken]); - $this->server->httpRequest = $request; - $this->server->httpResponse = new HTTP\ResponseMock(); - $this->server->invokeMethod($request, $this->server->httpResponse); - - $this->assertEquals(204, $this->server->httpResponse->status, 'Got an incorrect status code. Full response body: '.$this->response->getBodyAsString()); - $this->assertEquals([ - 'X-Sabre-Version' => [DAV\Version::VERSION], - 'Content-Length' => ['0'], - ], - $this->server->httpResponse->getHeaders() - ); - } - - /** - * @depends testLock - */ - public function testLockRetainOwner() - { - $request = new HTTP\Request('LOCK', '/test.txt'); - $this->server->httpRequest = $request; - - $request->setBody('<?xml version="1.0"?> -<D:lockinfo xmlns:D="DAV:"> - <D:lockscope><D:exclusive/></D:lockscope> - <D:locktype><D:write/></D:locktype> - <D:owner>Evert</D:owner> -</D:lockinfo>'); - - $this->server->invokeMethod($request, $this->server->httpResponse); - $lockToken = $this->server->httpResponse->getHeader('Lock-Token'); - - $locks = $this->locksPlugin->getLocks('test.txt'); - $this->assertEquals(1, count($locks)); - $this->assertEquals('Evert', $locks[0]->owner); - } - - /** - * @depends testLock - */ - public function testLockPutBadToken() - { - $request = new HTTP\Request('LOCK', '/test.txt'); - $request->setBody('<?xml version="1.0"?> -<D:lockinfo xmlns:D="DAV:"> - <D:lockscope><D:exclusive/></D:lockscope> - <D:locktype><D:write/></D:locktype> - <D:owner> - <D:href>http://example.org/~ejw/contact.html</D:href> - </D:owner> -</D:lockinfo>'); - - $this->server->httpRequest = $request; - $this->server->exec(); - - $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); - $this->assertTrue(1 === preg_match('/^<opaquelocktoken:(.*)>$/', $this->response->getHeader('Lock-Token')), 'We did not get a valid Locktoken back ('.$this->response->getHeader('Lock-Token').')'); - - $this->assertEquals(200, $this->response->status); - - $request = new HTTP\Request('PUT', '/test.txt', [ - 'If' => '(<opaquelocktoken:token1>)', - ]); - $request->setBody('newbody'); - $this->server->httpRequest = $request; - $this->server->exec(); - - $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); - $this->assertTrue(1 === preg_match('/^<opaquelocktoken:(.*)>$/', $this->response->getHeader('Lock-Token')), 'We did not get a valid Locktoken back ('.$this->response->getHeader('Lock-Token').')'); - - // $this->assertEquals('412 Precondition failed',$this->response->status); - $this->assertEquals(423, $this->response->status); - } - - /** - * @depends testLock - */ - public function testLockDeleteParent() - { - $request = new HTTP\Request('LOCK', '/dir/child.txt'); - $request->setBody('<?xml version="1.0"?> -<D:lockinfo xmlns:D="DAV:"> - <D:lockscope><D:exclusive/></D:lockscope> - <D:locktype><D:write/></D:locktype> - <D:owner> - <D:href>http://example.org/~ejw/contact.html</D:href> - </D:owner> -</D:lockinfo>'); - - $this->server->httpRequest = $request; - $this->server->exec(); - - $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); - $this->assertTrue(1 === preg_match('/^<opaquelocktoken:(.*)>$/', $this->response->getHeader('Lock-Token')), 'We did not get a valid Locktoken back ('.$this->response->getHeader('Lock-Token').')'); - - $this->assertEquals(200, $this->response->status); - - $request = new HTTP\Request('DELETE', '/dir'); - $this->server->httpRequest = $request; - $this->server->exec(); - - $this->assertEquals(423, $this->response->status); - $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); - } - - /** - * @depends testLock - */ - public function testLockDeleteSucceed() - { - $request = new HTTP\Request('LOCK', '/dir/child.txt'); - $request->setBody('<?xml version="1.0"?> -<D:lockinfo xmlns:D="DAV:"> - <D:lockscope><D:exclusive/></D:lockscope> - <D:locktype><D:write/></D:locktype> - <D:owner> - <D:href>http://example.org/~ejw/contact.html</D:href> - </D:owner> -</D:lockinfo>'); - - $this->server->httpRequest = $request; - $this->server->exec(); - - $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); - $this->assertTrue(1 === preg_match('/^<opaquelocktoken:(.*)>$/', $this->response->getHeader('Lock-Token')), 'We did not get a valid Locktoken back ('.$this->response->getHeader('Lock-Token').')'); - - $this->assertEquals(200, $this->response->status); - - $request = new HTTP\Request('DELETE', '/dir/child.txt', [ - 'If' => '('.$this->response->getHeader('Lock-Token').')', - ]); - $this->server->httpRequest = $request; - $this->server->exec(); - - $this->assertEquals(204, $this->response->status); - $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); - } - - /** - * @depends testLock - */ - public function testLockCopyLockSource() - { - $request = new HTTP\Request('LOCK', '/dir/child.txt'); - $request->setBody('<?xml version="1.0"?> -<D:lockinfo xmlns:D="DAV:"> - <D:lockscope><D:exclusive/></D:lockscope> - <D:locktype><D:write/></D:locktype> - <D:owner> - <D:href>http://example.org/~ejw/contact.html</D:href> - </D:owner> -</D:lockinfo>'); - - $this->server->httpRequest = $request; - $this->server->exec(); - - $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); - $this->assertTrue(1 === preg_match('/^<opaquelocktoken:(.*)>$/', $this->response->getHeader('Lock-Token')), 'We did not get a valid Locktoken back ('.$this->response->getHeader('Lock-Token').')'); - - $this->assertEquals(200, $this->response->status); - - $request = new HTTP\Request('COPY', '/dir/child.txt', [ - 'Destination' => '/dir/child2.txt', - ]); - - $this->server->httpRequest = $request; - $this->server->exec(); - - $this->assertEquals(201, $this->response->status, 'Copy must succeed if only the source is locked, but not the destination'); - $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); - } - - /** - * @depends testLock - */ - public function testLockCopyLockDestination() - { - $request = new HTTP\Request('LOCK', '/dir/child2.txt'); - $request->setBody('<?xml version="1.0"?> -<D:lockinfo xmlns:D="DAV:"> - <D:lockscope><D:exclusive/></D:lockscope> - <D:locktype><D:write/></D:locktype> - <D:owner> - <D:href>http://example.org/~ejw/contact.html</D:href> - </D:owner> -</D:lockinfo>'); - - $this->server->httpRequest = $request; - $this->server->exec(); - - $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); - $this->assertTrue(1 === preg_match('/^<opaquelocktoken:(.*)>$/', $this->response->getHeader('Lock-Token')), 'We did not get a valid Locktoken back ('.$this->response->getHeader('Lock-Token').')'); - - $this->assertEquals(201, $this->response->status); - - $request = new HTTP\Request('COPY', '/dir/child.txt', [ - 'Destination' => '/dir/child2.txt', - ]); - $this->server->httpRequest = $request; - $this->server->exec(); - - $this->assertEquals(423, $this->response->status, 'Copy must succeed if only the source is locked, but not the destination'); - $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); - } - - /** - * @depends testLock - */ - public function testLockMoveLockSourceLocked() - { - $request = new HTTP\Request('LOCK', '/dir/child.txt'); - $request->setBody('<?xml version="1.0"?> -<D:lockinfo xmlns:D="DAV:"> - <D:lockscope><D:exclusive/></D:lockscope> - <D:locktype><D:write/></D:locktype> - <D:owner> - <D:href>http://example.org/~ejw/contact.html</D:href> - </D:owner> -</D:lockinfo>'); - - $this->server->httpRequest = $request; - $this->server->exec(); - - $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); - $this->assertTrue(1 === preg_match('/^<opaquelocktoken:(.*)>$/', $this->response->getHeader('Lock-Token')), 'We did not get a valid Locktoken back ('.$this->response->getHeader('Lock-Token').')'); - - $this->assertEquals(200, $this->response->status); - - $request = new HTTP\Request('MOVE', '/dir/child.txt', [ - 'Destination' => '/dir/child2.txt', - ]); - $this->server->httpRequest = $request; - $this->server->exec(); - - $this->assertEquals(423, $this->response->status, 'Copy must succeed if only the source is locked, but not the destination'); - $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); - } - - /** - * @depends testLock - */ - public function testLockMoveLockSourceSucceed() - { - $request = new HTTP\Request('LOCK', '/dir/child.txt'); - $request->setBody('<?xml version="1.0"?> -<D:lockinfo xmlns:D="DAV:"> - <D:lockscope><D:exclusive/></D:lockscope> - <D:locktype><D:write/></D:locktype> - <D:owner> - <D:href>http://example.org/~ejw/contact.html</D:href> - </D:owner> -</D:lockinfo>'); - - $this->server->httpRequest = $request; - $this->server->exec(); - - $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); - $this->assertTrue(1 === preg_match('/^<opaquelocktoken:(.*)>$/', $this->response->getHeader('Lock-Token')), 'We did not get a valid Locktoken back ('.$this->response->getHeader('Lock-Token').')'); - - $this->assertEquals(200, $this->response->status); - - $request = new HTTP\Request('MOVE', '/dir/child.txt', [ - 'Destination' => '/dir/child2.txt', - 'If' => '('.$this->response->getHeader('Lock-Token').')', - ]); - $this->server->httpRequest = $request; - $this->server->exec(); - - $this->assertEquals(201, $this->response->status, 'A valid lock-token was provided for the source, so this MOVE operation must succeed. Full response body: '.$this->response->getBodyAsString()); - } - - /** - * @depends testLock - */ - public function testLockMoveLockDestination() - { - $request = new HTTP\Request('LOCK', '/dir/child2.txt'); - $request->setBody('<?xml version="1.0"?> -<D:lockinfo xmlns:D="DAV:"> - <D:lockscope><D:exclusive/></D:lockscope> - <D:locktype><D:write/></D:locktype> - <D:owner> - <D:href>http://example.org/~ejw/contact.html</D:href> - </D:owner> -</D:lockinfo>'); - - $this->server->httpRequest = $request; - $this->server->exec(); - - $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); - $this->assertTrue(1 === preg_match('/^<opaquelocktoken:(.*)>$/', $this->response->getHeader('Lock-Token')), 'We did not get a valid Locktoken back ('.$this->response->getHeader('Lock-Token').')'); - - $this->assertEquals(201, $this->response->status); - - $request = new HTTP\Request('MOVE', '/dir/child.txt', [ - 'Destination' => '/dir/child2.txt', - ]); - $this->server->httpRequest = $request; - $this->server->exec(); - - $this->assertEquals(423, $this->response->status, 'Copy must succeed if only the source is locked, but not the destination'); - $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); - } - - /** - * @depends testLock - */ - public function testLockMoveLockParent() - { - $request = new HTTP\Request('LOCK', '/dir', [ - 'Depth' => 'infinite', - ]); - $request->setBody('<?xml version="1.0"?> -<D:lockinfo xmlns:D="DAV:"> - <D:lockscope><D:exclusive/></D:lockscope> - <D:locktype><D:write/></D:locktype> - <D:owner> - <D:href>http://example.org/~ejw/contact.html</D:href> - </D:owner> -</D:lockinfo>'); - - $this->server->httpRequest = $request; - $this->server->exec(); - - $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); - $this->assertTrue(1 === preg_match('/^<opaquelocktoken:(.*)>$/', $this->response->getHeader('Lock-Token')), 'We did not get a valid Locktoken back ('.$this->response->getHeader('Lock-Token').')'); - - $this->assertEquals(200, $this->response->status); - - $request = new HTTP\Request('MOVE', '/dir/child.txt', [ - 'Destination' => '/dir/child2.txt', - 'If' => '</dir> ('.$this->response->getHeader('Lock-Token').')', - ]); - $this->server->httpRequest = $request; - $this->server->exec(); - - $this->assertEquals(201, $this->response->status, 'We locked the parent of both the source and destination, but the move didn\'t succeed.'); - $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); - } - - /** - * @depends testLock - */ - public function testLockPutGoodToken() - { - $request = new HTTP\Request('LOCK', '/test.txt'); - $request->setBody('<?xml version="1.0"?> -<D:lockinfo xmlns:D="DAV:"> - <D:lockscope><D:exclusive/></D:lockscope> - <D:locktype><D:write/></D:locktype> - <D:owner> - <D:href>http://example.org/~ejw/contact.html</D:href> - </D:owner> -</D:lockinfo>'); - - $this->server->httpRequest = $request; - $this->server->exec(); - - $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); - $this->assertTrue(1 === preg_match('/^<opaquelocktoken:(.*)>$/', $this->response->getHeader('Lock-Token')), 'We did not get a valid Locktoken back ('.$this->response->getHeader('Lock-Token').')'); - - $this->assertEquals(200, $this->response->status); - - $request = new HTTP\Request('PUT', '/test.txt', [ - 'If' => '('.$this->response->getHeader('Lock-Token').')', - ]); - $request->setBody('newbody'); - $this->server->httpRequest = $request; - $this->server->exec(); - - $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); - $this->assertTrue(1 === preg_match('/^<opaquelocktoken:(.*)>$/', $this->response->getHeader('Lock-Token')), 'We did not get a valid Locktoken back ('.$this->response->getHeader('Lock-Token').')'); - - $this->assertEquals(204, $this->response->status); - } - - /** - * @depends testLock - */ - public function testLockPutUnrelatedToken() - { - $request = new HTTP\Request('LOCK', '/unrelated.txt'); - $request->setBody('<?xml version="1.0"?> -<D:lockinfo xmlns:D="DAV:"> - <D:lockscope><D:exclusive/></D:lockscope> - <D:locktype><D:write/></D:locktype> - <D:owner> - <D:href>http://example.org/~ejw/contact.html</D:href> - </D:owner> -</D:lockinfo>'); - - $this->server->httpRequest = $request; - $this->server->exec(); - - $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); - $this->assertTrue(1 === preg_match('/^<opaquelocktoken:(.*)>$/', $this->response->getHeader('Lock-Token')), 'We did not get a valid Locktoken back ('.$this->response->getHeader('Lock-Token').')'); - - $this->assertEquals(201, $this->response->getStatus()); - - $request = new HTTP\Request( - 'PUT', - '/test.txt', - ['If' => '</unrelated.txt> ('.$this->response->getHeader('Lock-Token').')'] - ); - $request->setBody('newbody'); - $this->server->httpRequest = $request; - $this->server->exec(); - - $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); - $this->assertTrue(1 === preg_match('/^<opaquelocktoken:(.*)>$/', $this->response->getHeader('Lock-Token')), 'We did not get a valid Locktoken back ('.$this->response->getHeader('Lock-Token').')'); - - $this->assertEquals(204, $this->response->status); - } - - public function testPutWithIncorrectETag() - { - $request = new HTTP\Request('PUT', '/test.txt', [ - 'If' => '(["etag1"])', - ]); - $request->setBody('newbody'); - $this->server->httpRequest = $request; - $this->server->exec(); - $this->assertEquals(412, $this->response->status); - } - - /** - * @depends testPutWithIncorrectETag - */ - public function testPutWithCorrectETag() - { - // We need an ETag-enabled file node. - $tree = new DAV\Tree(new DAV\FSExt\Directory(SABRE_TEMPDIR)); - $this->server->tree = $tree; - - $filename = SABRE_TEMPDIR.'/test.txt'; - $etag = sha1( - fileinode($filename). - filesize($filename). - filemtime($filename) - ); - - $request = new HTTP\Request('PUT', '/test.txt', [ - 'If' => '(["'.$etag.'"])', - ]); - $request->setBody('newbody'); - - $this->server->httpRequest = $request; - $this->server->exec(); - $this->assertEquals(204, $this->response->status, 'Incorrect status received. Full response body:'.$this->response->getBodyAsString()); - } - - public function testDeleteWithETagOnCollection() - { - $request = new HTTP\Request('DELETE', '/dir', [ - 'If' => '(["etag1"])', - ]); - - $this->server->httpRequest = $request; - $this->server->exec(); - $this->assertEquals(412, $this->response->status); - } - - public function testGetTimeoutHeader() - { - $request = new HTTP\Request('LOCK', '/foo/bar', [ - 'Timeout' => 'second-100', - ]); - - $this->server->httpRequest = $request; - $this->assertEquals(100, $this->locksPlugin->getTimeoutHeader()); - } - - public function testGetTimeoutHeaderTwoItems() - { - $request = new HTTP\Request('LOCK', '/foo/bar', [ - 'Timeout' => 'second-5, infinite', - ]); - $this->server->httpRequest = $request; - $this->assertEquals(5, $this->locksPlugin->getTimeoutHeader()); - } - - public function testGetTimeoutHeaderInfinite() - { - $request = new HTTP\Request('LOCK', '/foo/bar', [ - 'Timeout' => 'infinite, second-5', - ]); - $this->server->httpRequest = $request; - $this->assertEquals(LockInfo::TIMEOUT_INFINITE, $this->locksPlugin->getTimeoutHeader()); - } - - public function testGetTimeoutHeaderInvalid() - { - $this->expectException('Sabre\DAV\Exception\BadRequest'); - $request = new HTTP\Request('GET', '/', ['Timeout' => 'yourmom']); - - $this->server->httpRequest = $request; - $this->locksPlugin->getTimeoutHeader(); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Mock/Collection.php b/vendor/sabre/dav/tests/Sabre/DAV/Mock/Collection.php deleted file mode 100644 index 041274706..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAV/Mock/Collection.php +++ /dev/null @@ -1,157 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAV\Mock; - -use Sabre\DAV; - -/** - * Mock Collection. - * - * This collection quickly allows you to create trees of nodes. - * Children are specified as an array. - * - * Every key a filename, every array value is either: - * * an array, for a sub-collection - * * a string, for a file - * * An instance of \Sabre\DAV\INode. - * - * @copyright Copyright (C) fruux GmbH (https://fruux.com/) - * @author Evert Pot (http://evertpot.com/) - * @license http://sabre.io/license/ Modified BSD License - */ -class Collection extends DAV\Collection -{ - protected $name; - protected $children; - protected $parent; - - /** - * Creates the object. - * - * @param string $name - * @param Collection $parent - */ - public function __construct($name, array $children = [], Collection $parent = null) - { - $this->name = $name; - foreach ($children as $key => $value) { - if (is_string($value)) { - $this->children[] = new File($key, $value, $this); - } elseif (is_array($value)) { - $this->children[] = new self($key, $value, $this); - } elseif ($value instanceof \Sabre\DAV\INode) { - $this->children[] = $value; - } else { - throw new \InvalidArgumentException('Unknown value passed in $children'); - } - } - $this->parent = $parent; - } - - /** - * Returns the name of the node. - * - * This is used to generate the url. - * - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Creates a new file in the directory. - * - * Data will either be supplied as a stream resource, or in certain cases - * as a string. Keep in mind that you may have to support either. - * - * After successful creation of the file, you may choose to return the ETag - * of the new file here. - * - * The returned ETag must be surrounded by double-quotes (The quotes should - * be part of the actual string). - * - * If you cannot accurately determine the ETag, you should not return it. - * If you don't store the file exactly as-is (you're transforming it - * somehow) you should also not return an ETag. - * - * This means that if a subsequent GET to this new file does not exactly - * return the same contents of what was submitted here, you are strongly - * recommended to omit the ETag. - * - * @param string $name Name of the file - * @param resource|string $data Initial payload - * - * @return string|null - */ - public function createFile($name, $data = null) - { - if (null === $data) { - $data = ''; - } - if (is_resource($data)) { - $data = stream_get_contents($data); - } - $this->children[] = new File($name, $data, $this); - - return '"'.md5($data).'"'; - } - - /** - * Creates a new subdirectory. - * - * @param string $name - */ - public function createDirectory($name) - { - $this->children[] = new self($name); - } - - /** - * Returns an array with all the child nodes. - * - * @return \Sabre\DAV\INode[] - */ - public function getChildren() - { - return $this->children; - } - - /** - * Adds an already existing node to this collection. - */ - public function addNode(\Sabre\DAV\INode $node) - { - $this->children[] = $node; - } - - /** - * Removes a childnode from this node. - * - * @param string $name - */ - public function deleteChild($name) - { - foreach ($this->children as $key => $value) { - if ($value->getName() == $name) { - unset($this->children[$key]); - - return; - } - } - } - - /** - * Deletes this collection and all its children,. - */ - public function delete() - { - foreach ($this->getChildren() as $child) { - $this->deleteChild($child->getName()); - } - $this->parent->deleteChild($this->getName()); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Mock/File.php b/vendor/sabre/dav/tests/Sabre/DAV/Mock/File.php deleted file mode 100644 index d48ddaa92..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAV/Mock/File.php +++ /dev/null @@ -1,151 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAV\Mock; - -use Sabre\DAV; - -/** - * Mock File. - * - * See the Collection in this directory for more details. - * - * @copyright Copyright (C) fruux GmbH (https://fruux.com/) - * @author Evert Pot (http://evertpot.com/) - * @license http://sabre.io/license/ Modified BSD License - */ -class File extends DAV\File -{ - protected $name; - protected $contents; - protected $parent; - protected $lastModified; - - /** - * Creates the object. - * - * @param string $name - * @param resource $contents - * @param Collection $parent - * @param int $lastModified - */ - public function __construct($name, $contents, Collection $parent = null, $lastModified = -1) - { - $this->name = $name; - $this->put($contents); - $this->parent = $parent; - - if (-1 === $lastModified) { - $lastModified = time(); - } - - $this->lastModified = $lastModified; - } - - /** - * Returns the name of the node. - * - * This is used to generate the url. - * - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Changes the name of the node. - * - * @param string $name - */ - public function setName($name) - { - $this->name = $name; - } - - /** - * Updates the data. - * - * The data argument is a readable stream resource. - * - * After a successful put operation, you may choose to return an ETag. The - * etag must always be surrounded by double-quotes. These quotes must - * appear in the actual string you're returning. - * - * Clients may use the ETag from a PUT request to later on make sure that - * when they update the file, the contents haven't changed in the mean - * time. - * - * If you don't plan to store the file byte-by-byte, and you return a - * different object on a subsequent GET you are strongly recommended to not - * return an ETag, and just return null. - * - * @param resource $data - * - * @return string|null - */ - public function put($data) - { - if (is_resource($data)) { - $data = stream_get_contents($data); - } - $this->contents = $data; - - return '"'.md5($data).'"'; - } - - /** - * Returns the data. - * - * This method may either return a string or a readable stream resource - * - * @return mixed - */ - public function get() - { - return $this->contents; - } - - /** - * Returns the ETag for a file. - * - * An ETag is a unique identifier representing the current version of the file. If the file changes, the ETag MUST change. - * - * Return null if the ETag can not effectively be determined - */ - public function getETag() - { - return '"'.md5($this->contents).'"'; - } - - /** - * Returns the size of the node, in bytes. - * - * @return int - */ - public function getSize() - { - return strlen($this->contents); - } - - /** - * Delete the node. - */ - public function delete() - { - $this->parent->deleteChild($this->name); - } - - /** - * Returns the last modification time as a unix timestamp. - * If the information is not available, return null. - * - * @return int - */ - public function getLastModified() - { - return $this->lastModified; - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Mount/PluginTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Mount/PluginTest.php deleted file mode 100644 index 54f7e4cb4..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAV/Mount/PluginTest.php +++ /dev/null @@ -1,54 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAV\Mount; - -use Sabre\DAV; -use Sabre\HTTP; - -class PluginTest extends DAV\AbstractServer -{ - public function setup(): void - { - parent::setUp(); - $this->server->addPlugin(new Plugin()); - } - - public function testPassThrough() - { - $serverVars = [ - 'REQUEST_URI' => '/', - 'REQUEST_METHOD' => 'GET', - ]; - - $request = HTTP\Sapi::createFromServerArray($serverVars); - $this->server->httpRequest = ($request); - $this->server->exec(); - - $this->assertEquals(501, $this->response->status, 'We expected GET to not be implemented for Directories. Response body: '.$this->response->getBodyAsString()); - } - - public function testMountResponse() - { - $serverVars = [ - 'REQUEST_URI' => '/?mount', - 'REQUEST_METHOD' => 'GET', - 'QUERY_STRING' => 'mount', - 'HTTP_HOST' => 'example.org', - ]; - - $request = HTTP\Sapi::createFromServerArray($serverVars); - $this->server->httpRequest = ($request); - $this->server->exec(); - - $this->assertEquals(200, $this->response->status); - - $xml = simplexml_load_string($this->response->getBodyAsString()); - $this->assertInstanceOf('SimpleXMLElement', $xml, 'Response was not a valid xml document. The list of errors:'.print_r(libxml_get_errors(), true).'. xml body: '.$this->response->getBodyAsString().'. What type we got: '.gettype($xml).' class, if object: '.get_class($xml)); - - $xml->registerXPathNamespace('dm', 'http://purl.org/NET/webdav/mount'); - $url = $xml->xpath('//dm:url'); - $this->assertEquals('http://example.org/', (string) $url[0]); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAV/ObjectTreeTest.php b/vendor/sabre/dav/tests/Sabre/DAV/ObjectTreeTest.php deleted file mode 100644 index 7066c49fc..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAV/ObjectTreeTest.php +++ /dev/null @@ -1,90 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAV; - -class ObjectTreeTest extends \PHPUnit\Framework\TestCase -{ - protected $tree; - - public function setup(): void - { - \Sabre\TestUtil::clearTempDir(); - mkdir(SABRE_TEMPDIR.'/root'); - mkdir(SABRE_TEMPDIR.'/root/subdir'); - file_put_contents(SABRE_TEMPDIR.'/root/file.txt', 'contents'); - file_put_contents(SABRE_TEMPDIR.'/root/subdir/subfile.txt', 'subcontents'); - $rootNode = new FSExt\Directory(SABRE_TEMPDIR.'/root'); - $this->tree = new Tree($rootNode); - } - - public function teardown(): void - { - \Sabre\TestUtil::clearTempDir(); - } - - public function testGetRootNode() - { - $root = $this->tree->getNodeForPath(''); - $this->assertInstanceOf('Sabre\\DAV\\FSExt\\Directory', $root); - } - - public function testGetSubDir() - { - $root = $this->tree->getNodeForPath('subdir'); - $this->assertInstanceOf('Sabre\\DAV\\FSExt\\Directory', $root); - } - - public function testCopyFile() - { - $this->tree->copy('file.txt', 'file2.txt'); - $this->assertTrue(file_exists(SABRE_TEMPDIR.'/root/file2.txt')); - $this->assertEquals('contents', file_get_contents(SABRE_TEMPDIR.'/root/file2.txt')); - } - - /** - * @depends testCopyFile - */ - public function testCopyDirectory() - { - $this->tree->copy('subdir', 'subdir2'); - $this->assertTrue(file_exists(SABRE_TEMPDIR.'/root/subdir2')); - $this->assertTrue(file_exists(SABRE_TEMPDIR.'/root/subdir2/subfile.txt')); - $this->assertEquals('subcontents', file_get_contents(SABRE_TEMPDIR.'/root/subdir2/subfile.txt')); - } - - /** - * @depends testCopyFile - */ - public function testMoveFile() - { - $this->tree->move('file.txt', 'file2.txt'); - $this->assertTrue(file_exists(SABRE_TEMPDIR.'/root/file2.txt')); - $this->assertFalse(file_exists(SABRE_TEMPDIR.'/root/file.txt')); - $this->assertEquals('contents', file_get_contents(SABRE_TEMPDIR.'/root/file2.txt')); - } - - /** - * @depends testMoveFile - */ - public function testMoveFileNewParent() - { - $this->tree->move('file.txt', 'subdir/file2.txt'); - $this->assertTrue(file_exists(SABRE_TEMPDIR.'/root/subdir/file2.txt')); - $this->assertFalse(file_exists(SABRE_TEMPDIR.'/root/file.txt')); - $this->assertEquals('contents', file_get_contents(SABRE_TEMPDIR.'/root/subdir/file2.txt')); - } - - /** - * @depends testCopyDirectory - */ - public function testMoveDirectory() - { - $this->tree->move('subdir', 'subdir2'); - $this->assertTrue(file_exists(SABRE_TEMPDIR.'/root/subdir2')); - $this->assertTrue(file_exists(SABRE_TEMPDIR.'/root/subdir2/subfile.txt')); - $this->assertFalse(file_exists(SABRE_TEMPDIR.'/root/subdir')); - $this->assertEquals('subcontents', file_get_contents(SABRE_TEMPDIR.'/root/subdir2/subfile.txt')); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAV/PartialUpdate/FileMock.php b/vendor/sabre/dav/tests/Sabre/DAV/PartialUpdate/FileMock.php deleted file mode 100644 index 72fdb5ec8..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAV/PartialUpdate/FileMock.php +++ /dev/null @@ -1,111 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAV\PartialUpdate; - -use Sabre\DAV; - -class FileMock implements IPatchSupport -{ - protected $data = ''; - - public function put($str) - { - if (is_resource($str)) { - $str = stream_get_contents($str); - } - $this->data = $str; - } - - /** - * Updates the file based on a range specification. - * - * The first argument is the data, which is either a readable stream - * resource or a string. - * - * The second argument is the type of update we're doing. - * This is either: - * * 1. append - * * 2. update based on a start byte - * * 3. update based on an end byte - *; - * The third argument is the start or end byte. - * - * After a successful put operation, you may choose to return an ETag. The - * etag must always be surrounded by double-quotes. These quotes must - * appear in the actual string you're returning. - * - * Clients may use the ETag from a PUT request to later on make sure that - * when they update the file, the contents haven't changed in the mean - * time. - * - * @param resource|string $data - * @param int $rangeType - * @param int $offset - * - * @return string|null - */ - public function patch($data, $rangeType, $offset = null) - { - if (is_resource($data)) { - $data = stream_get_contents($data); - } - - switch ($rangeType) { - case 1: - $this->data .= $data; - break; - case 3: - // Turn the offset into an offset-offset. - $offset = strlen($this->data) - $offset; - // no break is intentional - case 2: - $this->data = - substr($this->data, 0, $offset). - $data. - substr($this->data, $offset + strlen($data)); - break; - } - } - - public function get() - { - return $this->data; - } - - public function getContentType() - { - return 'text/plain'; - } - - public function getSize() - { - return strlen($this->data); - } - - public function getETag() - { - return '"'.$this->data.'"'; - } - - public function delete() - { - throw new DAV\Exception\MethodNotAllowed(); - } - - public function setName($name) - { - throw new DAV\Exception\MethodNotAllowed(); - } - - public function getName() - { - return 'partial'; - } - - public function getLastModified() - { - return null; - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAV/PartialUpdate/PluginTest.php b/vendor/sabre/dav/tests/Sabre/DAV/PartialUpdate/PluginTest.php deleted file mode 100644 index 4d99aee7d..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAV/PartialUpdate/PluginTest.php +++ /dev/null @@ -1,122 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAV\PartialUpdate; - -use Sabre\HTTP; - -class PluginTest extends \Sabre\DAVServerTest -{ - protected $node; - protected $plugin; - - public function setup(): void - { - $this->node = new FileMock(); - $this->tree[] = $this->node; - - parent::setUp(); - - $this->plugin = new Plugin(); - $this->server->addPlugin($this->plugin); - } - - public function testInit() - { - $this->assertEquals('partialupdate', $this->plugin->getPluginName()); - $this->assertEquals(['sabredav-partialupdate'], $this->plugin->getFeatures()); - $this->assertEquals([ - 'PATCH', - ], $this->plugin->getHTTPMethods('partial')); - $this->assertEquals([ - ], $this->plugin->getHTTPMethods('')); - } - - public function testPatchNoRange() - { - $this->node->put('aaaaaaaa'); - $request = HTTP\Sapi::createFromServerArray([ - 'REQUEST_METHOD' => 'PATCH', - 'REQUEST_URI' => '/partial', - ]); - $response = $this->request($request); - - $this->assertEquals(400, $response->status, 'Full response body:'.$response->getBodyAsString()); - } - - public function testPatchNotSupported() - { - $this->node->put('aaaaaaaa'); - $request = new HTTP\Request('PATCH', '/', ['X-Update-Range' => '3-4']); - $request->setBody( - 'bbb' - ); - $response = $this->request($request); - - $this->assertEquals(405, $response->status, 'Full response body:'.$response->getBodyAsString()); - } - - public function testPatchNoContentType() - { - $this->node->put('aaaaaaaa'); - $request = new HTTP\Request('PATCH', '/partial', ['X-Update-Range' => 'bytes=3-4']); - $request->setBody( - 'bbb' - ); - $response = $this->request($request); - - $this->assertEquals(415, $response->status, 'Full response body:'.$response->getBodyAsString()); - } - - public function testPatchBadRange() - { - $this->node->put('aaaaaaaa'); - $request = new HTTP\Request('PATCH', '/partial', ['X-Update-Range' => 'bytes=3-4', 'Content-Type' => 'application/x-sabredav-partialupdate', 'Content-Length' => '3']); - $request->setBody( - 'bbb' - ); - $response = $this->request($request); - - $this->assertEquals(416, $response->status, 'Full response body:'.$response->getBodyAsString()); - } - - public function testPatchNoLength() - { - $this->node->put('aaaaaaaa'); - $request = new HTTP\Request('PATCH', '/partial', ['X-Update-Range' => 'bytes=3-5', 'Content-Type' => 'application/x-sabredav-partialupdate']); - $request->setBody( - 'bbb' - ); - $response = $this->request($request); - - $this->assertEquals(411, $response->status, 'Full response body:'.$response->getBodyAsString()); - } - - public function testPatchSuccess() - { - $this->node->put('aaaaaaaa'); - $request = new HTTP\Request('PATCH', '/partial', ['X-Update-Range' => 'bytes=3-5', 'Content-Type' => 'application/x-sabredav-partialupdate', 'Content-Length' => 3]); - $request->setBody( - 'bbb' - ); - $response = $this->request($request); - - $this->assertEquals(204, $response->status, 'Full response body:'.$response->getBodyAsString()); - $this->assertEquals('aaabbbaa', $this->node->get()); - } - - public function testPatchNoEndRange() - { - $this->node->put('aaaaa'); - $request = new HTTP\Request('PATCH', '/partial', ['X-Update-Range' => 'bytes=3-', 'Content-Type' => 'application/x-sabredav-partialupdate', 'Content-Length' => '3']); - $request->setBody( - 'bbb' - ); - - $response = $this->request($request); - - $this->assertEquals(204, $response->getStatus(), 'Full response body:'.$response->getBodyAsString()); - $this->assertEquals('aaabbb', $this->node->get()); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAV/PartialUpdate/SpecificationTest.php b/vendor/sabre/dav/tests/Sabre/DAV/PartialUpdate/SpecificationTest.php deleted file mode 100644 index a727a13e2..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAV/PartialUpdate/SpecificationTest.php +++ /dev/null @@ -1,90 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAV\PartialUpdate; - -use Sabre\DAV\FSExt\File; -use Sabre\DAV\Server; -use Sabre\HTTP; - -/** - * This test is an end-to-end sabredav test that goes through all - * the cases in the specification. - * - * See: http://sabre.io/dav/http-patch/ - */ -class SpecificationTest extends \PHPUnit\Framework\TestCase -{ - protected $server; - - public function setup(): void - { - $tree = [ - new File(SABRE_TEMPDIR.'/foobar.txt'), - ]; - $server = new Server($tree); - $server->debugExceptions = true; - $server->addPlugin(new Plugin()); - - $tree[0]->put('1234567890'); - - $this->server = $server; - } - - public function teardown(): void - { - \Sabre\TestUtil::clearTempDir(); - } - - /** - * @param string $headerValue - * @param string $httpStatus - * @param string $endResult - * @param int $contentLength - * - * @dataProvider data - */ - public function testUpdateRange($headerValue, $httpStatus, $endResult, $contentLength = 4) - { - $headers = [ - 'Content-Type' => 'application/x-sabredav-partialupdate', - 'X-Update-Range' => $headerValue, - ]; - - if ($contentLength) { - $headers['Content-Length'] = (string) $contentLength; - } - - $request = new HTTP\Request('PATCH', '/foobar.txt', $headers, '----'); - - $request->setBody('----'); - $this->server->httpRequest = $request; - $this->server->httpResponse = new HTTP\ResponseMock(); - $this->server->sapi = new HTTP\SapiMock(); - $this->server->exec(); - - $this->assertEquals($httpStatus, $this->server->httpResponse->status, 'Incorrect http status received: '.$this->server->httpResponse->body); - if (!is_null($endResult)) { - $this->assertEquals($endResult, file_get_contents(SABRE_TEMPDIR.'/foobar.txt')); - } - } - - public function data() - { - return [ - // Problems - ['foo', 400, null], - ['bytes=0-3', 411, null, 0], - ['bytes=4-1', 416, null], - - ['bytes=0-3', 204, '----567890'], - ['bytes=1-4', 204, '1----67890'], - ['bytes=0-', 204, '----567890'], - ['bytes=-4', 204, '123456----'], - ['bytes=-2', 204, '12345678----'], - ['bytes=2-', 204, '12----7890'], - ['append', 204, '1234567890----'], - ]; - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAV/ServerEventsTest.php b/vendor/sabre/dav/tests/Sabre/DAV/ServerEventsTest.php deleted file mode 100644 index b1f6754ea..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAV/ServerEventsTest.php +++ /dev/null @@ -1,114 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAV; - -use Sabre\HTTP; - -class ServerEventsTest extends AbstractServer -{ - private $tempPath; - - private $exception; - - public function testAfterBind() - { - $this->server->on('afterBind', [$this, 'afterBindHandler']); - $newPath = 'afterBind'; - - $this->tempPath = ''; - $this->server->createFile($newPath, 'body'); - $this->assertEquals($newPath, $this->tempPath); - } - - public function afterBindHandler($path) - { - $this->tempPath = $path; - } - - public function testAfterResponse() - { - $mock = $this->getMockBuilder('stdClass') - ->setMethods(['afterResponseCallback']) - ->getMock(); - $mock->expects($this->once())->method('afterResponseCallback'); - - $this->server->on('afterResponse', [$mock, 'afterResponseCallback']); - - $this->server->httpRequest = HTTP\Sapi::createFromServerArray([ - 'REQUEST_METHOD' => 'GET', - 'REQUEST_URI' => '/test.txt', - ]); - - $this->server->exec(); - } - - public function testBeforeBindCancel() - { - $this->server->on('beforeBind', [$this, 'beforeBindCancelHandler']); - $this->assertFalse($this->server->createFile('bla', 'body')); - - // Also testing put() - $req = HTTP\Sapi::createFromServerArray([ - 'REQUEST_METHOD' => 'PUT', - 'REQUEST_URI' => '/barbar', - ]); - - $this->server->httpRequest = $req; - $this->server->exec(); - - $this->assertEquals(500, $this->server->httpResponse->getStatus()); - } - - public function beforeBindCancelHandler($path) - { - return false; - } - - public function testException() - { - $this->server->on('exception', [$this, 'exceptionHandler']); - - $req = HTTP\Sapi::createFromServerArray([ - 'REQUEST_METHOD' => 'GET', - 'REQUEST_URI' => '/not/exisitng', - ]); - $this->server->httpRequest = $req; - $this->server->exec(); - - $this->assertInstanceOf('Sabre\\DAV\\Exception\\NotFound', $this->exception); - } - - public function exceptionHandler(Exception $exception) - { - $this->exception = $exception; - } - - public function testMethod() - { - $k = 1; - $this->server->on('method:*', function ($request, $response) use (&$k) { - ++$k; - - return false; - }); - $this->server->on('method:*', function ($request, $response) use (&$k) { - $k += 2; - - return false; - }); - - try { - $this->server->invokeMethod( - new HTTP\Request('BLABLA', '/'), - new HTTP\Response(), - false - ); - } catch (Exception $e) { - } - - // Fun fact, PHP 7.1 changes the order when sorting-by-callback. - $this->assertTrue($k >= 2 && $k <= 3); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAV/ServerMKCOLTest.php b/vendor/sabre/dav/tests/Sabre/DAV/ServerMKCOLTest.php deleted file mode 100644 index 02c6a4633..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAV/ServerMKCOLTest.php +++ /dev/null @@ -1,354 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAV; - -use Sabre\HTTP; - -class ServerMKCOLTest extends AbstractServer -{ - public function testMkcol() - { - $serverVars = [ - 'REQUEST_URI' => '/testcol', - 'REQUEST_METHOD' => 'MKCOL', - ]; - - $request = HTTP\Sapi::createFromServerArray($serverVars); - $request->setBody(''); - $this->server->httpRequest = ($request); - $this->server->exec(); - - $this->assertEquals([ - 'X-Sabre-Version' => [Version::VERSION], - 'Content-Length' => ['0'], - ], $this->response->getHeaders()); - - $this->assertEquals(201, $this->response->status); - $this->assertEquals('', $this->response->getBodyAsString()); - $this->assertTrue(is_dir($this->tempDir.'/testcol')); - } - - /** - * @depends testMkcol - */ - public function testMKCOLUnknownBody() - { - $serverVars = [ - 'REQUEST_URI' => '/testcol', - 'REQUEST_METHOD' => 'MKCOL', - ]; - - $request = HTTP\Sapi::createFromServerArray($serverVars); - $request->setBody('Hello'); - $this->server->httpRequest = ($request); - $this->server->exec(); - - $this->assertEquals([ - 'X-Sabre-Version' => [Version::VERSION], - 'Content-Type' => ['application/xml; charset=utf-8'], - ], $this->response->getHeaders()); - - $this->assertEquals(415, $this->response->status); - } - - /** - * @depends testMkcol - */ - public function testMKCOLBrokenXML() - { - $serverVars = [ - 'REQUEST_URI' => '/testcol', - 'REQUEST_METHOD' => 'MKCOL', - 'HTTP_CONTENT_TYPE' => 'application/xml', - ]; - - $request = HTTP\Sapi::createFromServerArray($serverVars); - $request->setBody('Hello'); - $this->server->httpRequest = ($request); - $this->server->exec(); - - $this->assertEquals([ - 'X-Sabre-Version' => [Version::VERSION], - 'Content-Type' => ['application/xml; charset=utf-8'], - ], $this->response->getHeaders()); - - $this->assertEquals(400, $this->response->getStatus(), $this->response->getBodyAsString()); - } - - /** - * @depends testMkcol - */ - public function testMKCOLUnknownXML() - { - $serverVars = [ - 'REQUEST_URI' => '/testcol', - 'REQUEST_METHOD' => 'MKCOL', - 'HTTP_CONTENT_TYPE' => 'application/xml', - ]; - - $request = HTTP\Sapi::createFromServerArray($serverVars); - $request->setBody('<?xml version="1.0"?><html></html>'); - $this->server->httpRequest = ($request); - $this->server->exec(); - - $this->assertEquals([ - 'X-Sabre-Version' => [Version::VERSION], - 'Content-Type' => ['application/xml; charset=utf-8'], - ], $this->response->getHeaders()); - - $this->assertEquals(400, $this->response->getStatus()); - } - - /** - * @depends testMkcol - */ - public function testMKCOLNoResourceType() - { - $serverVars = [ - 'REQUEST_URI' => '/testcol', - 'REQUEST_METHOD' => 'MKCOL', - 'HTTP_CONTENT_TYPE' => 'application/xml', - ]; - - $request = HTTP\Sapi::createFromServerArray($serverVars); - $request->setBody('<?xml version="1.0"?> -<mkcol xmlns="DAV:"> - <set> - <prop> - <displayname>Evert</displayname> - </prop> - </set> -</mkcol>'); - $this->server->httpRequest = ($request); - $this->server->exec(); - - $this->assertEquals([ - 'X-Sabre-Version' => [Version::VERSION], - 'Content-Type' => ['application/xml; charset=utf-8'], - ], $this->response->getHeaders()); - - $this->assertEquals(400, $this->response->status, 'Wrong statuscode received. Full response body: '.$this->response->getBodyAsString()); - } - - /** - * @depends testMkcol - */ - public function testMKCOLIncorrectResourceType() - { - $serverVars = [ - 'REQUEST_URI' => '/testcol', - 'REQUEST_METHOD' => 'MKCOL', - 'HTTP_CONTENT_TYPE' => 'application/xml', - ]; - - $request = HTTP\Sapi::createFromServerArray($serverVars); - $request->setBody('<?xml version="1.0"?> -<mkcol xmlns="DAV:"> - <set> - <prop> - <resourcetype><collection /><blabla /></resourcetype> - </prop> - </set> -</mkcol>'); - $this->server->httpRequest = ($request); - $this->server->exec(); - - $this->assertEquals([ - 'X-Sabre-Version' => [Version::VERSION], - 'Content-Type' => ['application/xml; charset=utf-8'], - ], $this->response->getHeaders()); - - $this->assertEquals(403, $this->response->status, 'Wrong statuscode received. Full response body: '.$this->response->getBodyAsString()); - } - - /** - * @depends testMKCOLIncorrectResourceType - */ - public function testMKCOLSuccess() - { - $serverVars = [ - 'REQUEST_URI' => '/testcol', - 'REQUEST_METHOD' => 'MKCOL', - 'HTTP_CONTENT_TYPE' => 'application/xml', - ]; - - $request = HTTP\Sapi::createFromServerArray($serverVars); - $request->setBody('<?xml version="1.0"?> -<mkcol xmlns="DAV:"> - <set> - <prop> - <resourcetype><collection /></resourcetype> - </prop> - </set> -</mkcol>'); - $this->server->httpRequest = ($request); - $this->server->exec(); - - $this->assertEquals([ - 'X-Sabre-Version' => [Version::VERSION], - 'Content-Length' => ['0'], - ], $this->response->getHeaders()); - - $this->assertEquals(201, $this->response->status, 'Wrong statuscode received. Full response body: '.$this->response->getBodyAsString()); - } - - /** - * @depends testMKCOLIncorrectResourceType - */ - public function testMKCOLWhiteSpaceResourceType() - { - $serverVars = [ - 'REQUEST_URI' => '/testcol', - 'REQUEST_METHOD' => 'MKCOL', - 'HTTP_CONTENT_TYPE' => 'application/xml', - ]; - - $request = HTTP\Sapi::createFromServerArray($serverVars); - $request->setBody('<?xml version="1.0"?> -<mkcol xmlns="DAV:"> - <set> - <prop> - <resourcetype> - <collection /> - </resourcetype> - </prop> - </set> -</mkcol>'); - $this->server->httpRequest = ($request); - $this->server->exec(); - - $this->assertEquals([ - 'X-Sabre-Version' => [Version::VERSION], - 'Content-Length' => ['0'], - ], $this->response->getHeaders()); - - $this->assertEquals(201, $this->response->status, 'Wrong statuscode received. Full response body: '.$this->response->getBodyAsString()); - } - - /** - * @depends testMKCOLIncorrectResourceType - */ - public function testMKCOLNoParent() - { - $serverVars = [ - 'REQUEST_URI' => '/testnoparent/409me', - 'REQUEST_METHOD' => 'MKCOL', - ]; - - $request = HTTP\Sapi::createFromServerArray($serverVars); - $request->setBody(''); - - $this->server->httpRequest = ($request); - $this->server->exec(); - - $this->assertEquals([ - 'X-Sabre-Version' => [Version::VERSION], - 'Content-Type' => ['application/xml; charset=utf-8'], - ], $this->response->getHeaders()); - - $this->assertEquals(409, $this->response->status, 'Wrong statuscode received. Full response body: '.$this->response->getBodyAsString()); - } - - /** - * @depends testMKCOLIncorrectResourceType - */ - public function testMKCOLParentIsNoCollection() - { - $serverVars = [ - 'REQUEST_URI' => '/test.txt/409me', - 'REQUEST_METHOD' => 'MKCOL', - ]; - - $request = HTTP\Sapi::createFromServerArray($serverVars); - $request->setBody(''); - - $this->server->httpRequest = ($request); - $this->server->exec(); - - $this->assertEquals([ - 'X-Sabre-Version' => [Version::VERSION], - 'Content-Type' => ['application/xml; charset=utf-8'], - ], $this->response->getHeaders()); - - $this->assertEquals(409, $this->response->status, 'Wrong statuscode received. Full response body: '.$this->response->getBodyAsString()); - } - - /** - * @depends testMKCOLIncorrectResourceType - */ - public function testMKCOLAlreadyExists() - { - $serverVars = [ - 'REQUEST_URI' => '/test.txt', - 'REQUEST_METHOD' => 'MKCOL', - ]; - - $request = HTTP\Sapi::createFromServerArray($serverVars); - $request->setBody(''); - - $this->server->httpRequest = ($request); - $this->server->exec(); - - $this->assertEquals([ - 'X-Sabre-Version' => [Version::VERSION], - 'Content-Type' => ['application/xml; charset=utf-8'], - 'Allow' => ['OPTIONS, GET, HEAD, DELETE, PROPFIND, PUT, PROPPATCH, COPY, MOVE, REPORT'], - ], $this->response->getHeaders()); - - $this->assertEquals(405, $this->response->status, 'Wrong statuscode received. Full response body: '.$this->response->getBodyAsString()); - } - - /** - * @depends testMKCOLSuccess - * @depends testMKCOLAlreadyExists - */ - public function testMKCOLAndProps() - { - $request = new HTTP\Request( - 'MKCOL', - '/testcol', - ['Content-Type' => 'application/xml'] - ); - $request->setBody('<?xml version="1.0"?> -<mkcol xmlns="DAV:"> - <set> - <prop> - <resourcetype><collection /></resourcetype> - <displayname>my new collection</displayname> - </prop> - </set> -</mkcol>'); - $this->server->httpRequest = ($request); - $this->server->exec(); - - $bodyAsString = $this->response->getBodyAsString(); - $this->assertEquals(207, $this->response->status, 'Wrong statuscode received. Full response body: '.$bodyAsString); - - $this->assertEquals([ - 'X-Sabre-Version' => [Version::VERSION], - 'Content-Type' => ['application/xml; charset=utf-8'], - ], $this->response->getHeaders()); - - $expected = <<<XML -<?xml version="1.0"?> -<d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns"> - <d:response> - <d:href>/testcol</d:href> - <d:propstat> - <d:prop> - <d:displayname /> - </d:prop> - <d:status>HTTP/1.1 403 Forbidden</d:status> - </d:propstat> - </d:response> -</d:multistatus> -XML; - - $this->assertXmlStringEqualsXmlString( - $expected, - $bodyAsString - ); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAV/ServerPluginTest.php b/vendor/sabre/dav/tests/Sabre/DAV/ServerPluginTest.php deleted file mode 100644 index 47e1e6b4c..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAV/ServerPluginTest.php +++ /dev/null @@ -1,96 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAV; - -use Sabre\HTTP; - -class ServerPluginTest extends AbstractServer -{ - /** - * @var Sabre\DAV\TestPlugin - */ - protected $testPlugin; - - public function setup(): void - { - parent::setUp(); - - $testPlugin = new TestPlugin(); - $this->server->addPlugin($testPlugin); - $this->testPlugin = $testPlugin; - } - - public function testBaseClass() - { - $p = new ServerPluginMock(); - $this->assertEquals([], $p->getFeatures()); - $this->assertEquals([], $p->getHTTPMethods('')); - $this->assertEquals( - [ - 'name' => 'Sabre\DAV\ServerPluginMock', - 'description' => null, - 'link' => null, - ], $p->getPluginInfo() - ); - } - - public function testOptions() - { - $serverVars = [ - 'REQUEST_URI' => '/', - 'REQUEST_METHOD' => 'OPTIONS', - ]; - - $request = HTTP\Sapi::createFromServerArray($serverVars); - $this->server->httpRequest = ($request); - $this->server->exec(); - - $this->assertEquals([ - 'DAV' => ['1, 3, extended-mkcol, drinking'], - 'MS-Author-Via' => ['DAV'], - 'Allow' => ['OPTIONS, GET, HEAD, DELETE, PROPFIND, PUT, PROPPATCH, COPY, MOVE, REPORT, BEER, WINE'], - 'Accept-Ranges' => ['bytes'], - 'Content-Length' => ['0'], - 'X-Sabre-Version' => [Version::VERSION], - ], $this->response->getHeaders()); - - $this->assertEquals(200, $this->response->status); - $this->assertEquals('', $this->response->getBodyAsString()); - $this->assertEquals('OPTIONS', $this->testPlugin->beforeMethod); - } - - public function testGetPlugin() - { - $this->assertEquals($this->testPlugin, $this->server->getPlugin(get_class($this->testPlugin))); - } - - public function testUnknownPlugin() - { - $this->assertNull($this->server->getPlugin('SomeRandomClassName')); - } - - public function testGetSupportedReportSet() - { - $this->assertEquals([], $this->testPlugin->getSupportedReportSet('/')); - } - - public function testGetPlugins() - { - $this->assertEquals( - [ - get_class($this->testPlugin) => $this->testPlugin, - 'core' => $this->server->getPlugin('core'), - ], - $this->server->getPlugins() - ); - } -} - -class ServerPluginMock extends ServerPlugin -{ - public function initialize(Server $s) - { - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAV/ServerPropsTest.php b/vendor/sabre/dav/tests/Sabre/DAV/ServerPropsTest.php deleted file mode 100644 index cd1ccfa53..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAV/ServerPropsTest.php +++ /dev/null @@ -1,194 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAV; - -use Sabre\HTTP; - -class ServerPropsTest extends AbstractServer -{ - protected function getRootNode() - { - return new FSExt\Directory(SABRE_TEMPDIR); - } - - public function setup(): void - { - if (file_exists(SABRE_TEMPDIR.'../.sabredav')) { - unlink(SABRE_TEMPDIR.'../.sabredav'); - } - parent::setUp(); - file_put_contents(SABRE_TEMPDIR.'/test2.txt', 'Test contents2'); - mkdir(SABRE_TEMPDIR.'/col'); - file_put_contents(SABRE_TEMPDIR.'col/test.txt', 'Test contents'); - $this->server->addPlugin(new Locks\Plugin(new Locks\Backend\File(SABRE_TEMPDIR.'/.locksdb'))); - } - - public function teardown(): void - { - parent::tearDown(); - if (file_exists(SABRE_TEMPDIR.'../.locksdb')) { - unlink(SABRE_TEMPDIR.'../.locksdb'); - } - } - - private function sendRequest($body, $path = '/', $headers = ['Depth' => '0']) - { - $request = new HTTP\Request('PROPFIND', $path, $headers, $body); - - $this->server->httpRequest = $request; - $this->server->exec(); - } - - public function testPropFindEmptyBody() - { - $this->sendRequest(''); - $this->assertEquals(207, $this->response->status); - - $this->assertEquals([ - 'X-Sabre-Version' => [Version::VERSION], - 'Content-Type' => ['application/xml; charset=utf-8'], - 'DAV' => ['1, 3, extended-mkcol, 2'], - 'Vary' => ['Brief,Prefer'], - ], - $this->response->getHeaders() - ); - - $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/", 'xmlns\\1="urn:DAV"', $this->response->getBodyAsString()); - $xml = simplexml_load_string($body); - $xml->registerXPathNamespace('d', 'urn:DAV'); - - list($data) = $xml->xpath('/d:multistatus/d:response/d:href'); - $this->assertEquals('/', (string) $data, 'href element should have been /'); - - $data = $xml->xpath('/d:multistatus/d:response/d:propstat/d:prop/d:resourcetype'); - $this->assertEquals(1, count($data)); - } - - public function testPropFindEmptyBodyFile() - { - $this->sendRequest('', '/test2.txt', []); - $this->assertEquals(207, $this->response->status); - - $this->assertEquals([ - 'X-Sabre-Version' => [Version::VERSION], - 'Content-Type' => ['application/xml; charset=utf-8'], - 'DAV' => ['1, 3, extended-mkcol, 2'], - 'Vary' => ['Brief,Prefer'], - ], - $this->response->getHeaders() - ); - - $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/", 'xmlns\\1="urn:DAV"', $this->response->getBodyAsString()); - $xml = simplexml_load_string($body); - $xml->registerXPathNamespace('d', 'urn:DAV'); - - list($data) = $xml->xpath('/d:multistatus/d:response/d:href'); - $this->assertEquals('/test2.txt', (string) $data, 'href element should have been /test2.txt'); - - $data = $xml->xpath('/d:multistatus/d:response/d:propstat/d:prop/d:getcontentlength'); - $this->assertEquals(1, count($data)); - } - - public function testSupportedLocks() - { - $xml = '<?xml version="1.0"?> -<d:propfind xmlns:d="DAV:"> - <d:prop> - <d:supportedlock /> - </d:prop> -</d:propfind>'; - - $this->sendRequest($xml); - - $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/", 'xmlns\\1="urn:DAV"', $this->response->getBodyAsString()); - $xml = simplexml_load_string($body); - $xml->registerXPathNamespace('d', 'urn:DAV'); - - $data = $xml->xpath('/d:multistatus/d:response/d:propstat/d:prop/d:supportedlock/d:lockentry'); - $this->assertEquals(2, count($data), 'We expected two \'d:lockentry\' tags'); - - $data = $xml->xpath('/d:multistatus/d:response/d:propstat/d:prop/d:supportedlock/d:lockentry/d:lockscope'); - $this->assertEquals(2, count($data), 'We expected two \'d:lockscope\' tags'); - - $data = $xml->xpath('/d:multistatus/d:response/d:propstat/d:prop/d:supportedlock/d:lockentry/d:locktype'); - $this->assertEquals(2, count($data), 'We expected two \'d:locktype\' tags'); - - $data = $xml->xpath('/d:multistatus/d:response/d:propstat/d:prop/d:supportedlock/d:lockentry/d:lockscope/d:shared'); - $this->assertEquals(1, count($data), 'We expected a \'d:shared\' tag'); - - $data = $xml->xpath('/d:multistatus/d:response/d:propstat/d:prop/d:supportedlock/d:lockentry/d:lockscope/d:exclusive'); - $this->assertEquals(1, count($data), 'We expected a \'d:exclusive\' tag'); - - $data = $xml->xpath('/d:multistatus/d:response/d:propstat/d:prop/d:supportedlock/d:lockentry/d:locktype/d:write'); - $this->assertEquals(2, count($data), 'We expected two \'d:write\' tags'); - } - - public function testLockDiscovery() - { - $xml = '<?xml version="1.0"?> -<d:propfind xmlns:d="DAV:"> - <d:prop> - <d:lockdiscovery /> - </d:prop> -</d:propfind>'; - - $this->sendRequest($xml); - - $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/", 'xmlns\\1="urn:DAV"', $this->response->getBodyAsString()); - $xml = simplexml_load_string($body); - $xml->registerXPathNamespace('d', 'urn:DAV'); - - $data = $xml->xpath('/d:multistatus/d:response/d:propstat/d:prop/d:lockdiscovery'); - $this->assertEquals(1, count($data), 'We expected a \'d:lockdiscovery\' tag'); - } - - public function testUnknownProperty() - { - $xml = '<?xml version="1.0"?> -<d:propfind xmlns:d="DAV:"> - <d:prop> - <d:macaroni /> - </d:prop> -</d:propfind>'; - - $this->sendRequest($xml); - $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/", 'xmlns\\1="urn:DAV"', $this->response->getBodyAsString()); - $xml = simplexml_load_string($body); - $xml->registerXPathNamespace('d', 'urn:DAV'); - $pathTests = [ - '/d:multistatus', - '/d:multistatus/d:response', - '/d:multistatus/d:response/d:propstat', - '/d:multistatus/d:response/d:propstat/d:status', - '/d:multistatus/d:response/d:propstat/d:prop', - '/d:multistatus/d:response/d:propstat/d:prop/d:macaroni', - ]; - foreach ($pathTests as $test) { - $this->assertTrue(true == count($xml->xpath($test)), 'We expected the '.$test.' element to appear in the response, we got: '.$body); - } - - $val = $xml->xpath('/d:multistatus/d:response/d:propstat/d:status'); - $this->assertEquals(1, count($val), $body); - $this->assertEquals('HTTP/1.1 404 Not Found', (string) $val[0]); - } - - public function testParsePropPatchRequest() - { - $body = '<?xml version="1.0"?> -<d:propertyupdate xmlns:d="DAV:" xmlns:s="http://sabredav.org/NS/test"> - <d:set><d:prop><s:someprop>somevalue</s:someprop></d:prop></d:set> - <d:remove><d:prop><s:someprop2 /></d:prop></d:remove> - <d:set><d:prop><s:someprop3>removeme</s:someprop3></d:prop></d:set> - <d:remove><d:prop><s:someprop3 /></d:prop></d:remove> -</d:propertyupdate>'; - - $result = $this->server->xml->parse($body); - $this->assertEquals([ - '{http://sabredav.org/NS/test}someprop' => 'somevalue', - '{http://sabredav.org/NS/test}someprop2' => null, - '{http://sabredav.org/NS/test}someprop3' => null, - ], $result->properties); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAV/ServerRangeTest.php b/vendor/sabre/dav/tests/Sabre/DAV/ServerRangeTest.php deleted file mode 100644 index 6d5be4608..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAV/ServerRangeTest.php +++ /dev/null @@ -1,252 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAV; - -use DateTime; -use Sabre\HTTP; - -/** - * This file tests HTTP requests that use the Range: header. - * - * @copyright Copyright (C) fruux GmbH. (https://fruux.com/) - * @author Evert Pot (http://evertpot.com/) - * @license http://sabre.io/license/ Modified BSD License - */ -class ServerRangeTest extends \Sabre\DAVServerTest -{ - protected $setupFiles = true; - - /** - * We need this string a lot. - */ - protected $lastModified; - - public function setup(): void - { - parent::setUp(); - $this->server->createFile('files/test.txt', 'Test contents'); - - $this->lastModified = HTTP\toDate( - new DateTime('@'.$this->server->tree->getNodeForPath('files/test.txt')->getLastModified()) - ); - - $stream = popen('echo "Test contents"', 'r'); - $streamingFile = new Mock\StreamingFile( - 'no-seeking.txt', - $stream - ); - $streamingFile->setSize(12); - $this->server->tree->getNodeForPath('files')->addNode($streamingFile); - } - - public function testRange() - { - $request = new HTTP\Request('GET', '/files/test.txt', ['Range' => 'bytes=2-5']); - $response = $this->request($request); - - $this->assertEquals([ - 'X-Sabre-Version' => [Version::VERSION], - 'Content-Type' => ['application/octet-stream'], - 'Content-Length' => [4], - 'Content-Range' => ['bytes 2-5/13'], - 'ETag' => ['"'.md5('Test contents').'"'], - 'Last-Modified' => [$this->lastModified], - ], - $response->getHeaders() - ); - $this->assertEquals(206, $response->getStatus()); - $this->assertEquals('st c', $response->getBodyAsString()); - } - - /** - * @depends testRange - */ - public function testStartRange() - { - $request = new HTTP\Request('GET', '/files/test.txt', ['Range' => 'bytes=2-']); - $response = $this->request($request); - - $this->assertEquals([ - 'X-Sabre-Version' => [Version::VERSION], - 'Content-Type' => ['application/octet-stream'], - 'Content-Length' => [11], - 'Content-Range' => ['bytes 2-12/13'], - 'ETag' => ['"'.md5('Test contents').'"'], - 'Last-Modified' => [$this->lastModified], - ], - $response->getHeaders() - ); - - $this->assertEquals(206, $response->getStatus()); - $this->assertEquals('st contents', $response->getBodyAsString()); - } - - /** - * @depends testRange - */ - public function testEndRange() - { - $request = new HTTP\Request('GET', '/files/test.txt', ['Range' => 'bytes=-8']); - $response = $this->request($request); - - $this->assertEquals([ - 'X-Sabre-Version' => [Version::VERSION], - 'Content-Type' => ['application/octet-stream'], - 'Content-Length' => [8], - 'Content-Range' => ['bytes 5-12/13'], - 'ETag' => ['"'.md5('Test contents').'"'], - 'Last-Modified' => [$this->lastModified], - ], - $response->getHeaders() - ); - - $this->assertEquals(206, $response->getStatus()); - $this->assertEquals('contents', $response->getBodyAsString()); - } - - /** - * @depends testRange - */ - public function testTooHighRange() - { - $request = new HTTP\Request('GET', '/files/test.txt', ['Range' => 'bytes=100-200']); - $response = $this->request($request); - - $this->assertEquals(416, $response->getStatus()); - } - - /** - * @depends testRange - */ - public function testCrazyRange() - { - $request = new HTTP\Request('GET', '/files/test.txt', ['Range' => 'bytes=8-4']); - $response = $this->request($request); - - $this->assertEquals(416, $response->getStatus()); - } - - public function testNonSeekableStream() - { - $request = new HTTP\Request('GET', '/files/no-seeking.txt', ['Range' => 'bytes=2-5']); - $response = $this->request($request); - - $this->assertEquals(206, $response->getStatus()); - $this->assertEquals([ - 'X-Sabre-Version' => [Version::VERSION], - 'Content-Type' => ['application/octet-stream'], - 'Content-Length' => [4], - 'Content-Range' => ['bytes 2-5/12'], - // 'ETag' => ['"' . md5('Test contents') . '"'], - 'Last-Modified' => [$this->lastModified], - ], - $response->getHeaders() - ); - - $this->assertEquals('st c', $response->getBodyAsString()); - } - - /** - * @depends testRange - */ - public function testIfRangeEtag() - { - $request = new HTTP\Request('GET', '/files/test.txt', [ - 'Range' => 'bytes=2-5', - 'If-Range' => '"'.md5('Test contents').'"', - ]); - $response = $this->request($request); - - $this->assertEquals([ - 'X-Sabre-Version' => [Version::VERSION], - 'Content-Type' => ['application/octet-stream'], - 'Content-Length' => [4], - 'Content-Range' => ['bytes 2-5/13'], - 'ETag' => ['"'.md5('Test contents').'"'], - 'Last-Modified' => [$this->lastModified], - ], - $response->getHeaders() - ); - - $this->assertEquals(206, $response->getStatus()); - $this->assertEquals('st c', $response->getBodyAsString()); - } - - /** - * @depends testIfRangeEtag - */ - public function testIfRangeEtagIncorrect() - { - $request = new HTTP\Request('GET', '/files/test.txt', [ - 'Range' => 'bytes=2-5', - 'If-Range' => '"foobar"', - ]); - $response = $this->request($request); - - $this->assertEquals([ - 'X-Sabre-Version' => [Version::VERSION], - 'Content-Type' => ['application/octet-stream'], - 'Content-Length' => [13], - 'ETag' => ['"'.md5('Test contents').'"'], - 'Last-Modified' => [$this->lastModified], - ], - $response->getHeaders() - ); - - $this->assertEquals(200, $response->getStatus()); - $this->assertEquals('Test contents', $response->getBodyAsString()); - } - - /** - * @depends testIfRangeEtag - */ - public function testIfRangeModificationDate() - { - $request = new HTTP\Request('GET', '/files/test.txt', [ - 'Range' => 'bytes=2-5', - 'If-Range' => 'tomorrow', - ]); - $response = $this->request($request); - - $this->assertEquals([ - 'X-Sabre-Version' => [Version::VERSION], - 'Content-Type' => ['application/octet-stream'], - 'Content-Length' => [4], - 'Content-Range' => ['bytes 2-5/13'], - 'ETag' => ['"'.md5('Test contents').'"'], - 'Last-Modified' => [$this->lastModified], - ], - $response->getHeaders() - ); - - $this->assertEquals(206, $response->getStatus()); - $this->assertEquals('st c', $response->getBodyAsString()); - } - - /** - * @depends testIfRangeModificationDate - */ - public function testIfRangeModificationDateModified() - { - $request = new HTTP\Request('GET', '/files/test.txt', [ - 'Range' => 'bytes=2-5', - 'If-Range' => '-2 years', - ]); - $response = $this->request($request); - - $this->assertEquals([ - 'X-Sabre-Version' => [Version::VERSION], - 'Content-Type' => ['application/octet-stream'], - 'Content-Length' => [13], - 'ETag' => ['"'.md5('Test contents').'"'], - 'Last-Modified' => [$this->lastModified], - ], - $response->getHeaders() - ); - - $this->assertEquals(200, $response->getStatus()); - $this->assertEquals('Test contents', $response->getBodyAsString()); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAV/ServerSimpleTest.php b/vendor/sabre/dav/tests/Sabre/DAV/ServerSimpleTest.php deleted file mode 100644 index e4dd3cdb6..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAV/ServerSimpleTest.php +++ /dev/null @@ -1,433 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAV; - -use Sabre\HTTP; - -class ServerSimpleTest extends AbstractServer -{ - public function testConstructArray() - { - $nodes = [ - new SimpleCollection('hello'), - ]; - - $server = new Server($nodes); - $this->assertEquals($nodes[0], $server->tree->getNodeForPath('hello')); - } - - public function testConstructInvalidArg() - { - $this->expectException('Sabre\DAV\Exception'); - $server = new Server(1); - } - - public function testOptions() - { - $request = new HTTP\Request('OPTIONS', '/'); - $this->server->httpRequest = $request; - $this->server->exec(); - - $this->assertEquals([ - 'DAV' => ['1, 3, extended-mkcol'], - 'MS-Author-Via' => ['DAV'], - 'Allow' => ['OPTIONS, GET, HEAD, DELETE, PROPFIND, PUT, PROPPATCH, COPY, MOVE, REPORT'], - 'Accept-Ranges' => ['bytes'], - 'Content-Length' => ['0'], - 'X-Sabre-Version' => [Version::VERSION], - ], $this->response->getHeaders()); - - $this->assertEquals(200, $this->response->status); - $this->assertEquals('', $this->response->getBodyAsString()); - } - - public function testOptionsUnmapped() - { - $request = new HTTP\Request('OPTIONS', '/unmapped'); - $this->server->httpRequest = $request; - - $this->server->exec(); - - $this->assertEquals([ - 'DAV' => ['1, 3, extended-mkcol'], - 'MS-Author-Via' => ['DAV'], - 'Allow' => ['OPTIONS, GET, HEAD, DELETE, PROPFIND, PUT, PROPPATCH, COPY, MOVE, REPORT, MKCOL'], - 'Accept-Ranges' => ['bytes'], - 'Content-Length' => ['0'], - 'X-Sabre-Version' => [Version::VERSION], - ], $this->response->getHeaders()); - - $this->assertEquals(200, $this->response->status); - $this->assertEquals('', $this->response->getBodyAsString()); - } - - public function testNonExistantMethod() - { - $serverVars = [ - 'REQUEST_URI' => '/', - 'REQUEST_METHOD' => 'BLABLA', - ]; - - $request = HTTP\Sapi::createFromServerArray($serverVars); - $this->server->httpRequest = ($request); - $this->server->exec(); - - $this->assertEquals([ - 'X-Sabre-Version' => [Version::VERSION], - 'Content-Type' => ['application/xml; charset=utf-8'], - ], $this->response->getHeaders()); - - $this->assertEquals(501, $this->response->status); - } - - public function testBaseUri() - { - $serverVars = [ - 'REQUEST_URI' => '/blabla/test.txt', - 'REQUEST_METHOD' => 'GET', - ]; - $filename = $this->tempDir.'/test.txt'; - - $request = HTTP\Sapi::createFromServerArray($serverVars); - $this->server->setBaseUri('/blabla/'); - $this->assertEquals('/blabla/', $this->server->getBaseUri()); - $this->server->httpRequest = ($request); - $this->server->exec(); - - $this->assertEquals([ - 'X-Sabre-Version' => [Version::VERSION], - 'Content-Type' => ['application/octet-stream'], - 'Content-Length' => [13], - 'Last-Modified' => [HTTP\toDate(new \DateTime('@'.filemtime($filename)))], - 'ETag' => ['"'.sha1(fileinode($filename).filesize($filename).filemtime($filename)).'"'], - ], - $this->response->getHeaders() - ); - - $this->assertEquals(200, $this->response->status); - $this->assertEquals('Test contents', stream_get_contents($this->response->body)); - } - - public function testBaseUriAddSlash() - { - $tests = [ - '/' => '/', - '/foo' => '/foo/', - '/foo/' => '/foo/', - '/foo/bar' => '/foo/bar/', - '/foo/bar/' => '/foo/bar/', - ]; - - foreach ($tests as $test => $result) { - $this->server->setBaseUri($test); - - $this->assertEquals($result, $this->server->getBaseUri()); - } - } - - public function testCalculateUri() - { - $uris = [ - 'http://www.example.org/root/somepath', - '/root/somepath', - '/root/somepath/', - '//root/somepath/', - '///root///somepath///', - ]; - - $this->server->setBaseUri('/root/'); - - foreach ($uris as $uri) { - $this->assertEquals('somepath', $this->server->calculateUri($uri)); - } - - $this->server->setBaseUri('/root'); - - foreach ($uris as $uri) { - $this->assertEquals('somepath', $this->server->calculateUri($uri)); - } - - $this->assertEquals('', $this->server->calculateUri('/root')); - - $this->server->setBaseUri('/'); - - foreach ($uris as $uri) { - $this->assertEquals('root/somepath', $this->server->calculateUri($uri)); - } - - $this->assertEquals('', $this->server->calculateUri('')); - } - - public function testCalculateUriSpecialChars() - { - $uris = [ - 'http://www.example.org/root/%C3%A0fo%C3%B3', - '/root/%C3%A0fo%C3%B3', - '/root/%C3%A0fo%C3%B3/', - ]; - - $this->server->setBaseUri('/root/'); - - foreach ($uris as $uri) { - $this->assertEquals("\xc3\xa0fo\xc3\xb3", $this->server->calculateUri($uri)); - } - - $this->server->setBaseUri('/root'); - - foreach ($uris as $uri) { - $this->assertEquals("\xc3\xa0fo\xc3\xb3", $this->server->calculateUri($uri)); - } - - $this->server->setBaseUri('/'); - - foreach ($uris as $uri) { - $this->assertEquals("root/\xc3\xa0fo\xc3\xb3", $this->server->calculateUri($uri)); - } - } - - public function testCalculateUriBreakout() - { - $this->expectException('Sabre\DAV\Exception\Forbidden'); - $uri = '/path1/'; - - $this->server->setBaseUri('/path2/'); - $this->server->calculateUri($uri); - } - - public function testGuessBaseUri() - { - $serverVars = [ - 'REQUEST_METHOD' => 'GET', - 'REQUEST_URI' => '/index.php/root', - 'PATH_INFO' => '/root', - ]; - - $httpRequest = HTTP\Sapi::createFromServerArray($serverVars); - $server = new Server(); - $server->httpRequest = $httpRequest; - - $this->assertEquals('/index.php/', $server->guessBaseUri()); - } - - /** - * @depends testGuessBaseUri - */ - public function testGuessBaseUriPercentEncoding() - { - $serverVars = [ - 'REQUEST_METHOD' => 'GET', - 'REQUEST_URI' => '/index.php/dir/path2/path%20with%20spaces', - 'PATH_INFO' => '/dir/path2/path with spaces', - ]; - - $httpRequest = HTTP\Sapi::createFromServerArray($serverVars); - $server = new Server(); - $server->httpRequest = $httpRequest; - - $this->assertEquals('/index.php/', $server->guessBaseUri()); - } - - /** - * @depends testGuessBaseUri - */ - /* - function testGuessBaseUriPercentEncoding2() { - - $this->markTestIncomplete('This behaviour is not yet implemented'); - $serverVars = [ - 'REQUEST_URI' => '/some%20directory+mixed/index.php/dir/path2/path%20with%20spaces', - 'PATH_INFO' => '/dir/path2/path with spaces', - ]; - - $httpRequest = HTTP\Sapi::createFromServerArray($serverVars); - $server = new Server(); - $server->httpRequest = $httpRequest; - - $this->assertEquals('/some%20directory+mixed/index.php/', $server->guessBaseUri()); - - }*/ - - public function testGuessBaseUri2() - { - $serverVars = [ - 'REQUEST_METHOD' => 'GET', - 'REQUEST_URI' => '/index.php/root/', - 'PATH_INFO' => '/root/', - ]; - - $httpRequest = HTTP\Sapi::createFromServerArray($serverVars); - $server = new Server(); - $server->httpRequest = $httpRequest; - - $this->assertEquals('/index.php/', $server->guessBaseUri()); - } - - public function testGuessBaseUriNoPathInfo() - { - $serverVars = [ - 'REQUEST_METHOD' => 'GET', - 'REQUEST_URI' => '/index.php/root', - ]; - - $httpRequest = HTTP\Sapi::createFromServerArray($serverVars); - $server = new Server(); - $server->httpRequest = $httpRequest; - - $this->assertEquals('/', $server->guessBaseUri()); - } - - public function testGuessBaseUriNoPathInfo2() - { - $httpRequest = new HTTP\Request('GET', '/a/b/c/test.php'); - $server = new Server(); - $server->httpRequest = $httpRequest; - - $this->assertEquals('/', $server->guessBaseUri()); - } - - /** - * @depends testGuessBaseUri - */ - public function testGuessBaseUriQueryString() - { - $serverVars = [ - 'REQUEST_METHOD' => 'GET', - 'REQUEST_URI' => '/index.php/root?query_string=blabla', - 'PATH_INFO' => '/root', - ]; - - $httpRequest = HTTP\Sapi::createFromServerArray($serverVars); - $server = new Server(); - $server->httpRequest = $httpRequest; - - $this->assertEquals('/index.php/', $server->guessBaseUri()); - } - - /** - * @depends testGuessBaseUri - */ - public function testGuessBaseUriBadConfig() - { - $this->expectException('Sabre\DAV\Exception'); - $serverVars = [ - 'REQUEST_METHOD' => 'GET', - 'REQUEST_URI' => '/index.php/root/heyyy', - 'PATH_INFO' => '/root', - ]; - - $httpRequest = HTTP\Sapi::createFromServerArray($serverVars); - $server = new Server(); - $server->httpRequest = $httpRequest; - - $server->guessBaseUri(); - } - - public function testTriggerException() - { - $serverVars = [ - 'REQUEST_URI' => '/', - 'REQUEST_METHOD' => 'FOO', - ]; - - $httpRequest = HTTP\Sapi::createFromServerArray($serverVars); - $this->server->httpRequest = $httpRequest; - $this->server->on('beforeMethod:*', [$this, 'exceptionTrigger']); - $this->server->exec(); - - $this->assertEquals([ - 'Content-Type' => ['application/xml; charset=utf-8'], - ], $this->response->getHeaders()); - - $this->assertEquals(500, $this->response->status); - } - - public function exceptionTrigger($request, $response) - { - throw new Exception('Hola'); - } - - public function testReportNotFound() - { - $serverVars = [ - 'REQUEST_URI' => '/', - 'REQUEST_METHOD' => 'REPORT', - ]; - - $request = HTTP\Sapi::createFromServerArray($serverVars); - $this->server->httpRequest = ($request); - $this->server->httpRequest->setBody('<?xml version="1.0"?><bla:myreport xmlns:bla="http://www.rooftopsolutions.nl/NS"></bla:myreport>'); - $this->server->exec(); - - $this->assertEquals([ - 'X-Sabre-Version' => [Version::VERSION], - 'Content-Type' => ['application/xml; charset=utf-8'], - ], - $this->response->getHeaders() - ); - - $this->assertEquals(415, $this->response->status, 'We got an incorrect status back. Full response body follows: '.$this->response->getBodyAsString()); - } - - public function testReportIntercepted() - { - $serverVars = [ - 'REQUEST_URI' => '/', - 'REQUEST_METHOD' => 'REPORT', - ]; - - $request = HTTP\Sapi::createFromServerArray($serverVars); - $this->server->httpRequest = ($request); - $this->server->httpRequest->setBody('<?xml version="1.0"?><bla:myreport xmlns:bla="http://www.rooftopsolutions.nl/NS"></bla:myreport>'); - $this->server->on('report', [$this, 'reportHandler']); - $this->server->exec(); - - $this->assertEquals([ - 'X-Sabre-Version' => [Version::VERSION], - 'testheader' => ['testvalue'], - ], - $this->response->getHeaders() - ); - - $this->assertEquals(418, $this->response->status, 'We got an incorrect status back. Full response body follows: '.$this->response->getBodyAsString()); - } - - public function reportHandler($reportName, $result, $path) - { - if ('{http://www.rooftopsolutions.nl/NS}myreport' == $reportName) { - $this->server->httpResponse->setStatus(418); - $this->server->httpResponse->setHeader('testheader', 'testvalue'); - - return false; - } else { - return; - } - } - - public function testGetPropertiesForChildren() - { - $result = $this->server->getPropertiesForChildren('', [ - '{DAV:}getcontentlength', - ]); - - $expected = [ - 'test.txt' => ['{DAV:}getcontentlength' => 13], - 'dir/' => [], - ]; - - $this->assertEquals($expected, $result); - } - - /** - * There are certain cases where no HTTP status may be set. We need to - * intercept these and set it to a default error message. - */ - public function testNoHTTPStatusSet() - { - $this->server->on('method:GET', function () { return false; }, 1); - $this->server->httpRequest = new HTTP\Request('GET', '/'); - $this->server->exec(); - $this->assertEquals(500, $this->response->getStatus()); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAV/ServerUpdatePropertiesTest.php b/vendor/sabre/dav/tests/Sabre/DAV/ServerUpdatePropertiesTest.php deleted file mode 100644 index cb8a4ab32..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAV/ServerUpdatePropertiesTest.php +++ /dev/null @@ -1,97 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAV; - -class ServerUpdatePropertiesTest extends \PHPUnit\Framework\TestCase -{ - public function testUpdatePropertiesFail() - { - $tree = [ - new SimpleCollection('foo'), - ]; - $server = new Server($tree); - - $result = $server->updateProperties('foo', [ - '{DAV:}foo' => 'bar', - ]); - - $expected = [ - '{DAV:}foo' => 403, - ]; - $this->assertEquals($expected, $result); - } - - public function testUpdatePropertiesProtected() - { - $tree = [ - new SimpleCollection('foo'), - ]; - $server = new Server($tree); - - $server->on('propPatch', function ($path, PropPatch $propPatch) { - $propPatch->handleRemaining(function () { return true; }); - }); - $result = $server->updateProperties('foo', [ - '{DAV:}getetag' => 'bla', - '{DAV:}foo' => 'bar', - ]); - - $expected = [ - '{DAV:}getetag' => 403, - '{DAV:}foo' => 424, - ]; - $this->assertEquals($expected, $result); - } - - public function testUpdatePropertiesEventFail() - { - $tree = [ - new SimpleCollection('foo'), - ]; - $server = new Server($tree); - $server->on('propPatch', function ($path, PropPatch $propPatch) { - $propPatch->setResultCode('{DAV:}foo', 404); - $propPatch->handleRemaining(function () { return true; }); - }); - - $result = $server->updateProperties('foo', [ - '{DAV:}foo' => 'bar', - '{DAV:}foo2' => 'bla', - ]); - - $expected = [ - '{DAV:}foo' => 404, - '{DAV:}foo2' => 424, - ]; - $this->assertEquals($expected, $result); - } - - public function testUpdatePropertiesEventSuccess() - { - $tree = [ - new SimpleCollection('foo'), - ]; - $server = new Server($tree); - $server->on('propPatch', function ($path, PropPatch $propPatch) { - $propPatch->handle(['{DAV:}foo', '{DAV:}foo2'], function () { - return [ - '{DAV:}foo' => 200, - '{DAV:}foo2' => 201, - ]; - }); - }); - - $result = $server->updateProperties('foo', [ - '{DAV:}foo' => 'bar', - '{DAV:}foo2' => 'bla', - ]); - - $expected = [ - '{DAV:}foo' => 200, - '{DAV:}foo2' => 201, - ]; - $this->assertEquals($expected, $result); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAV/SimpleFileTest.php b/vendor/sabre/dav/tests/Sabre/DAV/SimpleFileTest.php deleted file mode 100644 index 6edca5ecc..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAV/SimpleFileTest.php +++ /dev/null @@ -1,19 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAV; - -class SimpleFileTest extends \PHPUnit\Framework\TestCase -{ - public function testAll() - { - $file = new SimpleFile('filename.txt', 'contents', 'text/plain'); - - $this->assertEquals('filename.txt', $file->getName()); - $this->assertEquals('contents', $file->get()); - $this->assertEquals(8, $file->getSize()); - $this->assertEquals('"'.sha1('contents').'"', $file->getETag()); - $this->assertEquals('text/plain', $file->getContentType()); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAV/StringUtilTest.php b/vendor/sabre/dav/tests/Sabre/DAV/StringUtilTest.php deleted file mode 100644 index bc36c6b78..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAV/StringUtilTest.php +++ /dev/null @@ -1,119 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAV; - -class StringUtilTest extends \PHPUnit\Framework\TestCase -{ - /** - * @param string $haystack - * @param string $needle - * @param string $collation - * @param string $matchType - * @param string $result - * - * @throws Exception\BadRequest - * - * @dataProvider dataset - */ - public function testTextMatch($haystack, $needle, $collation, $matchType, $result) - { - $this->assertEquals($result, StringUtil::textMatch($haystack, $needle, $collation, $matchType)); - } - - public function dataset() - { - return [ - ['FOOBAR', 'FOO', 'i;octet', 'contains', true], - ['FOOBAR', 'foo', 'i;octet', 'contains', false], - ['FÖÖBAR', 'FÖÖ', 'i;octet', 'contains', true], - ['FÖÖBAR', 'föö', 'i;octet', 'contains', false], - ['FOOBAR', 'FOOBAR', 'i;octet', 'equals', true], - ['FOOBAR', 'fooBAR', 'i;octet', 'equals', false], - ['FOOBAR', 'FOO', 'i;octet', 'starts-with', true], - ['FOOBAR', 'foo', 'i;octet', 'starts-with', false], - ['FOOBAR', 'BAR', 'i;octet', 'starts-with', false], - ['FOOBAR', 'bar', 'i;octet', 'starts-with', false], - ['FOOBAR', 'FOO', 'i;octet', 'ends-with', false], - ['FOOBAR', 'foo', 'i;octet', 'ends-with', false], - ['FOOBAR', 'BAR', 'i;octet', 'ends-with', true], - ['FOOBAR', 'bar', 'i;octet', 'ends-with', false], - - ['FOOBAR', 'FOO', 'i;ascii-casemap', 'contains', true], - ['FOOBAR', 'foo', 'i;ascii-casemap', 'contains', true], - ['FÖÖBAR', 'FÖÖ', 'i;ascii-casemap', 'contains', true], - ['FÖÖBAR', 'föö', 'i;ascii-casemap', 'contains', false], - ['FOOBAR', 'FOOBAR', 'i;ascii-casemap', 'equals', true], - ['FOOBAR', 'fooBAR', 'i;ascii-casemap', 'equals', true], - ['FOOBAR', 'FOO', 'i;ascii-casemap', 'starts-with', true], - ['FOOBAR', 'foo', 'i;ascii-casemap', 'starts-with', true], - ['FOOBAR', 'BAR', 'i;ascii-casemap', 'starts-with', false], - ['FOOBAR', 'bar', 'i;ascii-casemap', 'starts-with', false], - ['FOOBAR', 'FOO', 'i;ascii-casemap', 'ends-with', false], - ['FOOBAR', 'foo', 'i;ascii-casemap', 'ends-with', false], - ['FOOBAR', 'BAR', 'i;ascii-casemap', 'ends-with', true], - ['FOOBAR', 'bar', 'i;ascii-casemap', 'ends-with', true], - - ['FOOBAR', 'FOO', 'i;unicode-casemap', 'contains', true], - ['FOOBAR', 'foo', 'i;unicode-casemap', 'contains', true], - ['FÖÖBAR', 'FÖÖ', 'i;unicode-casemap', 'contains', true], - ['FÖÖBAR', 'föö', 'i;unicode-casemap', 'contains', true], - ['FOOBAR', 'FOOBAR', 'i;unicode-casemap', 'equals', true], - ['FOOBAR', 'fooBAR', 'i;unicode-casemap', 'equals', true], - ['FOOBAR', 'FOO', 'i;unicode-casemap', 'starts-with', true], - ['FOOBAR', 'foo', 'i;unicode-casemap', 'starts-with', true], - ['FOOBAR', 'BAR', 'i;unicode-casemap', 'starts-with', false], - ['FOOBAR', 'bar', 'i;unicode-casemap', 'starts-with', false], - ['FOOBAR', 'FOO', 'i;unicode-casemap', 'ends-with', false], - ['FOOBAR', 'foo', 'i;unicode-casemap', 'ends-with', false], - ['FOOBAR', 'BAR', 'i;unicode-casemap', 'ends-with', true], - ['FOOBAR', 'bar', 'i;unicode-casemap', 'ends-with', true], - ]; - } - - public function testBadCollation() - { - $this->expectException('Sabre\DAV\Exception\BadRequest'); - StringUtil::textMatch('foobar', 'foo', 'blabla', 'contains'); - } - - public function testBadMatchType() - { - $this->expectException('Sabre\DAV\Exception\BadRequest'); - StringUtil::textMatch('foobar', 'foo', 'i;octet', 'booh'); - } - - public function testEnsureUTF8_ascii() - { - $inputString = 'harkema'; - $outputString = 'harkema'; - - $this->assertEquals( - $outputString, - StringUtil::ensureUTF8($inputString) - ); - } - - public function testEnsureUTF8_latin1() - { - $inputString = "m\xfcnster"; - $outputString = 'münster'; - - $this->assertEquals( - $outputString, - StringUtil::ensureUTF8($inputString) - ); - } - - public function testEnsureUTF8_utf8() - { - $inputString = "m\xc3\xbcnster"; - $outputString = 'münster'; - - $this->assertEquals( - $outputString, - StringUtil::ensureUTF8($inputString) - ); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAV/TemporaryFileFilterTest.php b/vendor/sabre/dav/tests/Sabre/DAV/TemporaryFileFilterTest.php deleted file mode 100644 index 951078bf0..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAV/TemporaryFileFilterTest.php +++ /dev/null @@ -1,204 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAV; - -use Sabre\HTTP; - -class TemporaryFileFilterTest extends AbstractServer -{ - public function setup(): void - { - parent::setUp(); - $plugin = new TemporaryFileFilterPlugin(SABRE_TEMPDIR.'/tff'); - $this->server->addPlugin($plugin); - } - - public function testPutNormal() - { - $request = new HTTP\Request('PUT', '/testput.txt', [], 'Testing new file'); - - $this->server->httpRequest = ($request); - $this->server->exec(); - - $this->assertEquals('', $this->response->getBodyAsString()); - $this->assertEquals(201, $this->response->status); - $this->assertEquals('0', $this->response->getHeader('Content-Length')); - - $this->assertEquals('Testing new file', file_get_contents(SABRE_TEMPDIR.'/testput.txt')); - } - - public function testPutTemp() - { - // mimicking an OS/X resource fork - $request = new HTTP\Request('PUT', '/._testput.txt', [], 'Testing new file'); - - $this->server->httpRequest = ($request); - $this->server->exec(); - - $this->assertEquals('', $this->response->getBodyAsString()); - $this->assertEquals(201, $this->response->status); - $this->assertEquals([ - 'X-Sabre-Temp' => ['true'], - ], $this->response->getHeaders()); - - $this->assertFalse(file_exists(SABRE_TEMPDIR.'/._testput.txt'), '._testput.txt should not exist in the regular file structure.'); - } - - public function testPutTempIfNoneMatch() - { - // mimicking an OS/X resource fork - $request = new HTTP\Request('PUT', '/._testput.txt', ['If-None-Match' => '*'], 'Testing new file'); - - $this->server->httpRequest = ($request); - $this->server->exec(); - - $this->assertEquals('', $this->response->getBodyAsString()); - $this->assertEquals(201, $this->response->status); - $this->assertEquals([ - 'X-Sabre-Temp' => ['true'], - ], $this->response->getHeaders()); - - $this->assertFalse(file_exists(SABRE_TEMPDIR.'/._testput.txt'), '._testput.txt should not exist in the regular file structure.'); - - $this->server->exec(); - - $this->assertEquals(412, $this->response->status); - $this->assertEquals([ - 'X-Sabre-Temp' => ['true'], - 'Content-Type' => ['application/xml; charset=utf-8'], - ], $this->response->getHeaders()); - } - - public function testPutGet() - { - // mimicking an OS/X resource fork - $request = new HTTP\Request('PUT', '/._testput.txt', [], 'Testing new file'); - $this->server->httpRequest = ($request); - $this->server->exec(); - - $this->assertEquals('', $this->response->getBodyAsString()); - $this->assertEquals(201, $this->response->status); - $this->assertEquals([ - 'X-Sabre-Temp' => ['true'], - ], $this->response->getHeaders()); - - $request = new HTTP\Request('GET', '/._testput.txt'); - - $this->server->httpRequest = $request; - $this->server->exec(); - - $this->assertEquals(200, $this->response->status); - $this->assertEquals([ - 'X-Sabre-Temp' => ['true'], - 'Content-Length' => [16], - 'Content-Type' => ['application/octet-stream'], - ], $this->response->getHeaders()); - - $this->assertEquals('Testing new file', stream_get_contents($this->response->body)); - } - - public function testGetWithBrowserPlugin() - { - $this->server->addPlugin(new Browser\Plugin()); - $request = new HTTP\Request('GET', '/'); - - $this->server->httpRequest = $request; - $this->server->exec(); - - $this->assertEquals(200, $this->response->status); - } - - public function testLockNonExistant() - { - mkdir(SABRE_TEMPDIR.'/locksdir'); - $locksBackend = new Locks\Backend\File(SABRE_TEMPDIR.'/locks'); - $locksPlugin = new Locks\Plugin($locksBackend); - $this->server->addPlugin($locksPlugin); - - // mimicking an OS/X resource fork - $request = new HTTP\Request('LOCK', '/._testput.txt'); - $request->setBody('<?xml version="1.0"?> -<D:lockinfo xmlns:D="DAV:"> - <D:lockscope><D:exclusive/></D:lockscope> - <D:locktype><D:write/></D:locktype> - <D:owner> - <D:href>http://example.org/~ejw/contact.html</D:href> - </D:owner> -</D:lockinfo>'); - - $this->server->httpRequest = ($request); - $this->server->exec(); - - $this->assertEquals(201, $this->response->status); - $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); - $this->assertTrue(1 === preg_match('/^<opaquelocktoken:(.*)>$/', $this->response->getHeader('Lock-Token')), 'We did not get a valid Locktoken back ('.$this->response->getHeader('Lock-Token').')'); - $this->assertEquals('true', $this->response->getHeader('X-Sabre-Temp')); - - $this->assertFalse(file_exists(SABRE_TEMPDIR.'/._testlock.txt'), '._testlock.txt should not exist in the regular file structure.'); - } - - public function testPutDelete() - { - // mimicking an OS/X resource fork - $request = new HTTP\Request('PUT', '/._testput.txt', [], 'Testing new file'); - - $this->server->httpRequest = $request; - $this->server->exec(); - - $this->assertEquals('', $this->response->getBodyAsString()); - $this->assertEquals(201, $this->response->status); - $this->assertEquals([ - 'X-Sabre-Temp' => ['true'], - ], $this->response->getHeaders()); - - $request = new HTTP\Request('DELETE', '/._testput.txt'); - $this->server->httpRequest = $request; - $this->server->exec(); - - $this->assertEquals(204, $this->response->status, "Incorrect status code received. Full body:\n".$this->response->getBodyAsString()); - $this->assertEquals([ - 'X-Sabre-Temp' => ['true'], - ], $this->response->getHeaders()); - - $this->assertEquals('', $this->response->getBodyAsString()); - } - - public function testPutPropfind() - { - // mimicking an OS/X resource fork - $request = new HTTP\Request('PUT', '/._testput.txt', [], 'Testing new file'); - $this->server->httpRequest = $request; - $this->server->exec(); - - $bodyAsString = $this->response->getBodyAsString(); - $this->assertEquals('', $bodyAsString); - $this->assertEquals(201, $this->response->status); - $this->assertEquals([ - 'X-Sabre-Temp' => ['true'], - ], $this->response->getHeaders()); - - $request = new HTTP\Request('PROPFIND', '/._testput.txt'); - - $this->server->httpRequest = ($request); - $this->server->exec(); - - $bodyAsString = $this->response->getBodyAsString(); - $this->assertEquals(207, $this->response->status, 'Incorrect status code returned. Body: '.$bodyAsString); - $this->assertEquals([ - 'X-Sabre-Temp' => ['true'], - 'Content-Type' => ['application/xml; charset=utf-8'], - ], $this->response->getHeaders()); - - $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/", 'xmlns\\1="urn:DAV"', $bodyAsString); - $xml = simplexml_load_string($body); - $xml->registerXPathNamespace('d', 'urn:DAV'); - - list($data) = $xml->xpath('/d:multistatus/d:response/d:href'); - $this->assertEquals('/._testput.txt', (string) $data, 'href element should have been /._testput.txt'); - - $data = $xml->xpath('/d:multistatus/d:response/d:propstat/d:prop/d:resourcetype'); - $this->assertEquals(1, count($data)); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAV/TestPlugin.php b/vendor/sabre/dav/tests/Sabre/DAV/TestPlugin.php deleted file mode 100644 index 3bfe3b3b0..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAV/TestPlugin.php +++ /dev/null @@ -1,35 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAV; - -use Sabre\HTTP\RequestInterface; -use Sabre\HTTP\ResponseInterface; - -class TestPlugin extends ServerPlugin -{ - public $beforeMethod; - - public function getFeatures() - { - return ['drinking']; - } - - public function getHTTPMethods($uri) - { - return ['BEER', 'WINE']; - } - - public function initialize(Server $server) - { - $server->on('beforeMethod:*', [$this, 'beforeMethod']); - } - - public function beforeMethod(RequestInterface $request, ResponseInterface $response) - { - $this->beforeMethod = $request->getMethod(); - - return true; - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAV/TreeTest.php b/vendor/sabre/dav/tests/Sabre/DAV/TreeTest.php deleted file mode 100644 index e3f04ea3a..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAV/TreeTest.php +++ /dev/null @@ -1,238 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAV; - -class TreeTest extends \PHPUnit\Framework\TestCase -{ - public function testNodeExists() - { - $tree = new TreeMock(); - - $this->assertTrue($tree->nodeExists('hi')); - $this->assertFalse($tree->nodeExists('hello')); - } - - public function testCopy() - { - $tree = new TreeMock(); - $tree->copy('hi', 'hi2'); - - $this->assertArrayHasKey('hi2', $tree->getNodeForPath('')->newDirectories); - $this->assertEquals('foobar', $tree->getNodeForPath('hi/file')->get()); - $this->assertEquals(['test1' => 'value'], $tree->getNodeForPath('hi/file')->getProperties([])); - } - - public function testCopyFile() - { - $tree = new TreeMock(); - $tree->copy('hi/file', 'hi/newfile'); - - $this->assertArrayHasKey('newfile', $tree->getNodeForPath('hi')->newFiles); - } - - public function testCopyFile0() - { - $tree = new TreeMock(); - $tree->copy('hi/file', 'hi/0'); - - $this->assertArrayHasKey('0', $tree->getNodeForPath('hi')->newFiles); - } - - public function testMove() - { - $tree = new TreeMock(); - $tree->move('hi', 'hi2'); - - $this->assertEquals('hi2', $tree->getNodeForPath('hi')->getName()); - $this->assertTrue($tree->getNodeForPath('hi')->isRenamed); - } - - public function testDeepMove() - { - $tree = new TreeMock(); - $tree->move('hi/sub', 'hi2'); - - $this->assertArrayHasKey('hi2', $tree->getNodeForPath('')->newDirectories); - $this->assertTrue($tree->getNodeForPath('hi/sub')->isDeleted); - } - - public function testDelete() - { - $tree = new TreeMock(); - $tree->delete('hi'); - $this->assertTrue($tree->getNodeForPath('hi')->isDeleted); - } - - public function testGetChildren() - { - $tree = new TreeMock(); - $children = $tree->getChildren(''); - $firstChild = $children->current(); - $this->assertEquals('hi', $firstChild->getName()); - } - - public function testGetMultipleNodes() - { - $tree = new TreeMock(); - $result = $tree->getMultipleNodes(['hi/sub', 'hi/file']); - $this->assertArrayHasKey('hi/sub', $result); - $this->assertArrayHasKey('hi/file', $result); - - $this->assertEquals('sub', $result['hi/sub']->getName()); - $this->assertEquals('file', $result['hi/file']->getName()); - } - - public function testGetMultipleNodes2() - { - $tree = new TreeMock(); - $result = $tree->getMultipleNodes(['multi/1', 'multi/2']); - $this->assertArrayHasKey('multi/1', $result); - $this->assertArrayHasKey('multi/2', $result); - } -} - -class TreeMock extends Tree -{ - private $nodes = []; - - public function __construct() - { - $file = new TreeFileTester('file'); - $file->properties = ['test1' => 'value']; - $file->data = 'foobar'; - - parent::__construct( - new TreeDirectoryTester('root', [ - new TreeDirectoryTester('hi', [ - new TreeDirectoryTester('sub'), - $file, - ]), - new TreeMultiGetTester('multi', [ - new TreeFileTester('1'), - new TreeFileTester('2'), - new TreeFileTester('3'), - ]), - ]) - ); - } -} - -class TreeDirectoryTester extends SimpleCollection -{ - public $newDirectories = []; - public $newFiles = []; - public $isDeleted = false; - public $isRenamed = false; - - public function createDirectory($name) - { - $this->newDirectories[$name] = true; - } - - public function createFile($name, $data = null) - { - $this->newFiles[$name] = $data; - } - - public function getChild($name) - { - if (isset($this->newDirectories[$name])) { - return new self($name); - } - if (isset($this->newFiles[$name])) { - return new TreeFileTester($name, $this->newFiles[$name]); - } - - return parent::getChild($name); - } - - public function childExists($name) - { - return (bool) $this->getChild($name); - } - - public function delete() - { - $this->isDeleted = true; - } - - public function setName($name) - { - $this->isRenamed = true; - $this->name = $name; - } -} - -class TreeFileTester extends File implements IProperties -{ - public $name; - public $data; - public $properties; - - public function __construct($name, $data = null) - { - $this->name = $name; - if (is_null($data)) { - $data = 'bla'; - } - $this->data = $data; - } - - public function getName() - { - return $this->name; - } - - public function get() - { - return $this->data; - } - - public function getProperties($properties) - { - return $this->properties; - } - - /** - * Updates properties on this node. - * - * This method received a PropPatch object, which contains all the - * information about the update. - * - * To update specific properties, call the 'handle' method on this object. - * Read the PropPatch documentation for more information. - */ - public function propPatch(PropPatch $propPatch) - { - $this->properties = $propPatch->getMutations(); - $propPatch->setRemainingResultCode(200); - } -} - -class TreeMultiGetTester extends TreeDirectoryTester implements IMultiGet -{ - /** - * This method receives a list of paths in it's first argument. - * It must return an array with Node objects. - * - * If any children are not found, you do not have to return them. - * - * @return array - */ - public function getMultipleChildren(array $paths) - { - $result = []; - foreach ($paths as $path) { - try { - $child = $this->getChild($path); - $result[] = $child; - } catch (Exception\NotFound $e) { - // Do nothing - } - } - - return $result; - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAV/UUIDUtilTest.php b/vendor/sabre/dav/tests/Sabre/DAV/UUIDUtilTest.php deleted file mode 100644 index d7ef9bec9..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAV/UUIDUtilTest.php +++ /dev/null @@ -1,24 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAV; - -class UUIDUtilTest extends \PHPUnit\Framework\TestCase -{ - public function testValidateUUID() - { - $this->assertTrue( - UUIDUtil::validateUUID('11111111-2222-3333-4444-555555555555') - ); - $this->assertFalse( - UUIDUtil::validateUUID(' 11111111-2222-3333-4444-555555555555') - ); - $this->assertTrue( - UUIDUtil::validateUUID('ffffffff-2222-3333-4444-555555555555') - ); - $this->assertFalse( - UUIDUtil::validateUUID('fffffffg-2222-3333-4444-555555555555') - ); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/ACLMethodTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/ACLMethodTest.php deleted file mode 100644 index 715559df3..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/ACLMethodTest.php +++ /dev/null @@ -1,311 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAVACL; - -use Sabre\DAV; -use Sabre\HTTP; - -class ACLMethodTest extends \PHPUnit\Framework\TestCase -{ - public function testCallback() - { - $this->expectException('Sabre\DAV\Exception\BadRequest'); - $acl = new Plugin(); - $server = new DAV\Server(); - $server->addPlugin(new DAV\Auth\Plugin()); - $server->addPlugin($acl); - - $acl->httpAcl($server->httpRequest, $server->httpResponse); - } - - /** - /** - */ - public function testNotSupportedByNode() - { - $this->expectException('Sabre\DAV\Exception\MethodNotAllowed'); - $tree = [ - new DAV\SimpleCollection('test'), - ]; - $acl = new Plugin(); - $server = new DAV\Server($tree); - $server->httpRequest = new HTTP\Request('GET', '/'); - $body = '<?xml version="1.0"?> -<d:acl xmlns:d="DAV:"> -</d:acl>'; - $server->httpRequest->setBody($body); - $server->addPlugin(new DAV\Auth\Plugin()); - $server->addPlugin($acl); - - $acl->httpACL($server->httpRequest, $server->httpResponse); - } - - public function testSuccessSimple() - { - $tree = [ - new MockACLNode('test', []), - ]; - $acl = new Plugin(); - $server = new DAV\Server($tree); - $server->httpRequest = new HTTP\Request('GET', '/'); - $server->httpRequest->setUrl('/test'); - - $body = '<?xml version="1.0"?> -<d:acl xmlns:d="DAV:"> -</d:acl>'; - $server->httpRequest->setBody($body); - $server->addPlugin(new DAV\Auth\Plugin()); - $server->addPlugin($acl); - - $this->assertFalse($acl->httpACL($server->httpRequest, $server->httpResponse)); - } - - public function testUnrecognizedPrincipal() - { - $this->expectException('Sabre\DAVACL\Exception\NotRecognizedPrincipal'); - $tree = [ - new MockACLNode('test', []), - ]; - $acl = new Plugin(); - $server = new DAV\Server($tree); - $server->httpRequest = new HTTP\Request('ACL', '/test'); - $body = '<?xml version="1.0"?> -<d:acl xmlns:d="DAV:"> - <d:ace> - <d:grant><d:privilege><d:read /></d:privilege></d:grant> - <d:principal><d:href>/principals/notfound</d:href></d:principal> - </d:ace> -</d:acl>'; - $server->httpRequest->setBody($body); - $server->addPlugin(new DAV\Auth\Plugin()); - $server->addPlugin($acl); - - $acl->httpACL($server->httpRequest, $server->httpResponse); - } - - public function testUnrecognizedPrincipal2() - { - $this->expectException('Sabre\DAVACL\Exception\NotRecognizedPrincipal'); - $tree = [ - new MockACLNode('test', []), - new DAV\SimpleCollection('principals', [ - new DAV\SimpleCollection('notaprincipal'), - ]), - ]; - $acl = new Plugin(); - $server = new DAV\Server($tree); - $server->httpRequest = new HTTP\Request('ACL', '/test'); - $body = '<?xml version="1.0"?> -<d:acl xmlns:d="DAV:"> - <d:ace> - <d:grant><d:privilege><d:read /></d:privilege></d:grant> - <d:principal><d:href>/principals/notaprincipal</d:href></d:principal> - </d:ace> -</d:acl>'; - $server->httpRequest->setBody($body); - $server->addPlugin(new DAV\Auth\Plugin()); - $server->addPlugin($acl); - - $acl->httpACL($server->httpRequest, $server->httpResponse); - } - - public function testUnknownPrivilege() - { - $this->expectException('Sabre\DAVACL\Exception\NotSupportedPrivilege'); - $tree = [ - new MockACLNode('test', []), - ]; - $acl = new Plugin(); - $server = new DAV\Server($tree); - $server->httpRequest = new HTTP\Request('ACL', '/test'); - $body = '<?xml version="1.0"?> -<d:acl xmlns:d="DAV:"> - <d:ace> - <d:grant><d:privilege><d:bananas /></d:privilege></d:grant> - <d:principal><d:href>/principals/notfound</d:href></d:principal> - </d:ace> -</d:acl>'; - $server->httpRequest->setBody($body); - $server->addPlugin(new DAV\Auth\Plugin()); - $server->addPlugin($acl); - - $acl->httpACL($server->httpRequest, $server->httpResponse); - } - - public function testAbstractPrivilege() - { - $this->expectException('Sabre\DAVACL\Exception\NoAbstract'); - $tree = [ - new MockACLNode('test', []), - ]; - $acl = new Plugin(); - $server = new DAV\Server($tree); - $server->on('getSupportedPrivilegeSet', function ($node, &$supportedPrivilegeSet) { - $supportedPrivilegeSet['{DAV:}foo'] = ['abstract' => true]; - }); - $server->httpRequest = new HTTP\Request('ACL', '/test'); - $body = '<?xml version="1.0"?> -<d:acl xmlns:d="DAV:"> - <d:ace> - <d:grant><d:privilege><d:foo /></d:privilege></d:grant> - <d:principal><d:href>/principals/foo/</d:href></d:principal> - </d:ace> -</d:acl>'; - $server->httpRequest->setBody($body); - $server->addPlugin(new DAV\Auth\Plugin()); - $server->addPlugin($acl); - - $acl->httpACL($server->httpRequest, $server->httpResponse); - } - - public function testUpdateProtectedPrivilege() - { - $this->expectException('Sabre\DAVACL\Exception\AceConflict'); - $oldACL = [ - [ - 'principal' => 'principals/notfound', - 'privilege' => '{DAV:}write', - 'protected' => true, - ], - ]; - - $tree = [ - new MockACLNode('test', $oldACL), - ]; - $acl = new Plugin(); - $server = new DAV\Server($tree); - $server->httpRequest = new HTTP\Request('ACL', '/test'); - $body = '<?xml version="1.0"?> -<d:acl xmlns:d="DAV:"> - <d:ace> - <d:grant><d:privilege><d:read /></d:privilege></d:grant> - <d:principal><d:href>/principals/notfound</d:href></d:principal> - </d:ace> -</d:acl>'; - $server->httpRequest->setBody($body); - $server->addPlugin(new DAV\Auth\Plugin()); - $server->addPlugin($acl); - - $acl->httpACL($server->httpRequest, $server->httpResponse); - } - - public function testUpdateProtectedPrivilege2() - { - $this->expectException('Sabre\DAVACL\Exception\AceConflict'); - $oldACL = [ - [ - 'principal' => 'principals/notfound', - 'privilege' => '{DAV:}write', - 'protected' => true, - ], - ]; - - $tree = [ - new MockACLNode('test', $oldACL), - ]; - $acl = new Plugin(); - $server = new DAV\Server($tree); - $server->httpRequest = new HTTP\Request('ACL', '/test'); - $body = '<?xml version="1.0"?> -<d:acl xmlns:d="DAV:"> - <d:ace> - <d:grant><d:privilege><d:write /></d:privilege></d:grant> - <d:principal><d:href>/principals/foo</d:href></d:principal> - </d:ace> -</d:acl>'; - $server->httpRequest->setBody($body); - $server->addPlugin(new DAV\Auth\Plugin()); - $server->addPlugin($acl); - - $acl->httpACL($server->httpRequest, $server->httpResponse); - } - - public function testUpdateProtectedPrivilege3() - { - $this->expectException('Sabre\DAVACL\Exception\AceConflict'); - $oldACL = [ - [ - 'principal' => 'principals/notfound', - 'privilege' => '{DAV:}write', - 'protected' => true, - ], - ]; - - $tree = [ - new MockACLNode('test', $oldACL), - ]; - $acl = new Plugin(); - $server = new DAV\Server($tree); - $server->httpRequest = new HTTP\Request('ACL', '/test'); - $body = '<?xml version="1.0"?> -<d:acl xmlns:d="DAV:"> - <d:ace> - <d:grant><d:privilege><d:write /></d:privilege></d:grant> - <d:principal><d:href>/principals/notfound</d:href></d:principal> - </d:ace> -</d:acl>'; - $server->httpRequest->setBody($body); - $server->addPlugin(new DAV\Auth\Plugin()); - $server->addPlugin($acl); - - $acl->httpACL($server->httpRequest, $server->httpResponse); - } - - public function testSuccessComplex() - { - $oldACL = [ - [ - 'principal' => 'principals/foo', - 'privilege' => '{DAV:}write', - 'protected' => true, - ], - [ - 'principal' => 'principals/bar', - 'privilege' => '{DAV:}read', - ], - ]; - - $tree = [ - $node = new MockACLNode('test', $oldACL), - new DAV\SimpleCollection('principals', [ - new MockPrincipal('foo', 'principals/foo'), - new MockPrincipal('baz', 'principals/baz'), - ]), - ]; - $acl = new Plugin(); - $server = new DAV\Server($tree); - $server->httpRequest = new HTTP\Request('ACL', '/test'); - $body = '<?xml version="1.0"?> -<d:acl xmlns:d="DAV:"> - <d:ace> - <d:grant><d:privilege><d:write /></d:privilege></d:grant> - <d:principal><d:href>/principals/foo</d:href></d:principal> - <d:protected /> - </d:ace> - <d:ace> - <d:grant><d:privilege><d:write /></d:privilege></d:grant> - <d:principal><d:href>/principals/baz</d:href></d:principal> - </d:ace> -</d:acl>'; - $server->httpRequest->setBody($body); - $server->addPlugin(new DAV\Auth\Plugin()); - $server->addPlugin($acl); - - $this->assertFalse($acl->httpAcl($server->httpRequest, $server->httpResponse)); - - $this->assertEquals([ - [ - 'principal' => 'principals/foo', - 'privilege' => '{DAV:}write', - 'protected' => true, - ], - [ - 'principal' => 'principals/baz', - 'privilege' => '{DAV:}write', - 'protected' => false, - ], - ], $node->getACL()); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/AllowAccessTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/AllowAccessTest.php deleted file mode 100644 index 04dd29c04..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/AllowAccessTest.php +++ /dev/null @@ -1,120 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAVACL; - -use Sabre\DAV; - -class AllowAccessTest extends \PHPUnit\Framework\TestCase -{ - /** - * @var DAV\Server - */ - protected $server; - - public function setup(): void - { - $nodes = [ - new DAV\Mock\Collection('testdir', [ - 'file1.txt' => 'contents', - ]), - ]; - - $this->server = new DAV\Server($nodes); - $this->server->addPlugin( - new DAV\Auth\Plugin( - new DAV\Auth\Backend\Mock() - ) - ); - // Login - $this->server->getPlugin('auth')->beforeMethod( - new \Sabre\HTTP\Request('GET', '/'), - new \Sabre\HTTP\Response() - ); - $aclPlugin = new Plugin(); - $this->server->addPlugin($aclPlugin); - } - - public function testGet() - { - $this->server->httpRequest->setMethod('GET'); - $this->server->httpRequest->setUrl('/testdir'); - - $this->assertTrue($this->server->emit('beforeMethod:GET', [$this->server->httpRequest, $this->server->httpResponse])); - } - - public function testGetDoesntExist() - { - $this->server->httpRequest->setMethod('GET'); - $this->server->httpRequest->setUrl('/foo'); - - $this->assertTrue($this->server->emit('beforeMethod:GET', [$this->server->httpRequest, $this->server->httpResponse])); - } - - public function testHEAD() - { - $this->server->httpRequest->setMethod('HEAD'); - $this->server->httpRequest->setUrl('/testdir'); - - $this->assertTrue($this->server->emit('beforeMethod:HEAD', [$this->server->httpRequest, $this->server->httpResponse])); - } - - public function testOPTIONS() - { - $this->server->httpRequest->setMethod('OPTIONS'); - $this->server->httpRequest->setUrl('/testdir'); - - $this->assertTrue($this->server->emit('beforeMethod:OPTIONS', [$this->server->httpRequest, $this->server->httpResponse])); - } - - public function testPUT() - { - $this->server->httpRequest->setMethod('PUT'); - $this->server->httpRequest->setUrl('/testdir/file1.txt'); - - $this->assertTrue($this->server->emit('beforeMethod:PUT', [$this->server->httpRequest, $this->server->httpResponse])); - } - - public function testPROPPATCH() - { - $this->server->httpRequest->setMethod('PROPPATCH'); - $this->server->httpRequest->setUrl('/testdir'); - - $this->assertTrue($this->server->emit('beforeMethod:PROPPATCH', [$this->server->httpRequest, $this->server->httpResponse])); - } - - public function testCOPY() - { - $this->server->httpRequest->setMethod('COPY'); - $this->server->httpRequest->setUrl('/testdir'); - - $this->assertTrue($this->server->emit('beforeMethod:COPY', [$this->server->httpRequest, $this->server->httpResponse])); - } - - public function testMOVE() - { - $this->server->httpRequest->setMethod('MOVE'); - $this->server->httpRequest->setUrl('/testdir'); - - $this->assertTrue($this->server->emit('beforeMethod:MOVE', [$this->server->httpRequest, $this->server->httpResponse])); - } - - public function testLOCK() - { - $this->server->httpRequest->setMethod('LOCK'); - $this->server->httpRequest->setUrl('/testdir'); - - $this->assertTrue($this->server->emit('beforeMethod:LOCK', [$this->server->httpRequest, $this->server->httpResponse])); - } - - public function testBeforeBind() - { - $this->assertTrue($this->server->emit('beforeBind', ['testdir/file'])); - } - - public function testBeforeUnbind() - { - $this->assertTrue($this->server->emit('beforeUnbind', ['testdir'])); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/BlockAccessTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/BlockAccessTest.php deleted file mode 100644 index 566167ef0..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/BlockAccessTest.php +++ /dev/null @@ -1,180 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAVACL; - -use Sabre\DAV; - -class BlockAccessTest extends \PHPUnit\Framework\TestCase -{ - /** - * @var DAV\Server - */ - protected $server; - protected $plugin; - - public function setup(): void - { - $nodes = [ - new DAV\SimpleCollection('testdir'), - ]; - - $this->server = new DAV\Server($nodes); - $this->plugin = new Plugin(); - $this->plugin->setDefaultAcl([]); - $this->server->addPlugin( - new DAV\Auth\Plugin( - new DAV\Auth\Backend\Mock() - ) - ); - // Login - $this->server->getPlugin('auth')->beforeMethod( - new \Sabre\HTTP\Request('GET', '/'), - new \Sabre\HTTP\Response() - ); - $this->server->addPlugin($this->plugin); - } - - public function testGet() - { - $this->expectException('Sabre\DAVACL\Exception\NeedPrivileges'); - $this->server->httpRequest->setMethod('GET'); - $this->server->httpRequest->setUrl('/testdir'); - - $this->server->emit('beforeMethod:GET', [$this->server->httpRequest, $this->server->httpResponse]); - } - - public function testGetDoesntExist() - { - $this->server->httpRequest->setMethod('GET'); - $this->server->httpRequest->setUrl('/foo'); - - $r = $this->server->emit('beforeMethod:GET', [$this->server->httpRequest, $this->server->httpResponse]); - $this->assertTrue($r); - } - - public function testHEAD() - { - $this->expectException('Sabre\DAVACL\Exception\NeedPrivileges'); - $this->server->httpRequest->setMethod('HEAD'); - $this->server->httpRequest->setUrl('/testdir'); - - $this->server->emit('beforeMethod:GET', [$this->server->httpRequest, $this->server->httpResponse]); - } - - public function testOPTIONS() - { - $this->expectException('Sabre\DAVACL\Exception\NeedPrivileges'); - $this->server->httpRequest->setMethod('OPTIONS'); - $this->server->httpRequest->setUrl('/testdir'); - - $this->server->emit('beforeMethod:GET', [$this->server->httpRequest, $this->server->httpResponse]); - } - - public function testPUT() - { - $this->expectException('Sabre\DAVACL\Exception\NeedPrivileges'); - $this->server->httpRequest->setMethod('PUT'); - $this->server->httpRequest->setUrl('/testdir'); - - $this->server->emit('beforeMethod:GET', [$this->server->httpRequest, $this->server->httpResponse]); - } - - public function testPROPPATCH() - { - $this->expectException('Sabre\DAVACL\Exception\NeedPrivileges'); - $this->server->httpRequest->setMethod('PROPPATCH'); - $this->server->httpRequest->setUrl('/testdir'); - - $this->server->emit('beforeMethod:GET', [$this->server->httpRequest, $this->server->httpResponse]); - } - - public function testCOPY() - { - $this->expectException('Sabre\DAVACL\Exception\NeedPrivileges'); - $this->server->httpRequest->setMethod('COPY'); - $this->server->httpRequest->setUrl('/testdir'); - - $this->server->emit('beforeMethod:GET', [$this->server->httpRequest, $this->server->httpResponse]); - } - - public function testMOVE() - { - $this->expectException('Sabre\DAVACL\Exception\NeedPrivileges'); - $this->server->httpRequest->setMethod('MOVE'); - $this->server->httpRequest->setUrl('/testdir'); - - $this->server->emit('beforeMethod:GET', [$this->server->httpRequest, $this->server->httpResponse]); - } - - public function testACL() - { - $this->expectException('Sabre\DAVACL\Exception\NeedPrivileges'); - $this->server->httpRequest->setMethod('ACL'); - $this->server->httpRequest->setUrl('/testdir'); - - $this->server->emit('beforeMethod:GET', [$this->server->httpRequest, $this->server->httpResponse]); - } - - public function testLOCK() - { - $this->expectException('Sabre\DAVACL\Exception\NeedPrivileges'); - $this->server->httpRequest->setMethod('LOCK'); - $this->server->httpRequest->setUrl('/testdir'); - - $this->server->emit('beforeMethod:GET', [$this->server->httpRequest, $this->server->httpResponse]); - } - - public function testBeforeBind() - { - $this->expectException('Sabre\DAVACL\Exception\NeedPrivileges'); - $this->server->emit('beforeBind', ['testdir/file']); - } - - public function testBeforeUnbind() - { - $this->expectException('Sabre\DAVACL\Exception\NeedPrivileges'); - $this->server->emit('beforeUnbind', ['testdir']); - } - - public function testPropFind() - { - $propFind = new DAV\PropFind('testdir', [ - '{DAV:}displayname', - '{DAV:}getcontentlength', - '{DAV:}bar', - '{DAV:}owner', - ]); - - $r = $this->server->emit('propFind', [$propFind, new DAV\SimpleCollection('testdir')]); - $this->assertTrue($r); - - $expected = [ - 200 => [], - 404 => [], - 403 => [ - '{DAV:}displayname' => null, - '{DAV:}getcontentlength' => null, - '{DAV:}bar' => null, - '{DAV:}owner' => null, - ], - ]; - - $this->assertEquals($expected, $propFind->getResultForMultiStatus()); - } - - public function testBeforeGetPropertiesNoListing() - { - $this->plugin->hideNodesFromListings = true; - $propFind = new DAV\PropFind('testdir', [ - '{DAV:}displayname', - '{DAV:}getcontentlength', - '{DAV:}bar', - '{DAV:}owner', - ]); - - $r = $this->server->emit('propFind', [$propFind, new DAV\SimpleCollection('testdir')]); - $this->assertFalse($r); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/Exception/AceConflictTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/Exception/AceConflictTest.php deleted file mode 100644 index 60fb8f3e8..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/Exception/AceConflictTest.php +++ /dev/null @@ -1,37 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAVACL\Exception; - -use Sabre\DAV; - -class AceConflictTest extends \PHPUnit\Framework\TestCase -{ - public function testSerialize() - { - $ex = new AceConflict('message'); - - $server = new DAV\Server(); - $dom = new \DOMDocument('1.0', 'utf-8'); - $root = $dom->createElementNS('DAV:', 'd:root'); - $dom->appendChild($root); - - $ex->serialize($server, $root); - - $xpaths = [ - '/d:root' => 1, - '/d:root/d:no-ace-conflict' => 1, - ]; - - // Reloading because PHP DOM sucks - $dom2 = new \DOMDocument('1.0', 'utf-8'); - $dom2->loadXML($dom->saveXML()); - - $dxpath = new \DOMXPath($dom2); - $dxpath->registerNamespace('d', 'DAV:'); - foreach ($xpaths as $xpath => $count) { - $this->assertEquals($count, $dxpath->query($xpath)->length, 'Looking for : '.$xpath.', we could only find '.$dxpath->query($xpath)->length.' elements, while we expected '.$count); - } - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/Exception/NeedPrivilegesExceptionTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/Exception/NeedPrivilegesExceptionTest.php deleted file mode 100644 index f08e536b5..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/Exception/NeedPrivilegesExceptionTest.php +++ /dev/null @@ -1,47 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAVACL\Exception; - -use Sabre\DAV; - -class NeedPrivilegesExceptionTest extends \PHPUnit\Framework\TestCase -{ - public function testSerialize() - { - $uri = 'foo'; - $privileges = [ - '{DAV:}read', - '{DAV:}write', - ]; - $ex = new NeedPrivileges($uri, $privileges); - - $server = new DAV\Server(); - $dom = new \DOMDocument('1.0', 'utf-8'); - $root = $dom->createElementNS('DAV:', 'd:root'); - $dom->appendChild($root); - - $ex->serialize($server, $root); - - $xpaths = [ - '/d:root' => 1, - '/d:root/d:need-privileges' => 1, - '/d:root/d:need-privileges/d:resource' => 2, - '/d:root/d:need-privileges/d:resource/d:href' => 2, - '/d:root/d:need-privileges/d:resource/d:privilege' => 2, - '/d:root/d:need-privileges/d:resource/d:privilege/d:read' => 1, - '/d:root/d:need-privileges/d:resource/d:privilege/d:write' => 1, - ]; - - // Reloading because PHP DOM sucks - $dom2 = new \DOMDocument('1.0', 'utf-8'); - $dom2->loadXML($dom->saveXML()); - - $dxpath = new \DOMXPath($dom2); - $dxpath->registerNamespace('d', 'DAV:'); - foreach ($xpaths as $xpath => $count) { - $this->assertEquals($count, $dxpath->query($xpath)->length, 'Looking for : '.$xpath.', we could only find '.$dxpath->query($xpath)->length.' elements, while we expected '.$count); - } - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/Exception/NoAbstractTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/Exception/NoAbstractTest.php deleted file mode 100644 index 38e9d8b93..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/Exception/NoAbstractTest.php +++ /dev/null @@ -1,37 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAVACL\Exception; - -use Sabre\DAV; - -class NoAbstractTest extends \PHPUnit\Framework\TestCase -{ - public function testSerialize() - { - $ex = new NoAbstract('message'); - - $server = new DAV\Server(); - $dom = new \DOMDocument('1.0', 'utf-8'); - $root = $dom->createElementNS('DAV:', 'd:root'); - $dom->appendChild($root); - - $ex->serialize($server, $root); - - $xpaths = [ - '/d:root' => 1, - '/d:root/d:no-abstract' => 1, - ]; - - // Reloading because PHP DOM sucks - $dom2 = new \DOMDocument('1.0', 'utf-8'); - $dom2->loadXML($dom->saveXML()); - - $dxpath = new \DOMXPath($dom2); - $dxpath->registerNamespace('d', 'DAV:'); - foreach ($xpaths as $xpath => $count) { - $this->assertEquals($count, $dxpath->query($xpath)->length, 'Looking for : '.$xpath.', we could only find '.$dxpath->query($xpath)->length.' elements, while we expected '.$count); - } - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/Exception/NotRecognizedPrincipalTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/Exception/NotRecognizedPrincipalTest.php deleted file mode 100644 index 62915ea1d..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/Exception/NotRecognizedPrincipalTest.php +++ /dev/null @@ -1,37 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAVACL\Exception; - -use Sabre\DAV; - -class NotRecognizedPrincipalTest extends \PHPUnit\Framework\TestCase -{ - public function testSerialize() - { - $ex = new NotRecognizedPrincipal('message'); - - $server = new DAV\Server(); - $dom = new \DOMDocument('1.0', 'utf-8'); - $root = $dom->createElementNS('DAV:', 'd:root'); - $dom->appendChild($root); - - $ex->serialize($server, $root); - - $xpaths = [ - '/d:root' => 1, - '/d:root/d:recognized-principal' => 1, - ]; - - // Reloading because PHP DOM sucks - $dom2 = new \DOMDocument('1.0', 'utf-8'); - $dom2->loadXML($dom->saveXML()); - - $dxpath = new \DOMXPath($dom2); - $dxpath->registerNamespace('d', 'DAV:'); - foreach ($xpaths as $xpath => $count) { - $this->assertEquals($count, $dxpath->query($xpath)->length, 'Looking for : '.$xpath.', we could only find '.$dxpath->query($xpath)->length.' elements, while we expected '.$count); - } - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/Exception/NotSupportedPrivilegeTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/Exception/NotSupportedPrivilegeTest.php deleted file mode 100644 index 668c713d2..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/Exception/NotSupportedPrivilegeTest.php +++ /dev/null @@ -1,37 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAVACL\Exception; - -use Sabre\DAV; - -class NotSupportedPrivilegeTest extends \PHPUnit\Framework\TestCase -{ - public function testSerialize() - { - $ex = new NotSupportedPrivilege('message'); - - $server = new DAV\Server(); - $dom = new \DOMDocument('1.0', 'utf-8'); - $root = $dom->createElementNS('DAV:', 'd:root'); - $dom->appendChild($root); - - $ex->serialize($server, $root); - - $xpaths = [ - '/d:root' => 1, - '/d:root/d:not-supported-privilege' => 1, - ]; - - // Reloading because PHP DOM sucks - $dom2 = new \DOMDocument('1.0', 'utf-8'); - $dom2->loadXML($dom->saveXML()); - - $dxpath = new \DOMXPath($dom2); - $dxpath->registerNamespace('d', 'DAV:'); - foreach ($xpaths as $xpath => $count) { - $this->assertEquals($count, $dxpath->query($xpath)->length, 'Looking for : '.$xpath.', we could only find '.$dxpath->query($xpath)->length.' elements, while we expected '.$count); - } - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/ExpandPropertiesTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/ExpandPropertiesTest.php deleted file mode 100644 index 8afe6d30f..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/ExpandPropertiesTest.php +++ /dev/null @@ -1,308 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAVACL; - -use Sabre\DAV; -use Sabre\HTTP; - -class ExpandPropertiesTest extends \PHPUnit\Framework\TestCase -{ - public function getServer() - { - $tree = [ - new DAV\Mock\PropertiesCollection('node1', [], [ - '{http://sabredav.org/ns}simple' => 'foo', - '{http://sabredav.org/ns}href' => new DAV\Xml\Property\Href('node2'), - '{DAV:}displayname' => 'Node 1', - ]), - new DAV\Mock\PropertiesCollection('node2', [], [ - '{http://sabredav.org/ns}simple' => 'simple', - '{http://sabredav.org/ns}hreflist' => new DAV\Xml\Property\Href(['node1', 'node3']), - '{DAV:}displayname' => 'Node 2', - ]), - new DAV\Mock\PropertiesCollection('node3', [], [ - '{http://sabredav.org/ns}simple' => 'simple', - '{DAV:}displayname' => 'Node 3', - ]), - ]; - - $fakeServer = new DAV\Server($tree); - $fakeServer->sapi = new HTTP\SapiMock(); - $fakeServer->debugExceptions = true; - $fakeServer->httpResponse = new HTTP\ResponseMock(); - $plugin = new Plugin(); - $plugin->allowUnauthenticatedAccess = false; - // Anyone can do anything - $plugin->setDefaultACL([ - [ - 'principal' => '{DAV:}all', - 'privilege' => '{DAV:}all', - ], - ]); - $this->assertTrue($plugin instanceof Plugin); - - $fakeServer->addPlugin($plugin); - $this->assertEquals($plugin, $fakeServer->getPlugin('acl')); - - return $fakeServer; - } - - public function testSimple() - { - $xml = '<?xml version="1.0"?> -<d:expand-property xmlns:d="DAV:"> - <d:property name="displayname" /> - <d:property name="foo" namespace="http://www.sabredav.org/NS/2010/nonexistant" /> - <d:property name="simple" namespace="http://sabredav.org/ns" /> - <d:property name="href" namespace="http://sabredav.org/ns" /> -</d:expand-property>'; - - $serverVars = [ - 'REQUEST_METHOD' => 'REPORT', - 'HTTP_DEPTH' => '0', - 'REQUEST_URI' => '/node1', - ]; - - $request = HTTP\Sapi::createFromServerArray($serverVars); - $request->setBody($xml); - - $server = $this->getServer(); - $server->httpRequest = $request; - - $server->exec(); - - $this->assertEquals(207, $server->httpResponse->status, 'Incorrect status code received. Full body: '.$server->httpResponse->getBodyAsString()); - $this->assertEquals([ - 'X-Sabre-Version' => [DAV\Version::VERSION], - 'Content-Type' => ['application/xml; charset=utf-8'], - ], $server->httpResponse->getHeaders()); - - $check = [ - '/d:multistatus', - '/d:multistatus/d:response' => 1, - '/d:multistatus/d:response/d:href' => 1, - '/d:multistatus/d:response/d:propstat' => 2, - '/d:multistatus/d:response/d:propstat/d:prop' => 2, - '/d:multistatus/d:response/d:propstat/d:prop/d:displayname' => 1, - '/d:multistatus/d:response/d:propstat/d:prop/s:simple' => 1, - '/d:multistatus/d:response/d:propstat/d:prop/s:href' => 1, - '/d:multistatus/d:response/d:propstat/d:prop/s:href/d:href' => 1, - ]; - - $xml = simplexml_load_string($server->httpResponse->getBodyAsString()); - $xml->registerXPathNamespace('d', 'DAV:'); - $xml->registerXPathNamespace('s', 'http://sabredav.org/ns'); - foreach ($check as $v1 => $v2) { - $xpath = is_int($v1) ? $v2 : $v1; - - $result = $xml->xpath($xpath); - - $count = 1; - if (!is_int($v1)) { - $count = $v2; - } - - $this->assertEquals($count, count($result), 'we expected '.$count.' appearances of '.$xpath.' . We found '.count($result).'. Full response: '.$server->httpResponse->getBodyAsString()); - } - } - - /** - * @depends testSimple - */ - public function testExpand() - { - $xml = '<?xml version="1.0"?> -<d:expand-property xmlns:d="DAV:"> - <d:property name="href" namespace="http://sabredav.org/ns"> - <d:property name="displayname" /> - </d:property> -</d:expand-property>'; - - $serverVars = [ - 'REQUEST_METHOD' => 'REPORT', - 'HTTP_DEPTH' => '0', - 'REQUEST_URI' => '/node1', - ]; - - $request = HTTP\Sapi::createFromServerArray($serverVars); - $request->setBody($xml); - - $server = $this->getServer(); - $server->httpRequest = $request; - - $server->exec(); - - $this->assertEquals(207, $server->httpResponse->status, 'Incorrect response status received. Full response body: '.$server->httpResponse->getBodyAsString()); - $this->assertEquals([ - 'X-Sabre-Version' => [DAV\Version::VERSION], - 'Content-Type' => ['application/xml; charset=utf-8'], - ], $server->httpResponse->getHeaders()); - - $check = [ - '/d:multistatus', - '/d:multistatus/d:response' => 1, - '/d:multistatus/d:response/d:href' => 1, - '/d:multistatus/d:response/d:propstat' => 1, - '/d:multistatus/d:response/d:propstat/d:prop' => 1, - '/d:multistatus/d:response/d:propstat/d:prop/s:href' => 1, - '/d:multistatus/d:response/d:propstat/d:prop/s:href/d:response' => 1, - '/d:multistatus/d:response/d:propstat/d:prop/s:href/d:response/d:href' => 1, - '/d:multistatus/d:response/d:propstat/d:prop/s:href/d:response/d:propstat' => 1, - '/d:multistatus/d:response/d:propstat/d:prop/s:href/d:response/d:propstat/d:prop' => 1, - '/d:multistatus/d:response/d:propstat/d:prop/s:href/d:response/d:propstat/d:prop/d:displayname' => 1, - ]; - - $xml = simplexml_load_string($server->httpResponse->getBodyAsString()); - $xml->registerXPathNamespace('d', 'DAV:'); - $xml->registerXPathNamespace('s', 'http://sabredav.org/ns'); - foreach ($check as $v1 => $v2) { - $xpath = is_int($v1) ? $v2 : $v1; - - $result = $xml->xpath($xpath); - - $count = 1; - if (!is_int($v1)) { - $count = $v2; - } - - $this->assertEquals($count, count($result), 'we expected '.$count.' appearances of '.$xpath.' . We found '.count($result).' Full response body: '.$server->httpResponse->getBodyAsString()); - } - } - - /** - * @depends testSimple - */ - public function testExpandHrefList() - { - $xml = '<?xml version="1.0"?> -<d:expand-property xmlns:d="DAV:"> - <d:property name="hreflist" namespace="http://sabredav.org/ns"> - <d:property name="displayname" /> - </d:property> -</d:expand-property>'; - - $serverVars = [ - 'REQUEST_METHOD' => 'REPORT', - 'HTTP_DEPTH' => '0', - 'REQUEST_URI' => '/node2', - ]; - - $request = HTTP\Sapi::createFromServerArray($serverVars); - $request->setBody($xml); - - $server = $this->getServer(); - $server->httpRequest = $request; - - $server->exec(); - - $this->assertEquals(207, $server->httpResponse->status); - $this->assertEquals([ - 'X-Sabre-Version' => [DAV\Version::VERSION], - 'Content-Type' => ['application/xml; charset=utf-8'], - ], $server->httpResponse->getHeaders()); - - $check = [ - '/d:multistatus', - '/d:multistatus/d:response' => 1, - '/d:multistatus/d:response/d:href' => 1, - '/d:multistatus/d:response/d:propstat' => 1, - '/d:multistatus/d:response/d:propstat/d:prop' => 1, - '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist' => 1, - '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist/d:response' => 2, - '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist/d:response/d:href' => 2, - '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist/d:response/d:propstat' => 2, - '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist/d:response/d:propstat/d:prop' => 2, - '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist/d:response/d:propstat/d:prop/d:displayname' => 2, - ]; - - $xml = simplexml_load_string($server->httpResponse->getBodyAsString()); - $xml->registerXPathNamespace('d', 'DAV:'); - $xml->registerXPathNamespace('s', 'http://sabredav.org/ns'); - foreach ($check as $v1 => $v2) { - $xpath = is_int($v1) ? $v2 : $v1; - - $result = $xml->xpath($xpath); - - $count = 1; - if (!is_int($v1)) { - $count = $v2; - } - - $this->assertEquals($count, count($result), 'we expected '.$count.' appearances of '.$xpath.' . We found '.count($result)); - } - } - - /** - * @depends testExpand - */ - public function testExpandDeep() - { - $xml = '<?xml version="1.0"?> -<d:expand-property xmlns:d="DAV:"> - <d:property name="hreflist" namespace="http://sabredav.org/ns"> - <d:property name="href" namespace="http://sabredav.org/ns"> - <d:property name="displayname" /> - </d:property> - <d:property name="displayname" /> - </d:property> -</d:expand-property>'; - - $serverVars = [ - 'REQUEST_METHOD' => 'REPORT', - 'HTTP_DEPTH' => '0', - 'REQUEST_URI' => '/node2', - ]; - - $request = HTTP\Sapi::createFromServerArray($serverVars); - $request->setBody($xml); - - $server = $this->getServer(); - $server->httpRequest = $request; - - $server->exec(); - - $this->assertEquals(207, $server->httpResponse->status); - $this->assertEquals([ - 'X-Sabre-Version' => [DAV\Version::VERSION], - 'Content-Type' => ['application/xml; charset=utf-8'], - ], $server->httpResponse->getHeaders()); - - $check = [ - '/d:multistatus', - '/d:multistatus/d:response' => 1, - '/d:multistatus/d:response/d:href' => 1, - '/d:multistatus/d:response/d:propstat' => 1, - '/d:multistatus/d:response/d:propstat/d:prop' => 1, - '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist' => 1, - '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist/d:response' => 2, - '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist/d:response/d:href' => 2, - '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist/d:response/d:propstat' => 3, - '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist/d:response/d:propstat/d:prop' => 3, - '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist/d:response/d:propstat/d:prop/d:displayname' => 2, - '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist/d:response/d:propstat/d:prop/s:href' => 2, - '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist/d:response/d:propstat/d:prop/s:href/d:response' => 1, - '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist/d:response/d:propstat/d:prop/s:href/d:response/d:href' => 1, - '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist/d:response/d:propstat/d:prop/s:href/d:response/d:propstat' => 1, - '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist/d:response/d:propstat/d:prop/s:href/d:response/d:propstat/d:prop' => 1, - '/d:multistatus/d:response/d:propstat/d:prop/s:hreflist/d:response/d:propstat/d:prop/s:href/d:response/d:propstat/d:prop/d:displayname' => 1, - ]; - - $xml = simplexml_load_string($server->httpResponse->getBodyAsString()); - $xml->registerXPathNamespace('d', 'DAV:'); - $xml->registerXPathNamespace('s', 'http://sabredav.org/ns'); - foreach ($check as $v1 => $v2) { - $xpath = is_int($v1) ? $v2 : $v1; - - $result = $xml->xpath($xpath); - - $count = 1; - if (!is_int($v1)) { - $count = $v2; - } - - $this->assertEquals($count, count($result), 'we expected '.$count.' appearances of '.$xpath.' . We found '.count($result)); - } - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/MockACLNode.php b/vendor/sabre/dav/tests/Sabre/DAVACL/MockACLNode.php deleted file mode 100644 index 51411f304..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/MockACLNode.php +++ /dev/null @@ -1,49 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAVACL; - -use Sabre\DAV; - -class MockACLNode extends DAV\Node implements IACL -{ - public $name; - public $acl; - - public function __construct($name, array $acl = []) - { - $this->name = $name; - $this->acl = $acl; - } - - public function getName() - { - return $this->name; - } - - public function getOwner() - { - return null; - } - - public function getGroup() - { - return null; - } - - public function getACL() - { - return $this->acl; - } - - public function setACL(array $acl) - { - $this->acl = $acl; - } - - public function getSupportedPrivilegeSet() - { - return null; - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/MockPrincipal.php b/vendor/sabre/dav/tests/Sabre/DAVACL/MockPrincipal.php deleted file mode 100644 index f67025c5a..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/MockPrincipal.php +++ /dev/null @@ -1,58 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAVACL; - -use Sabre\DAV; - -class MockPrincipal extends DAV\Node implements IPrincipal -{ - public $name; - public $principalUrl; - public $groupMembership = []; - public $groupMemberSet = []; - - public function __construct($name, $principalUrl, array $groupMembership = [], array $groupMemberSet = []) - { - $this->name = $name; - $this->principalUrl = $principalUrl; - $this->groupMembership = $groupMembership; - $this->groupMemberSet = $groupMemberSet; - } - - public function getName() - { - return $this->name; - } - - public function getDisplayName() - { - return $this->getName(); - } - - public function getAlternateUriSet() - { - return []; - } - - public function getPrincipalUrl() - { - return $this->principalUrl; - } - - public function getGroupMemberSet() - { - return $this->groupMemberSet; - } - - public function getGroupMemberShip() - { - return $this->groupMembership; - } - - public function setGroupMemberSet(array $groupMemberSet) - { - $this->groupMemberSet = $groupMemberSet; - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/PluginAdminTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/PluginAdminTest.php deleted file mode 100644 index 048b9f249..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/PluginAdminTest.php +++ /dev/null @@ -1,76 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAVACL; - -use Sabre\DAV; -use Sabre\HTTP; - -class PluginAdminTest extends \PHPUnit\Framework\TestCase -{ - public $server; - - public function setup(): void - { - $principalBackend = new PrincipalBackend\Mock(); - - $tree = [ - new MockACLNode('adminonly', []), - new PrincipalCollection($principalBackend), - ]; - - $this->server = new DAV\Server($tree); - $this->server->sapi = new HTTP\SapiMock(); - $plugin = new DAV\Auth\Plugin(new DAV\Auth\Backend\Mock()); - $this->server->addPlugin($plugin); - } - - public function testNoAdminAccess() - { - $plugin = new Plugin(); - $this->server->addPlugin($plugin); - - $request = HTTP\Sapi::createFromServerArray([ - 'REQUEST_METHOD' => 'OPTIONS', - 'HTTP_DEPTH' => 1, - 'REQUEST_URI' => '/adminonly', - ]); - - $response = new HTTP\ResponseMock(); - - $this->server->httpRequest = $request; - $this->server->httpResponse = $response; - - $this->server->exec(); - - $this->assertEquals(403, $response->status); - } - - /** - * @depends testNoAdminAccess - */ - public function testAdminAccess() - { - $plugin = new Plugin(); - $plugin->adminPrincipals = [ - 'principals/admin', - ]; - $this->server->addPlugin($plugin); - - $request = HTTP\Sapi::createFromServerArray([ - 'REQUEST_METHOD' => 'OPTIONS', - 'HTTP_DEPTH' => 1, - 'REQUEST_URI' => '/adminonly', - ]); - - $response = new HTTP\ResponseMock(); - - $this->server->httpRequest = $request; - $this->server->httpResponse = $response; - - $this->server->exec(); - - $this->assertEquals(200, $response->status); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/PluginPropertiesTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/PluginPropertiesTest.php deleted file mode 100644 index 16d3e781e..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/PluginPropertiesTest.php +++ /dev/null @@ -1,399 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAVACL; - -use Sabre\DAV; -use Sabre\HTTP; - -class PluginPropertiesTest extends \PHPUnit\Framework\TestCase -{ - public function testPrincipalCollectionSet() - { - $plugin = new Plugin(); - $plugin->allowUnauthenticatedAccess = false; - $plugin->setDefaultACL([ - [ - 'principal' => '{DAV:}all', - 'privilege' => '{DAV:}all', - ], - ]); - //Anyone can do anything - $plugin->principalCollectionSet = [ - 'principals1', - 'principals2', - ]; - - $requestedProperties = [ - '{DAV:}principal-collection-set', - ]; - - $server = new DAV\Server(new DAV\SimpleCollection('root')); - $server->addPlugin($plugin); - - $result = $server->getPropertiesForPath('', $requestedProperties); - $result = $result[0]; - - $this->assertEquals(1, count($result[200])); - $this->assertArrayHasKey('{DAV:}principal-collection-set', $result[200]); - $this->assertInstanceOf('Sabre\\DAV\\Xml\\Property\\Href', $result[200]['{DAV:}principal-collection-set']); - - $expected = [ - 'principals1/', - 'principals2/', - ]; - - $this->assertEquals($expected, $result[200]['{DAV:}principal-collection-set']->getHrefs()); - } - - public function testCurrentUserPrincipal() - { - $fakeServer = new DAV\Server(); - $plugin = new DAV\Auth\Plugin(new DAV\Auth\Backend\Mock()); - $fakeServer->addPlugin($plugin); - $plugin = new Plugin(); - $plugin->setDefaultACL([ - [ - 'principal' => '{DAV:}all', - 'privilege' => '{DAV:}all', - ], - ]); - $fakeServer->addPlugin($plugin); - - $requestedProperties = [ - '{DAV:}current-user-principal', - ]; - - $result = $fakeServer->getPropertiesForPath('', $requestedProperties); - $result = $result[0]; - - $this->assertEquals(1, count($result[200])); - $this->assertArrayHasKey('{DAV:}current-user-principal', $result[200]); - $this->assertInstanceOf('Sabre\DAVACL\Xml\Property\Principal', $result[200]['{DAV:}current-user-principal']); - $this->assertEquals(Xml\Property\Principal::UNAUTHENTICATED, $result[200]['{DAV:}current-user-principal']->getType()); - - // This will force the login - $fakeServer->emit('beforeMethod:PROPFIND', [$fakeServer->httpRequest, $fakeServer->httpResponse]); - - $result = $fakeServer->getPropertiesForPath('', $requestedProperties); - $result = $result[0]; - - $this->assertEquals(1, count($result[200])); - $this->assertArrayHasKey('{DAV:}current-user-principal', $result[200]); - $this->assertInstanceOf('Sabre\DAVACL\Xml\Property\Principal', $result[200]['{DAV:}current-user-principal']); - $this->assertEquals(Xml\Property\Principal::HREF, $result[200]['{DAV:}current-user-principal']->getType()); - $this->assertEquals('principals/admin/', $result[200]['{DAV:}current-user-principal']->getHref()); - } - - public function testSupportedPrivilegeSet() - { - $plugin = new Plugin(); - $plugin->allowUnauthenticatedAccess = false; - $plugin->setDefaultACL([ - [ - 'principal' => '{DAV:}all', - 'privilege' => '{DAV:}all', - ], - ]); - $server = new DAV\Server(); - $server->addPlugin($plugin); - - $requestedProperties = [ - '{DAV:}supported-privilege-set', - ]; - - $result = $server->getPropertiesForPath('', $requestedProperties); - $result = $result[0]; - - $this->assertEquals(1, count($result[200])); - $this->assertArrayHasKey('{DAV:}supported-privilege-set', $result[200]); - $this->assertInstanceOf('Sabre\\DAVACL\\Xml\\Property\\SupportedPrivilegeSet', $result[200]['{DAV:}supported-privilege-set']); - - $server = new DAV\Server(); - - $prop = $result[200]['{DAV:}supported-privilege-set']; - $result = $server->xml->write('{DAV:}root', $prop); - - $xpaths = [ - '/d:root' => 1, - '/d:root/d:supported-privilege' => 1, - '/d:root/d:supported-privilege/d:privilege' => 1, - '/d:root/d:supported-privilege/d:privilege/d:all' => 1, - '/d:root/d:supported-privilege/d:abstract' => 0, - '/d:root/d:supported-privilege/d:supported-privilege' => 2, - '/d:root/d:supported-privilege/d:supported-privilege/d:privilege' => 2, - '/d:root/d:supported-privilege/d:supported-privilege/d:privilege/d:read' => 1, - '/d:root/d:supported-privilege/d:supported-privilege/d:privilege/d:write' => 1, - '/d:root/d:supported-privilege/d:supported-privilege/d:supported-privilege' => 7, - '/d:root/d:supported-privilege/d:supported-privilege/d:supported-privilege/d:privilege' => 7, - '/d:root/d:supported-privilege/d:supported-privilege/d:supported-privilege/d:privilege/d:read-acl' => 1, - '/d:root/d:supported-privilege/d:supported-privilege/d:supported-privilege/d:privilege/d:read-current-user-privilege-set' => 1, - '/d:root/d:supported-privilege/d:supported-privilege/d:supported-privilege/d:privilege/d:write-content' => 1, - '/d:root/d:supported-privilege/d:supported-privilege/d:supported-privilege/d:privilege/d:write-properties' => 1, - '/d:root/d:supported-privilege/d:supported-privilege/d:supported-privilege/d:privilege/d:bind' => 1, - '/d:root/d:supported-privilege/d:supported-privilege/d:supported-privilege/d:privilege/d:unbind' => 1, - '/d:root/d:supported-privilege/d:supported-privilege/d:supported-privilege/d:privilege/d:unlock' => 1, - '/d:root/d:supported-privilege/d:supported-privilege/d:supported-privilege/d:abstract' => 0, - ]; - - // reloading because php dom sucks - $dom2 = new \DOMDocument('1.0', 'utf-8'); - $dom2->loadXML($result); - - $dxpath = new \DOMXPath($dom2); - $dxpath->registerNamespace('d', 'DAV:'); - foreach ($xpaths as $xpath => $count) { - $this->assertEquals($count, $dxpath->query($xpath)->length, 'Looking for : '.$xpath.', we could only find '.$dxpath->query($xpath)->length.' elements, while we expected '.$count.' Full XML: '.$result); - } - } - - public function testACL() - { - $plugin = new Plugin(); - $plugin->allowUnauthenticatedAccess = false; - $plugin->setDefaultACL([ - [ - 'principal' => '{DAV:}all', - 'privilege' => '{DAV:}all', - ], - ]); - - $nodes = [ - new MockACLNode('foo', [ - [ - 'principal' => 'principals/admin', - 'privilege' => '{DAV:}read', - ], - ]), - new DAV\SimpleCollection('principals', [ - $principal = new MockPrincipal('admin', 'principals/admin'), - ]), - ]; - - $server = new DAV\Server($nodes); - $server->addPlugin($plugin); - $authPlugin = new DAV\Auth\Plugin(new DAV\Auth\Backend\Mock()); - $server->addPlugin($authPlugin); - - // Force login - $authPlugin->beforeMethod(new HTTP\Request('GET', '/'), new HTTP\Response()); - - $requestedProperties = [ - '{DAV:}acl', - ]; - - $result = $server->getPropertiesForPath('foo', $requestedProperties); - $result = $result[0]; - - $this->assertEquals(1, count($result[200]), 'The {DAV:}acl property did not return from the list. Full list: '.print_r($result, true)); - $this->assertArrayHasKey('{DAV:}acl', $result[200]); - $this->assertInstanceOf('Sabre\\DAVACL\\Xml\Property\\Acl', $result[200]['{DAV:}acl']); - } - - public function testACLRestrictions() - { - $plugin = new Plugin(); - $plugin->allowUnauthenticatedAccess = false; - - $nodes = [ - new MockACLNode('foo', [ - [ - 'principal' => 'principals/admin', - 'privilege' => '{DAV:}read', - ], - ]), - new DAV\SimpleCollection('principals', [ - $principal = new MockPrincipal('admin', 'principals/admin'), - ]), - ]; - - $server = new DAV\Server($nodes); - $server->addPlugin($plugin); - $authPlugin = new DAV\Auth\Plugin(new DAV\Auth\Backend\Mock()); - $server->addPlugin($authPlugin); - - // Force login - $authPlugin->beforeMethod(new HTTP\Request('GET', '/'), new HTTP\Response()); - - $requestedProperties = [ - '{DAV:}acl-restrictions', - ]; - - $result = $server->getPropertiesForPath('foo', $requestedProperties); - $result = $result[0]; - - $this->assertEquals(1, count($result[200]), 'The {DAV:}acl-restrictions property did not return from the list. Full list: '.print_r($result, true)); - $this->assertArrayHasKey('{DAV:}acl-restrictions', $result[200]); - $this->assertInstanceOf('Sabre\\DAVACL\\Xml\\Property\\AclRestrictions', $result[200]['{DAV:}acl-restrictions']); - } - - public function testAlternateUriSet() - { - $tree = [ - new DAV\SimpleCollection('principals', [ - $principal = new MockPrincipal('user', 'principals/user'), - ]), - ]; - - $fakeServer = new DAV\Server($tree); - //$plugin = new DAV\Auth\Plugin(new DAV\Auth\MockBackend()) - //$fakeServer->addPlugin($plugin); - $plugin = new Plugin(); - $plugin->allowUnauthenticatedAccess = false; - $plugin->setDefaultACL([ - [ - 'principal' => '{DAV:}all', - 'privilege' => '{DAV:}all', - ], - ]); - $fakeServer->addPlugin($plugin); - - $requestedProperties = [ - '{DAV:}alternate-URI-set', - ]; - $result = $fakeServer->getPropertiesForPath('principals/user', $requestedProperties); - $result = $result[0]; - - $this->assertTrue(isset($result[200])); - $this->assertTrue(isset($result[200]['{DAV:}alternate-URI-set'])); - $this->assertInstanceOf('Sabre\\DAV\\Xml\\Property\\Href', $result[200]['{DAV:}alternate-URI-set']); - - $this->assertEquals([], $result[200]['{DAV:}alternate-URI-set']->getHrefs()); - } - - public function testPrincipalURL() - { - $tree = [ - new DAV\SimpleCollection('principals', [ - $principal = new MockPrincipal('user', 'principals/user'), - ]), - ]; - - $fakeServer = new DAV\Server($tree); - //$plugin = new DAV\Auth\Plugin(new DAV\Auth\MockBackend()); - //$fakeServer->addPlugin($plugin); - $plugin = new Plugin(); - $plugin->allowUnauthenticatedAccess = false; - $plugin->setDefaultACL([ - [ - 'principal' => '{DAV:}all', - 'privilege' => '{DAV:}all', - ], - ]); - $fakeServer->addPlugin($plugin); - - $requestedProperties = [ - '{DAV:}principal-URL', - ]; - - $result = $fakeServer->getPropertiesForPath('principals/user', $requestedProperties); - $result = $result[0]; - - $this->assertTrue(isset($result[200])); - $this->assertTrue(isset($result[200]['{DAV:}principal-URL'])); - $this->assertInstanceOf('Sabre\\DAV\\Xml\\Property\\Href', $result[200]['{DAV:}principal-URL']); - - $this->assertEquals('principals/user/', $result[200]['{DAV:}principal-URL']->getHref()); - } - - public function testGroupMemberSet() - { - $tree = [ - new DAV\SimpleCollection('principals', [ - $principal = new MockPrincipal('user', 'principals/user'), - ]), - ]; - - $fakeServer = new DAV\Server($tree); - //$plugin = new DAV\Auth\Plugin(new DAV\Auth\MockBackend()); - //$fakeServer->addPlugin($plugin); - $plugin = new Plugin(); - $plugin->allowUnauthenticatedAccess = false; - $plugin->setDefaultACL([ - [ - 'principal' => '{DAV:}all', - 'privilege' => '{DAV:}all', - ], - ]); - $fakeServer->addPlugin($plugin); - - $requestedProperties = [ - '{DAV:}group-member-set', - ]; - - $result = $fakeServer->getPropertiesForPath('principals/user', $requestedProperties); - $result = $result[0]; - - $this->assertTrue(isset($result[200])); - $this->assertTrue(isset($result[200]['{DAV:}group-member-set'])); - $this->assertInstanceOf('Sabre\\DAV\\Xml\\Property\\Href', $result[200]['{DAV:}group-member-set']); - - $this->assertEquals([], $result[200]['{DAV:}group-member-set']->getHrefs()); - } - - public function testGroupMemberShip() - { - $tree = [ - new DAV\SimpleCollection('principals', [ - $principal = new MockPrincipal('user', 'principals/user'), - ]), - ]; - - $fakeServer = new DAV\Server($tree); - $plugin = new Plugin(); - $plugin->allowUnauthenticatedAccess = false; - $fakeServer->addPlugin($plugin); - $plugin->setDefaultACL([ - [ - 'principal' => '{DAV:}all', - 'privilege' => '{DAV:}all', - ], - ]); - - $requestedProperties = [ - '{DAV:}group-membership', - ]; - - $result = $fakeServer->getPropertiesForPath('principals/user', $requestedProperties); - $result = $result[0]; - - $this->assertTrue(isset($result[200])); - $this->assertTrue(isset($result[200]['{DAV:}group-membership'])); - $this->assertInstanceOf('Sabre\\DAV\\Xml\\Property\\Href', $result[200]['{DAV:}group-membership']); - - $this->assertEquals([], $result[200]['{DAV:}group-membership']->getHrefs()); - } - - public function testGetDisplayName() - { - $tree = [ - new DAV\SimpleCollection('principals', [ - $principal = new MockPrincipal('user', 'principals/user'), - ]), - ]; - - $fakeServer = new DAV\Server($tree); - $plugin = new Plugin(); - $plugin->allowUnauthenticatedAccess = false; - $fakeServer->addPlugin($plugin); - $plugin->setDefaultACL([ - [ - 'principal' => '{DAV:}all', - 'privilege' => '{DAV:}all', - ], - ]); - - $requestedProperties = [ - '{DAV:}displayname', - ]; - - $result = $fakeServer->getPropertiesForPath('principals/user', $requestedProperties); - $result = $result[0]; - - $this->assertTrue(isset($result[200])); - $this->assertTrue(isset($result[200]['{DAV:}displayname'])); - - $this->assertEquals('user', $result[200]['{DAV:}displayname']); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/PluginUpdatePropertiesTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/PluginUpdatePropertiesTest.php deleted file mode 100644 index e6796e014..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/PluginUpdatePropertiesTest.php +++ /dev/null @@ -1,111 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAVACL; - -use Sabre\DAV; - -class PluginUpdatePropertiesTest extends \PHPUnit\Framework\TestCase -{ - public function testUpdatePropertiesPassthrough() - { - $tree = [ - new DAV\SimpleCollection('foo'), - ]; - $server = new DAV\Server($tree); - $server->addPlugin(new DAV\Auth\Plugin()); - $server->addPlugin(new Plugin()); - - $result = $server->updateProperties('foo', [ - '{DAV:}foo' => 'bar', - ]); - - $expected = [ - '{DAV:}foo' => 403, - ]; - - $this->assertEquals($expected, $result); - } - - public function testRemoveGroupMembers() - { - $tree = [ - new MockPrincipal('foo', 'foo'), - ]; - $server = new DAV\Server($tree); - $plugin = new Plugin(); - $plugin->allowUnauthenticatedAccess = false; - $server->addPlugin($plugin); - - $result = $server->updateProperties('foo', [ - '{DAV:}group-member-set' => null, - ]); - - $expected = [ - '{DAV:}group-member-set' => 204, - ]; - - $this->assertEquals($expected, $result); - $this->assertEquals([], $tree[0]->getGroupMemberSet()); - } - - public function testSetGroupMembers() - { - $tree = [ - new MockPrincipal('foo', 'foo'), - ]; - $server = new DAV\Server($tree); - $plugin = new Plugin(); - $plugin->allowUnauthenticatedAccess = false; - $server->addPlugin($plugin); - - $result = $server->updateProperties('foo', [ - '{DAV:}group-member-set' => new DAV\Xml\Property\Href(['/bar', '/baz'], true), - ]); - - $expected = [ - '{DAV:}group-member-set' => 200, - ]; - - $this->assertEquals($expected, $result); - $this->assertEquals(['bar', 'baz'], $tree[0]->getGroupMemberSet()); - } - - public function testSetBadValue() - { - $this->expectException('Sabre\DAV\Exception'); - $tree = [ - new MockPrincipal('foo', 'foo'), - ]; - $server = new DAV\Server($tree); - $plugin = new Plugin(); - $plugin->allowUnauthenticatedAccess = false; - $server->addPlugin($plugin); - - $result = $server->updateProperties('foo', [ - '{DAV:}group-member-set' => new \StdClass(), - ]); - } - - public function testSetBadNode() - { - $tree = [ - new DAV\SimpleCollection('foo'), - ]; - $server = new DAV\Server($tree); - $plugin = new Plugin(); - $plugin->allowUnauthenticatedAccess = false; - $server->addPlugin($plugin); - - $result = $server->updateProperties('foo', [ - '{DAV:}group-member-set' => new DAV\Xml\Property\Href(['/bar', '/baz'], false), - ]); - - $expected = [ - '{DAV:}group-member-set' => 403, - ]; - - $this->assertEquals($expected, $result); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalBackend/AbstractPDOTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalBackend/AbstractPDOTest.php deleted file mode 100644 index b18ab9488..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalBackend/AbstractPDOTest.php +++ /dev/null @@ -1,219 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAVACL\PrincipalBackend; - -use Sabre\DAV; - -abstract class AbstractPDOTest extends \PHPUnit\Framework\TestCase -{ - use DAV\DbTestHelperTrait; - - public function setup(): void - { - $this->dropTables(['principals', 'groupmembers']); - $this->createSchema('principals'); - - $pdo = $this->getPDO(); - - $pdo->query("INSERT INTO principals (uri,email,displayname) VALUES ('principals/user','user@example.org','User')"); - $pdo->query("INSERT INTO principals (uri,email,displayname) VALUES ('principals/group','group@example.org','Group')"); - - $pdo->query('INSERT INTO groupmembers (principal_id,member_id) VALUES (5,4)'); - } - - public function testConstruct() - { - $pdo = $this->getPDO(); - $backend = new PDO($pdo); - $this->assertTrue($backend instanceof PDO); - } - - /** - * @depends testConstruct - */ - public function testGetPrincipalsByPrefix() - { - $pdo = $this->getPDO(); - $backend = new PDO($pdo); - - $expected = [ - [ - 'uri' => 'principals/admin', - '{http://sabredav.org/ns}email-address' => 'admin@example.org', - '{DAV:}displayname' => 'Administrator', - ], - [ - 'uri' => 'principals/user', - '{http://sabredav.org/ns}email-address' => 'user@example.org', - '{DAV:}displayname' => 'User', - ], - [ - 'uri' => 'principals/group', - '{http://sabredav.org/ns}email-address' => 'group@example.org', - '{DAV:}displayname' => 'Group', - ], - ]; - - $this->assertEquals($expected, $backend->getPrincipalsByPrefix('principals')); - $this->assertEquals([], $backend->getPrincipalsByPrefix('foo')); - } - - /** - * @depends testConstruct - */ - public function testGetPrincipalByPath() - { - $pdo = $this->getPDO(); - $backend = new PDO($pdo); - - $expected = [ - 'id' => 4, - 'uri' => 'principals/user', - '{http://sabredav.org/ns}email-address' => 'user@example.org', - '{DAV:}displayname' => 'User', - ]; - - $this->assertEquals($expected, $backend->getPrincipalByPath('principals/user')); - $this->assertEquals(null, $backend->getPrincipalByPath('foo')); - } - - public function testGetGroupMemberSet() - { - $pdo = $this->getPDO(); - $backend = new PDO($pdo); - $expected = ['principals/user']; - - $this->assertEquals($expected, $backend->getGroupMemberSet('principals/group')); - } - - public function testGetGroupMembership() - { - $pdo = $this->getPDO(); - $backend = new PDO($pdo); - $expected = ['principals/group']; - - $this->assertEquals($expected, $backend->getGroupMembership('principals/user')); - } - - public function testSetGroupMemberSet() - { - $pdo = $this->getPDO(); - - // Start situation - $backend = new PDO($pdo); - $this->assertEquals(['principals/user'], $backend->getGroupMemberSet('principals/group')); - - // Removing all principals - $backend->setGroupMemberSet('principals/group', []); - $this->assertEquals([], $backend->getGroupMemberSet('principals/group')); - - // Adding principals again - $backend->setGroupMemberSet('principals/group', ['principals/user']); - $this->assertEquals(['principals/user'], $backend->getGroupMemberSet('principals/group')); - } - - public function testSearchPrincipals() - { - $pdo = $this->getPDO(); - - $backend = new PDO($pdo); - - $result = $backend->searchPrincipals('principals', ['{DAV:}blabla' => 'foo']); - $this->assertEquals([], $result); - - $result = $backend->searchPrincipals('principals', ['{DAV:}displayname' => 'ou']); - $this->assertEquals(['principals/group'], $result); - - $result = $backend->searchPrincipals('principals', ['{DAV:}displayname' => 'UsEr', '{http://sabredav.org/ns}email-address' => 'USER@EXAMPLE']); - $this->assertEquals(['principals/user'], $result); - - $result = $backend->searchPrincipals('mom', ['{DAV:}displayname' => 'UsEr', '{http://sabredav.org/ns}email-address' => 'USER@EXAMPLE']); - $this->assertEquals([], $result); - } - - public function testUpdatePrincipal() - { - $pdo = $this->getPDO(); - $backend = new PDO($pdo); - - $propPatch = new DAV\PropPatch([ - '{DAV:}displayname' => 'pietje', - ]); - - $backend->updatePrincipal('principals/user', $propPatch); - $result = $propPatch->commit(); - - $this->assertTrue($result); - - $this->assertEquals([ - 'id' => 4, - 'uri' => 'principals/user', - '{DAV:}displayname' => 'pietje', - '{http://sabredav.org/ns}email-address' => 'user@example.org', - ], $backend->getPrincipalByPath('principals/user')); - } - - public function testUpdatePrincipalUnknownField() - { - $pdo = $this->getPDO(); - $backend = new PDO($pdo); - - $propPatch = new DAV\PropPatch([ - '{DAV:}displayname' => 'pietje', - '{DAV:}unknown' => 'foo', - ]); - - $backend->updatePrincipal('principals/user', $propPatch); - $result = $propPatch->commit(); - - $this->assertFalse($result); - - $this->assertEquals([ - '{DAV:}displayname' => 424, - '{DAV:}unknown' => 403, - ], $propPatch->getResult()); - - $this->assertEquals([ - 'id' => '4', - 'uri' => 'principals/user', - '{DAV:}displayname' => 'User', - '{http://sabredav.org/ns}email-address' => 'user@example.org', - ], $backend->getPrincipalByPath('principals/user')); - } - - public function testFindByUriUnknownScheme() - { - $pdo = $this->getPDO(); - $backend = new PDO($pdo); - $this->assertNull($backend->findByUri('http://foo', 'principals')); - } - - public function testFindByUriWithMailtoAddress() - { - $pdo = $this->getPDO(); - $backend = new PDO($pdo); - $this->assertEquals( - 'principals/user', - $backend->findByUri('mailto:user@example.org', 'principals') - ); - } - - public function testFindByUriWithUri() - { - $pdo = $this->getPDO(); - $backend = new PDO($pdo); - $this->assertEquals( - 'principals/user', - $backend->findByUri('principals/user', 'principals') - ); - } - - public function testFindByUriWithUnknownUri() - { - $pdo = $this->getPDO(); - $backend = new PDO($pdo); - $this->assertNull($backend->findByUri('principals/other', 'principals')); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalBackend/Mock.php b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalBackend/Mock.php deleted file mode 100644 index 5f0434579..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalBackend/Mock.php +++ /dev/null @@ -1,158 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAVACL\PrincipalBackend; - -class Mock extends AbstractBackend -{ - public $groupMembers = []; - public $principals; - - public function __construct(array $principals = null) - { - $this->principals = $principals; - - if (is_null($principals)) { - $this->principals = [ - [ - 'uri' => 'principals/user1', - '{DAV:}displayname' => 'User 1', - '{http://sabredav.org/ns}email-address' => 'user1.sabredav@sabredav.org', - '{http://sabredav.org/ns}vcard-url' => 'addressbooks/user1/book1/vcard1.vcf', - ], - [ - 'uri' => 'principals/admin', - '{DAV:}displayname' => 'Admin', - ], - [ - 'uri' => 'principals/user2', - '{DAV:}displayname' => 'User 2', - '{http://sabredav.org/ns}email-address' => 'user2.sabredav@sabredav.org', - ], - ]; - } - } - - public function getPrincipalsByPrefix($prefix) - { - $prefix = trim($prefix, '/'); - if ($prefix) { - $prefix .= '/'; - } - $return = []; - - foreach ($this->principals as $principal) { - if ($prefix && 0 !== strpos($principal['uri'], $prefix)) { - continue; - } - - $return[] = $principal; - } - - return $return; - } - - public function addPrincipal(array $principal) - { - $this->principals[] = $principal; - } - - public function getPrincipalByPath($path) - { - foreach ($this->getPrincipalsByPrefix('principals') as $principal) { - if ($principal['uri'] === $path) { - return $principal; - } - } - } - - public function searchPrincipals($prefixPath, array $searchProperties, $test = 'allof') - { - $matches = []; - foreach ($this->getPrincipalsByPrefix($prefixPath) as $principal) { - foreach ($searchProperties as $key => $value) { - if (!isset($principal[$key])) { - continue 2; - } - if (false === mb_stripos($principal[$key], $value, 0, 'UTF-8')) { - continue 2; - } - - // We have a match for this searchProperty! - if ('allof' === $test) { - continue; - } else { - break; - } - } - $matches[] = $principal['uri']; - } - - return $matches; - } - - public function getGroupMemberSet($path) - { - return isset($this->groupMembers[$path]) ? $this->groupMembers[$path] : []; - } - - public function getGroupMembership($path) - { - $membership = []; - foreach ($this->groupMembers as $group => $members) { - if (in_array($path, $members)) { - $membership[] = $group; - } - } - - return $membership; - } - - public function setGroupMemberSet($path, array $members) - { - $this->groupMembers[$path] = $members; - } - - /** - * Updates one ore more webdav properties on a principal. - * - * The list of mutations is stored in a Sabre\DAV\PropPatch object. - * To do the actual updates, you must tell this object which properties - * you're going to process with the handle() method. - * - * Calling the handle method is like telling the PropPatch object "I - * promise I can handle updating this property". - * - * Read the PropPatch documentation for more info and examples. - * - * @param string $path - */ - public function updatePrincipal($path, \Sabre\DAV\PropPatch $propPatch) - { - $value = null; - foreach ($this->principals as $principalIndex => $value) { - if ($value['uri'] === $path) { - $principal = $value; - break; - } - } - if (!$principal) { - return; - } - - $propPatch->handleRemaining(function ($mutations) use ($principal, $principalIndex) { - foreach ($mutations as $prop => $value) { - if (is_null($value) && isset($principal[$prop])) { - unset($principal[$prop]); - } else { - $principal[$prop] = $value; - } - } - - $this->principals[$principalIndex] = $principal; - - return true; - }); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalBackend/PDOMySQLTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalBackend/PDOMySQLTest.php deleted file mode 100644 index 54795cf4d..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalBackend/PDOMySQLTest.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAVACL\PrincipalBackend; - -class PDOMySQLTest extends AbstractPDOTest -{ - public $driver = 'mysql'; -} diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalBackend/PDOSqliteTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalBackend/PDOSqliteTest.php deleted file mode 100644 index 549e0bd60..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalBackend/PDOSqliteTest.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAVACL\PrincipalBackend; - -class PDOSqliteTest extends AbstractPDOTest -{ - public $driver = 'sqlite'; -} diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalCollectionTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalCollectionTest.php deleted file mode 100644 index 2777281a8..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalCollectionTest.php +++ /dev/null @@ -1,55 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAVACL; - -class PrincipalCollectionTest extends \PHPUnit\Framework\TestCase -{ - public function testBasic() - { - $backend = new PrincipalBackend\Mock(); - $pc = new PrincipalCollection($backend); - $this->assertTrue($pc instanceof PrincipalCollection); - - $this->assertEquals('principals', $pc->getName()); - } - - /** - * @depends testBasic - */ - public function testGetChildren() - { - $backend = new PrincipalBackend\Mock(); - $pc = new PrincipalCollection($backend); - - $children = $pc->getChildren(); - $this->assertTrue(is_array($children)); - - foreach ($children as $child) { - $this->assertTrue($child instanceof IPrincipal); - } - } - - /** - * @depends testBasic - */ - public function testGetChildrenDisable() - { - $this->expectException('Sabre\DAV\Exception\MethodNotAllowed'); - $backend = new PrincipalBackend\Mock(); - $pc = new PrincipalCollection($backend); - $pc->disableListing = true; - - $children = $pc->getChildren(); - } - - public function testFindByUri() - { - $backend = new PrincipalBackend\Mock(); - $pc = new PrincipalCollection($backend); - $this->assertEquals('principals/user1', $pc->findByUri('mailto:user1.sabredav@sabredav.org')); - $this->assertNull($pc->findByUri('mailto:fake.user.sabredav@sabredav.org')); - $this->assertNull($pc->findByUri('')); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalPropertySearchTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalPropertySearchTest.php deleted file mode 100644 index 6883f25b4..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalPropertySearchTest.php +++ /dev/null @@ -1,389 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAVACL; - -use Sabre\DAV; -use Sabre\HTTP; - -class PrincipalPropertySearchTest extends \PHPUnit\Framework\TestCase -{ - public function getServer() - { - $backend = new PrincipalBackend\Mock(); - - $dir = new DAV\SimpleCollection('root'); - $principals = new PrincipalCollection($backend); - $dir->addChild($principals); - - $fakeServer = new DAV\Server($dir); - $fakeServer->sapi = new HTTP\SapiMock(); - $fakeServer->httpResponse = new HTTP\ResponseMock(); - $fakeServer->debugExceptions = true; - $plugin = new MockPlugin(); - $plugin->allowAccessToNodesWithoutACL = true; - $plugin->allowUnauthenticatedAccess = false; - - $this->assertTrue($plugin instanceof Plugin); - $fakeServer->addPlugin($plugin); - $this->assertEquals($plugin, $fakeServer->getPlugin('acl')); - - return $fakeServer; - } - - public function testDepth1() - { - $xml = '<?xml version="1.0"?> -<d:principal-property-search xmlns:d="DAV:"> - <d:property-search> - <d:prop> - <d:displayname /> - </d:prop> - <d:match>user</d:match> - </d:property-search> - <d:prop> - <d:displayname /> - <d:getcontentlength /> - </d:prop> -</d:principal-property-search>'; - - $serverVars = [ - 'REQUEST_METHOD' => 'REPORT', - 'HTTP_DEPTH' => '1', - 'REQUEST_URI' => '/principals', - ]; - - $request = HTTP\Sapi::createFromServerArray($serverVars); - $request->setBody($xml); - - $server = $this->getServer(); - $server->httpRequest = $request; - - $server->exec(); - - $this->assertEquals(400, $server->httpResponse->getStatus(), $server->httpResponse->getBodyAsString()); - $this->assertEquals([ - 'X-Sabre-Version' => [DAV\Version::VERSION], - 'Content-Type' => ['application/xml; charset=utf-8'], - ], $server->httpResponse->getHeaders()); - } - - public function testUnknownSearchField() - { - $xml = '<?xml version="1.0"?> -<d:principal-property-search xmlns:d="DAV:"> - <d:property-search> - <d:prop> - <d:yourmom /> - </d:prop> - <d:match>user</d:match> - </d:property-search> - <d:prop> - <d:displayname /> - <d:getcontentlength /> - </d:prop> -</d:principal-property-search>'; - - $serverVars = [ - 'REQUEST_METHOD' => 'REPORT', - 'HTTP_DEPTH' => '0', - 'REQUEST_URI' => '/principals', - ]; - - $request = HTTP\Sapi::createFromServerArray($serverVars); - $request->setBody($xml); - - $server = $this->getServer(); - $server->httpRequest = $request; - - $server->exec(); - - $this->assertEquals(207, $server->httpResponse->getStatus(), 'Full body: '.$server->httpResponse->getBodyAsString()); - $this->assertEquals([ - 'X-Sabre-Version' => [DAV\Version::VERSION], - 'Content-Type' => ['application/xml; charset=utf-8'], - 'Vary' => ['Brief,Prefer'], - ], $server->httpResponse->getHeaders()); - } - - public function testCorrect() - { - $xml = '<?xml version="1.0"?> -<d:principal-property-search xmlns:d="DAV:"> - <d:apply-to-principal-collection-set /> - <d:property-search> - <d:prop> - <d:displayname /> - </d:prop> - <d:match>user</d:match> - </d:property-search> - <d:prop> - <d:displayname /> - <d:getcontentlength /> - </d:prop> -</d:principal-property-search>'; - - $serverVars = [ - 'REQUEST_METHOD' => 'REPORT', - 'HTTP_DEPTH' => '0', - 'REQUEST_URI' => '/', - ]; - - $request = HTTP\Sapi::createFromServerArray($serverVars); - $request->setBody($xml); - - $server = $this->getServer(); - $server->httpRequest = $request; - - $server->exec(); - - $bodyAsString = $server->httpResponse->getBodyAsString(); - $this->assertEquals(207, $server->httpResponse->status, $bodyAsString); - $this->assertEquals([ - 'X-Sabre-Version' => [DAV\Version::VERSION], - 'Content-Type' => ['application/xml; charset=utf-8'], - 'Vary' => ['Brief,Prefer'], - ], $server->httpResponse->getHeaders()); - - $check = [ - '/d:multistatus', - '/d:multistatus/d:response' => 2, - '/d:multistatus/d:response/d:href' => 2, - '/d:multistatus/d:response/d:propstat' => 4, - '/d:multistatus/d:response/d:propstat/d:prop' => 4, - '/d:multistatus/d:response/d:propstat/d:prop/d:displayname' => 2, - '/d:multistatus/d:response/d:propstat/d:prop/d:getcontentlength' => 2, - '/d:multistatus/d:response/d:propstat/d:status' => 4, - ]; - - $xml = simplexml_load_string($bodyAsString); - $xml->registerXPathNamespace('d', 'DAV:'); - foreach ($check as $v1 => $v2) { - $xpath = is_int($v1) ? $v2 : $v1; - - $result = $xml->xpath($xpath); - - $count = 1; - if (!is_int($v1)) { - $count = $v2; - } - - $this->assertEquals($count, count($result), 'we expected '.$count.' appearances of '.$xpath.' . We found '.count($result).'. Full response body: '.$server->httpResponse->getBodyAsString()); - } - } - - public function testAND() - { - $xml = '<?xml version="1.0"?> -<d:principal-property-search xmlns:d="DAV:"> - <d:apply-to-principal-collection-set /> - <d:property-search> - <d:prop> - <d:displayname /> - </d:prop> - <d:match>user</d:match> - </d:property-search> - <d:property-search> - <d:prop> - <d:foo /> - </d:prop> - <d:match>bar</d:match> - </d:property-search> - <d:prop> - <d:displayname /> - <d:getcontentlength /> - </d:prop> -</d:principal-property-search>'; - - $serverVars = [ - 'REQUEST_METHOD' => 'REPORT', - 'HTTP_DEPTH' => '0', - 'REQUEST_URI' => '/', - ]; - - $request = HTTP\Sapi::createFromServerArray($serverVars); - $request->setBody($xml); - - $server = $this->getServer(); - $server->httpRequest = $request; - - $server->exec(); - - $bodyAsString = $server->httpResponse->getBodyAsString(); - $this->assertEquals(207, $server->httpResponse->status, $bodyAsString); - $this->assertEquals([ - 'X-Sabre-Version' => [DAV\Version::VERSION], - 'Content-Type' => ['application/xml; charset=utf-8'], - 'Vary' => ['Brief,Prefer'], - ], $server->httpResponse->getHeaders()); - - $check = [ - '/d:multistatus', - '/d:multistatus/d:response' => 0, - '/d:multistatus/d:response/d:href' => 0, - '/d:multistatus/d:response/d:propstat' => 0, - '/d:multistatus/d:response/d:propstat/d:prop' => 0, - '/d:multistatus/d:response/d:propstat/d:prop/d:displayname' => 0, - '/d:multistatus/d:response/d:propstat/d:prop/d:getcontentlength' => 0, - '/d:multistatus/d:response/d:propstat/d:status' => 0, - ]; - - $xml = simplexml_load_string($bodyAsString); - $xml->registerXPathNamespace('d', 'DAV:'); - foreach ($check as $v1 => $v2) { - $xpath = is_int($v1) ? $v2 : $v1; - - $result = $xml->xpath($xpath); - - $count = 1; - if (!is_int($v1)) { - $count = $v2; - } - - $this->assertEquals($count, count($result), 'we expected '.$count.' appearances of '.$xpath.' . We found '.count($result).'. Full response body: '.$server->httpResponse->getBodyAsString()); - } - } - - public function testOR() - { - $xml = '<?xml version="1.0"?> -<d:principal-property-search xmlns:d="DAV:" test="anyof"> - <d:apply-to-principal-collection-set /> - <d:property-search> - <d:prop> - <d:displayname /> - </d:prop> - <d:match>user</d:match> - </d:property-search> - <d:property-search> - <d:prop> - <d:foo /> - </d:prop> - <d:match>bar</d:match> - </d:property-search> - <d:prop> - <d:displayname /> - <d:getcontentlength /> - </d:prop> -</d:principal-property-search>'; - - $serverVars = [ - 'REQUEST_METHOD' => 'REPORT', - 'HTTP_DEPTH' => '0', - 'REQUEST_URI' => '/', - ]; - - $request = HTTP\Sapi::createFromServerArray($serverVars); - $request->setBody($xml); - - $server = $this->getServer(); - $server->httpRequest = $request; - - $server->exec(); - - $bodyAsString = $server->httpResponse->getBodyAsString(); - $this->assertEquals(207, $server->httpResponse->status, $bodyAsString); - $this->assertEquals([ - 'X-Sabre-Version' => [DAV\Version::VERSION], - 'Content-Type' => ['application/xml; charset=utf-8'], - 'Vary' => ['Brief,Prefer'], - ], $server->httpResponse->getHeaders()); - - $check = [ - '/d:multistatus', - '/d:multistatus/d:response' => 2, - '/d:multistatus/d:response/d:href' => 2, - '/d:multistatus/d:response/d:propstat' => 4, - '/d:multistatus/d:response/d:propstat/d:prop' => 4, - '/d:multistatus/d:response/d:propstat/d:prop/d:displayname' => 2, - '/d:multistatus/d:response/d:propstat/d:prop/d:getcontentlength' => 2, - '/d:multistatus/d:response/d:propstat/d:status' => 4, - ]; - - $xml = simplexml_load_string($bodyAsString); - $xml->registerXPathNamespace('d', 'DAV:'); - foreach ($check as $v1 => $v2) { - $xpath = is_int($v1) ? $v2 : $v1; - - $result = $xml->xpath($xpath); - - $count = 1; - if (!is_int($v1)) { - $count = $v2; - } - - $this->assertEquals($count, count($result), 'we expected '.$count.' appearances of '.$xpath.' . We found '.count($result).'. Full response body: '.$server->httpResponse->getBodyAsString()); - } - } - - public function testWrongUri() - { - $xml = '<?xml version="1.0"?> -<d:principal-property-search xmlns:d="DAV:"> - <d:property-search> - <d:prop> - <d:displayname /> - </d:prop> - <d:match>user</d:match> - </d:property-search> - <d:prop> - <d:displayname /> - <d:getcontentlength /> - </d:prop> -</d:principal-property-search>'; - - $serverVars = [ - 'REQUEST_METHOD' => 'REPORT', - 'HTTP_DEPTH' => '0', - 'REQUEST_URI' => '/', - ]; - - $request = HTTP\Sapi::createFromServerArray($serverVars); - $request->setBody($xml); - - $server = $this->getServer(); - $server->httpRequest = $request; - - $server->exec(); - - $bodyAsString = $server->httpResponse->getBodyAsString(); - $this->assertEquals(207, $server->httpResponse->status, $bodyAsString); - $this->assertEquals([ - 'X-Sabre-Version' => [DAV\Version::VERSION], - 'Content-Type' => ['application/xml; charset=utf-8'], - 'Vary' => ['Brief,Prefer'], - ], $server->httpResponse->getHeaders()); - - $check = [ - '/d:multistatus', - '/d:multistatus/d:response' => 0, - ]; - - $xml = simplexml_load_string($bodyAsString); - $xml->registerXPathNamespace('d', 'DAV:'); - foreach ($check as $v1 => $v2) { - $xpath = is_int($v1) ? $v2 : $v1; - - $result = $xml->xpath($xpath); - - $count = 1; - if (!is_int($v1)) { - $count = $v2; - } - - $this->assertEquals($count, count($result), 'we expected '.$count.' appearances of '.$xpath.' . We found '.count($result).'. Full response body: '.$server->httpResponse->getBodyAsString()); - } - } -} - -class MockPlugin extends Plugin -{ - public function getCurrentUserPrivilegeSet($node) - { - return [ - '{DAV:}read', - '{DAV:}write', - ]; - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalSearchPropertySetTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalSearchPropertySetTest.php deleted file mode 100644 index ec834fe1a..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalSearchPropertySetTest.php +++ /dev/null @@ -1,135 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAVACL; - -use Sabre\DAV; -use Sabre\HTTP; - -class PrincipalSearchPropertySetTest extends \PHPUnit\Framework\TestCase -{ - public function getServer() - { - $backend = new PrincipalBackend\Mock(); - - $dir = new DAV\SimpleCollection('root'); - $principals = new PrincipalCollection($backend); - $dir->addChild($principals); - - $fakeServer = new DAV\Server($dir); - $fakeServer->sapi = new HTTP\SapiMock(); - $fakeServer->httpResponse = new HTTP\ResponseMock(); - $plugin = new Plugin(); - $plugin->allowUnauthenticatedAccess = false; - $this->assertTrue($plugin instanceof Plugin); - $fakeServer->addPlugin($plugin); - $this->assertEquals($plugin, $fakeServer->getPlugin('acl')); - - return $fakeServer; - } - - public function testDepth1() - { - $xml = '<?xml version="1.0"?> -<d:principal-search-property-set xmlns:d="DAV:" />'; - - $serverVars = [ - 'REQUEST_METHOD' => 'REPORT', - 'HTTP_DEPTH' => '1', - 'REQUEST_URI' => '/principals', - ]; - - $request = HTTP\Sapi::createFromServerArray($serverVars); - $request->setBody($xml); - - $server = $this->getServer(); - $server->httpRequest = $request; - - $server->exec(); - - $this->assertEquals(400, $server->httpResponse->status); - $this->assertEquals([ - 'X-Sabre-Version' => [DAV\Version::VERSION], - 'Content-Type' => ['application/xml; charset=utf-8'], - ], $server->httpResponse->getHeaders()); - } - - public function testDepthIncorrectXML() - { - $xml = '<?xml version="1.0"?> -<d:principal-search-property-set xmlns:d="DAV:"><d:ohell /></d:principal-search-property-set>'; - - $serverVars = [ - 'REQUEST_METHOD' => 'REPORT', - 'HTTP_DEPTH' => '0', - 'REQUEST_URI' => '/principals', - ]; - - $request = HTTP\Sapi::createFromServerArray($serverVars); - $request->setBody($xml); - - $server = $this->getServer(); - $server->httpRequest = $request; - - $server->exec(); - - $this->assertEquals(400, $server->httpResponse->status, $server->httpResponse->getBodyAsString()); - $this->assertEquals([ - 'X-Sabre-Version' => [DAV\Version::VERSION], - 'Content-Type' => ['application/xml; charset=utf-8'], - ], $server->httpResponse->getHeaders()); - } - - public function testCorrect() - { - $xml = '<?xml version="1.0"?> -<d:principal-search-property-set xmlns:d="DAV:"/>'; - - $serverVars = [ - 'REQUEST_METHOD' => 'REPORT', - 'HTTP_DEPTH' => '0', - 'REQUEST_URI' => '/principals', - ]; - - $request = HTTP\Sapi::createFromServerArray($serverVars); - $request->setBody($xml); - - $server = $this->getServer(); - $server->httpRequest = $request; - - $server->exec(); - - $bodyAsString = $server->httpResponse->getBodyAsString(); - $this->assertEquals(200, $server->httpResponse->status, $bodyAsString); - $this->assertEquals([ - 'X-Sabre-Version' => [DAV\Version::VERSION], - 'Content-Type' => ['application/xml; charset=utf-8'], - ], $server->httpResponse->getHeaders()); - - $check = [ - '/d:principal-search-property-set', - '/d:principal-search-property-set/d:principal-search-property' => 2, - '/d:principal-search-property-set/d:principal-search-property/d:prop' => 2, - '/d:principal-search-property-set/d:principal-search-property/d:prop/d:displayname' => 1, - '/d:principal-search-property-set/d:principal-search-property/d:prop/s:email-address' => 1, - '/d:principal-search-property-set/d:principal-search-property/d:description' => 2, - ]; - - $xml = simplexml_load_string($bodyAsString); - $xml->registerXPathNamespace('d', 'DAV:'); - $xml->registerXPathNamespace('s', 'http://sabredav.org/ns'); - foreach ($check as $v1 => $v2) { - $xpath = is_int($v1) ? $v2 : $v1; - - $result = $xml->xpath($xpath); - - $count = 1; - if (!is_int($v1)) { - $count = $v2; - } - - $this->assertEquals($count, count($result), 'we expected '.$count.' appearances of '.$xpath.' . We found '.count($result).'. Full response body: '.$bodyAsString); - } - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalTest.php deleted file mode 100644 index 7e1656a15..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/PrincipalTest.php +++ /dev/null @@ -1,192 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAVACL; - -use Sabre\DAV; - -class PrincipalTest extends \PHPUnit\Framework\TestCase -{ - public function testConstruct() - { - $principalBackend = new PrincipalBackend\Mock(); - $principal = new Principal($principalBackend, ['uri' => 'principals/admin']); - $this->assertTrue($principal instanceof Principal); - } - - public function testConstructNoUri() - { - $this->expectException('Sabre\DAV\Exception'); - $principalBackend = new PrincipalBackend\Mock(); - $principal = new Principal($principalBackend, []); - } - - public function testGetName() - { - $principalBackend = new PrincipalBackend\Mock(); - $principal = new Principal($principalBackend, ['uri' => 'principals/admin']); - $this->assertEquals('admin', $principal->getName()); - } - - public function testGetDisplayName() - { - $principalBackend = new PrincipalBackend\Mock(); - $principal = new Principal($principalBackend, ['uri' => 'principals/admin']); - $this->assertEquals('admin', $principal->getDisplayname()); - - $principal = new Principal($principalBackend, [ - 'uri' => 'principals/admin', - '{DAV:}displayname' => 'Mr. Admin', - ]); - $this->assertEquals('Mr. Admin', $principal->getDisplayname()); - } - - public function testGetProperties() - { - $principalBackend = new PrincipalBackend\Mock(); - $principal = new Principal($principalBackend, [ - 'uri' => 'principals/admin', - '{DAV:}displayname' => 'Mr. Admin', - '{http://www.example.org/custom}custom' => 'Custom', - '{http://sabredav.org/ns}email-address' => 'admin@example.org', - ]); - - $keys = [ - '{DAV:}displayname', - '{http://www.example.org/custom}custom', - '{http://sabredav.org/ns}email-address', - ]; - $props = $principal->getProperties($keys); - - foreach ($keys as $key) { - $this->assertArrayHasKey($key, $props); - } - - $this->assertEquals('Mr. Admin', $props['{DAV:}displayname']); - - $this->assertEquals('admin@example.org', $props['{http://sabredav.org/ns}email-address']); - } - - public function testUpdateProperties() - { - $principalBackend = new PrincipalBackend\Mock(); - $principal = new Principal($principalBackend, ['uri' => 'principals/admin']); - - $propPatch = new DAV\PropPatch(['{DAV:}yourmom' => 'test']); - - $result = $principal->propPatch($propPatch); - $result = $propPatch->commit(); - $this->assertTrue($result); - } - - public function testGetPrincipalUrl() - { - $principalBackend = new PrincipalBackend\Mock(); - $principal = new Principal($principalBackend, ['uri' => 'principals/admin']); - $this->assertEquals('principals/admin', $principal->getPrincipalUrl()); - } - - public function testGetAlternateUriSet() - { - $principalBackend = new PrincipalBackend\Mock(); - $principal = new Principal($principalBackend, [ - 'uri' => 'principals/admin', - '{DAV:}displayname' => 'Mr. Admin', - '{http://www.example.org/custom}custom' => 'Custom', - '{http://sabredav.org/ns}email-address' => 'admin@example.org', - '{DAV:}alternate-URI-set' => [ - 'mailto:admin+1@example.org', - 'mailto:admin+2@example.org', - 'mailto:admin@example.org', - ], - ]); - - $expected = [ - 'mailto:admin+1@example.org', - 'mailto:admin+2@example.org', - 'mailto:admin@example.org', - ]; - - $this->assertEquals($expected, $principal->getAlternateUriSet()); - } - - public function testGetAlternateUriSetEmpty() - { - $principalBackend = new PrincipalBackend\Mock(); - $principal = new Principal($principalBackend, [ - 'uri' => 'principals/admin', - ]); - - $expected = []; - - $this->assertEquals($expected, $principal->getAlternateUriSet()); - } - - public function testGetGroupMemberSet() - { - $principalBackend = new PrincipalBackend\Mock(); - $principal = new Principal($principalBackend, ['uri' => 'principals/admin']); - $this->assertEquals([], $principal->getGroupMemberSet()); - } - - public function testGetGroupMembership() - { - $principalBackend = new PrincipalBackend\Mock(); - $principal = new Principal($principalBackend, ['uri' => 'principals/admin']); - $this->assertEquals([], $principal->getGroupMembership()); - } - - public function testSetGroupMemberSet() - { - $principalBackend = new PrincipalBackend\Mock(); - $principal = new Principal($principalBackend, ['uri' => 'principals/admin']); - $principal->setGroupMemberSet(['principals/foo']); - - $this->assertEquals([ - 'principals/admin' => ['principals/foo'], - ], $principalBackend->groupMembers); - } - - public function testGetOwner() - { - $principalBackend = new PrincipalBackend\Mock(); - $principal = new Principal($principalBackend, ['uri' => 'principals/admin']); - $this->assertEquals('principals/admin', $principal->getOwner()); - } - - public function testGetGroup() - { - $principalBackend = new PrincipalBackend\Mock(); - $principal = new Principal($principalBackend, ['uri' => 'principals/admin']); - $this->assertNull($principal->getGroup()); - } - - public function testGetACl() - { - $principalBackend = new PrincipalBackend\Mock(); - $principal = new Principal($principalBackend, ['uri' => 'principals/admin']); - $this->assertEquals([ - [ - 'privilege' => '{DAV:}all', - 'principal' => '{DAV:}owner', - 'protected' => true, - ], - ], $principal->getACL()); - } - - public function testSetACl() - { - $this->expectException('Sabre\DAV\Exception\Forbidden'); - $principalBackend = new PrincipalBackend\Mock(); - $principal = new Principal($principalBackend, ['uri' => 'principals/admin']); - $principal->setACL([]); - } - - public function testGetSupportedPrivilegeSet() - { - $principalBackend = new PrincipalBackend\Mock(); - $principal = new Principal($principalBackend, ['uri' => 'principals/admin']); - $this->assertNull($principal->getSupportedPrivilegeSet()); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAVACL/SimplePluginTest.php b/vendor/sabre/dav/tests/Sabre/DAVACL/SimplePluginTest.php deleted file mode 100644 index effa15838..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAVACL/SimplePluginTest.php +++ /dev/null @@ -1,302 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\DAVACL; - -use Sabre\DAV; -use Sabre\HTTP; - -class SimplePluginTest extends \PHPUnit\Framework\TestCase -{ - public function testValues() - { - $aclPlugin = new Plugin(); - $this->assertEquals('acl', $aclPlugin->getPluginName()); - $this->assertEquals( - ['access-control', 'calendarserver-principal-property-search'], - $aclPlugin->getFeatures() - ); - - $this->assertEquals( - [ - '{DAV:}expand-property', - '{DAV:}principal-match', - '{DAV:}principal-property-search', - '{DAV:}principal-search-property-set', - ], - $aclPlugin->getSupportedReportSet('')); - - $this->assertEquals(['ACL'], $aclPlugin->getMethods('')); - - $this->assertEquals( - 'acl', - $aclPlugin->getPluginInfo()['name'] - ); - } - - public function testGetFlatPrivilegeSet() - { - $expected = [ - '{DAV:}all' => [ - 'privilege' => '{DAV:}all', - 'abstract' => false, - 'aggregates' => [ - '{DAV:}read', - '{DAV:}write', - ], - 'concrete' => '{DAV:}all', - ], - '{DAV:}read' => [ - 'privilege' => '{DAV:}read', - 'abstract' => false, - 'aggregates' => [ - '{DAV:}read-acl', - '{DAV:}read-current-user-privilege-set', - ], - 'concrete' => '{DAV:}read', - ], - '{DAV:}read-acl' => [ - 'privilege' => '{DAV:}read-acl', - 'abstract' => false, - 'aggregates' => [], - 'concrete' => '{DAV:}read-acl', - ], - '{DAV:}read-current-user-privilege-set' => [ - 'privilege' => '{DAV:}read-current-user-privilege-set', - 'abstract' => false, - 'aggregates' => [], - 'concrete' => '{DAV:}read-current-user-privilege-set', - ], - '{DAV:}write' => [ - 'privilege' => '{DAV:}write', - 'abstract' => false, - 'aggregates' => [ - '{DAV:}write-properties', - '{DAV:}write-content', - '{DAV:}unlock', - '{DAV:}bind', - '{DAV:}unbind', - ], - 'concrete' => '{DAV:}write', - ], - '{DAV:}write-properties' => [ - 'privilege' => '{DAV:}write-properties', - 'abstract' => false, - 'aggregates' => [], - 'concrete' => '{DAV:}write-properties', - ], - '{DAV:}write-content' => [ - 'privilege' => '{DAV:}write-content', - 'abstract' => false, - 'aggregates' => [], - 'concrete' => '{DAV:}write-content', - ], - '{DAV:}unlock' => [ - 'privilege' => '{DAV:}unlock', - 'abstract' => false, - 'aggregates' => [], - 'concrete' => '{DAV:}unlock', - ], - '{DAV:}bind' => [ - 'privilege' => '{DAV:}bind', - 'abstract' => false, - 'aggregates' => [], - 'concrete' => '{DAV:}bind', - ], - '{DAV:}unbind' => [ - 'privilege' => '{DAV:}unbind', - 'abstract' => false, - 'aggregates' => [], - 'concrete' => '{DAV:}unbind', - ], - ]; - - $plugin = new Plugin(); - $plugin->allowUnauthenticatedAccess = false; - $server = new DAV\Server(); - $server->addPlugin($plugin); - $this->assertEquals($expected, $plugin->getFlatPrivilegeSet('')); - } - - public function testCurrentUserPrincipalsNotLoggedIn() - { - $acl = new Plugin(); - $acl->allowUnauthenticatedAccess = false; - $server = new DAV\Server(); - $server->addPlugin($acl); - - $this->assertEquals([], $acl->getCurrentUserPrincipals()); - } - - public function testCurrentUserPrincipalsSimple() - { - $tree = [ - new DAV\SimpleCollection('principals', [ - new MockPrincipal('admin', 'principals/admin'), - ]), - ]; - - $acl = new Plugin(); - $acl->allowUnauthenticatedAccess = false; - $server = new DAV\Server($tree); - $server->addPlugin($acl); - - $auth = new DAV\Auth\Plugin(new DAV\Auth\Backend\Mock()); - $server->addPlugin($auth); - - //forcing login - $auth->beforeMethod(new HTTP\Request('GET', '/'), new HTTP\Response()); - - $this->assertEquals(['principals/admin'], $acl->getCurrentUserPrincipals()); - } - - public function testCurrentUserPrincipalsGroups() - { - $tree = [ - new DAV\SimpleCollection('principals', [ - new MockPrincipal('admin', 'principals/admin', ['principals/administrators', 'principals/everyone']), - new MockPrincipal('administrators', 'principals/administrators', ['principals/groups'], ['principals/admin']), - new MockPrincipal('everyone', 'principals/everyone', [], ['principals/admin']), - new MockPrincipal('groups', 'principals/groups', [], ['principals/administrators']), - ]), - ]; - - $acl = new Plugin(); - $acl->allowUnauthenticatedAccess = false; - $server = new DAV\Server($tree); - $server->addPlugin($acl); - - $auth = new DAV\Auth\Plugin(new DAV\Auth\Backend\Mock()); - $server->addPlugin($auth); - - //forcing login - $auth->beforeMethod(new HTTP\Request('GET', '/'), new HTTP\Response()); - - $expected = [ - 'principals/admin', - 'principals/administrators', - 'principals/everyone', - 'principals/groups', - ]; - - $this->assertEquals($expected, $acl->getCurrentUserPrincipals()); - - // The second one should trigger the cache and be identical - $this->assertEquals($expected, $acl->getCurrentUserPrincipals()); - } - - public function testGetACL() - { - $acl = [ - [ - 'principal' => 'principals/admin', - 'privilege' => '{DAV:}read', - ], - [ - 'principal' => 'principals/admin', - 'privilege' => '{DAV:}write', - ], - ]; - - $tree = [ - new MockACLNode('foo', $acl), - ]; - - $server = new DAV\Server($tree); - $aclPlugin = new Plugin(); - $aclPlugin->allowUnauthenticatedAccess = false; - $server->addPlugin($aclPlugin); - - $this->assertEquals($acl, $aclPlugin->getACL('foo')); - } - - public function testGetCurrentUserPrivilegeSet() - { - $acl = [ - [ - 'principal' => 'principals/admin', - 'privilege' => '{DAV:}read', - ], - [ - 'principal' => 'principals/user1', - 'privilege' => '{DAV:}read', - ], - [ - 'principal' => 'principals/admin', - 'privilege' => '{DAV:}write', - ], - ]; - - $tree = [ - new MockACLNode('foo', $acl), - - new DAV\SimpleCollection('principals', [ - new MockPrincipal('admin', 'principals/admin'), - ]), - ]; - - $server = new DAV\Server($tree); - $aclPlugin = new Plugin(); - $aclPlugin->allowUnauthenticatedAccess = false; - $server->addPlugin($aclPlugin); - - $auth = new DAV\Auth\Plugin(new DAV\Auth\Backend\Mock()); - $server->addPlugin($auth); - - //forcing login - $auth->beforeMethod(new HTTP\Request('GET', '/'), new HTTP\Response()); - - $expected = [ - '{DAV:}write', - '{DAV:}write-properties', - '{DAV:}write-content', - '{DAV:}unlock', - '{DAV:}write-acl', - '{DAV:}read', - '{DAV:}read-acl', - '{DAV:}read-current-user-privilege-set', - ]; - - $this->assertEquals($expected, $aclPlugin->getCurrentUserPrivilegeSet('foo')); - } - - public function testCheckPrivileges() - { - $acl = [ - [ - 'principal' => 'principals/admin', - 'privilege' => '{DAV:}read', - ], - [ - 'principal' => 'principals/user1', - 'privilege' => '{DAV:}read', - ], - [ - 'principal' => 'principals/admin', - 'privilege' => '{DAV:}write', - ], - ]; - - $tree = [ - new MockACLNode('foo', $acl), - - new DAV\SimpleCollection('principals', [ - new MockPrincipal('admin', 'principals/admin'), - ]), - ]; - - $server = new DAV\Server($tree); - $aclPlugin = new Plugin(); - $aclPlugin->allowUnauthenticatedAccess = false; - $server->addPlugin($aclPlugin); - - $auth = new DAV\Auth\Plugin(new DAV\Auth\Backend\Mock()); - $server->addPlugin($auth); - - //forcing login - //$auth->beforeMethod('GET','/'); - - $this->assertFalse($aclPlugin->checkPrivileges('foo', ['{DAV:}read'], Plugin::R_PARENT, false)); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/DAVServerTest.php b/vendor/sabre/dav/tests/Sabre/DAVServerTest.php deleted file mode 100644 index 2f64df08c..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAVServerTest.php +++ /dev/null @@ -1,305 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre; - -use Sabre\HTTP\Request; -use Sabre\HTTP\Response; - -/** - * This class may be used as a basis for other webdav-related unittests. - * - * This class is supposed to provide a reasonably big framework to quickly get - * a testing environment running. - * - * @copyright Copyright (C) fruux GmbH (https://fruux.com/) - * @author Evert Pot (http://evertpot.com/) - * @license http://sabre.io/license/ Modified BSD License - */ -abstract class DAVServerTest extends \PHPUnit\Framework\TestCase -{ - protected $setupCalDAV = false; - protected $setupCardDAV = false; - protected $setupACL = false; - protected $setupCalDAVSharing = false; - protected $setupCalDAVScheduling = false; - protected $setupCalDAVSubscriptions = false; - protected $setupCalDAVICSExport = false; - protected $setupLocks = false; - protected $setupFiles = false; - protected $setupSharing = false; - protected $setupPropertyStorage = false; - - /** - * An array with calendars. Every calendar should have - * - principaluri - * - uri. - */ - protected $caldavCalendars = []; - protected $caldavCalendarObjects = []; - - protected $carddavAddressBooks = []; - protected $carddavCards = []; - - /** - * @var \Sabre\DAV\Server - */ - protected $server; - protected $tree = []; - - protected $caldavBackend; - protected $carddavBackend; - protected $principalBackend; - protected $locksBackend; - protected $propertyStorageBackend; - - /** - * @var \Sabre\CalDAV\Plugin - */ - protected $caldavPlugin; - - /** - * @var \Sabre\CardDAV\Plugin - */ - protected $carddavPlugin; - - /** - * @var \Sabre\DAVACL\Plugin - */ - protected $aclPlugin; - - /** - * @var \Sabre\CalDAV\SharingPlugin - */ - protected $caldavSharingPlugin; - - /** - * CalDAV scheduling plugin. - * - * @var CalDAV\Schedule\Plugin - */ - protected $caldavSchedulePlugin; - - /** - * @var CalDAV\ICSExportPlugin - */ - protected $caldavICSExportPlugin; - - /** - * @var \Sabre\DAV\Auth\Plugin - */ - protected $authPlugin; - - /** - * @var \Sabre\DAV\Locks\Plugin - */ - protected $locksPlugin; - - /** - * Sharing plugin. - * - * @var \Sabre\DAV\Sharing\Plugin - */ - protected $sharingPlugin; - - /* - * @var Sabre\DAV\PropertyStorage\Plugin - */ - protected $propertyStoragePlugin; - - /** - * If this string is set, we will automatically log in the user with this - * name. - */ - protected $autoLogin = null; - - public function setup(): void - { - $this->initializeEverything(); - } - - public function initializeEverything() - { - $this->setUpBackends(); - $this->setUpTree(); - - $this->server = new DAV\Server($this->tree); - $this->server->sapi = new HTTP\SapiMock(); - $this->server->debugExceptions = true; - - if ($this->setupCalDAV) { - $this->caldavPlugin = new CalDAV\Plugin(); - $this->server->addPlugin($this->caldavPlugin); - } - if ($this->setupCalDAVSharing || $this->setupSharing) { - $this->sharingPlugin = new DAV\Sharing\Plugin(); - $this->server->addPlugin($this->sharingPlugin); - } - if ($this->setupCalDAVSharing) { - $this->caldavSharingPlugin = new CalDAV\SharingPlugin(); - $this->server->addPlugin($this->caldavSharingPlugin); - } - if ($this->setupCalDAVScheduling) { - $this->caldavSchedulePlugin = new CalDAV\Schedule\Plugin(); - $this->server->addPlugin($this->caldavSchedulePlugin); - } - if ($this->setupCalDAVSubscriptions) { - $this->server->addPlugin(new CalDAV\Subscriptions\Plugin()); - } - if ($this->setupCalDAVICSExport) { - $this->caldavICSExportPlugin = new CalDAV\ICSExportPlugin(); - $this->server->addPlugin($this->caldavICSExportPlugin); - } - if ($this->setupCardDAV) { - $this->carddavPlugin = new CardDAV\Plugin(); - $this->server->addPlugin($this->carddavPlugin); - } - if ($this->setupLocks) { - $this->locksPlugin = new DAV\Locks\Plugin( - $this->locksBackend - ); - $this->server->addPlugin($this->locksPlugin); - } - if ($this->setupPropertyStorage) { - $this->propertyStoragePlugin = new DAV\PropertyStorage\Plugin( - $this->propertyStorageBackend - ); - $this->server->addPlugin($this->propertyStoragePlugin); - } - if ($this->autoLogin) { - $this->autoLogin($this->autoLogin); - } - if ($this->setupACL) { - $this->aclPlugin = new DAVACL\Plugin(); - if (!$this->autoLogin) { - $this->aclPlugin->allowUnauthenticatedAccess = false; - } - $this->aclPlugin->adminPrincipals = ['principals/admin']; - $this->server->addPlugin($this->aclPlugin); - } - } - - /** - * Makes a request, and returns a response object. - * - * You can either pass an instance of Sabre\HTTP\Request, or an array, - * which will then be used as the _SERVER array. - * - * If $expectedStatus is set, we'll compare it with the HTTP status of - * the returned response. If it doesn't match, we'll immediately fail - * the test. - * - * @param array|\Sabre\HTTP\Request $request - * @param int $expectedStatus - * - * @return \Sabre\HTTP\Response - */ - public function request($request, $expectedStatus = null) - { - if (is_array($request)) { - $request = HTTP\Sapi::createFromServerArray($request); - } - $response = new HTTP\ResponseMock(); - - $this->server->httpRequest = $request; - $this->server->httpResponse = $response; - $this->server->exec(); - - if ($expectedStatus) { - $responseBody = $expectedStatus !== $response->getStatus() ? $response->getBodyAsString() : ''; - $this->assertEquals($expectedStatus, $response->getStatus(), 'Incorrect HTTP status received for request. Response body: '.$responseBody); - } - - return $this->server->httpResponse; - } - - /** - * This function takes a username and sets the server in a state where - * this user is logged in, and no longer requires an authentication check. - * - * @param string $userName - */ - public function autoLogin($userName) - { - $authBackend = new DAV\Auth\Backend\Mock(); - $authBackend->setPrincipal('principals/'.$userName); - $this->authPlugin = new DAV\Auth\Plugin($authBackend); - - // If the auth plugin already exists, we're removing its hooks: - if ($oldAuth = $this->server->getPlugin('auth')) { - $this->server->removeListener('beforeMethod', [$oldAuth, 'beforeMethod']); - } - $this->server->addPlugin($this->authPlugin); - - // This will trigger the actual login procedure - $this->authPlugin->beforeMethod(new Request('GET', '/'), new Response()); - } - - /** - * Override this to provide your own Tree for your test-case. - */ - public function setUpTree() - { - if ($this->setupCalDAV) { - $this->tree[] = new CalDAV\CalendarRoot( - $this->principalBackend, - $this->caldavBackend - ); - } - if ($this->setupCardDAV) { - $this->tree[] = new CardDAV\AddressBookRoot( - $this->principalBackend, - $this->carddavBackend - ); - } - - if ($this->setupCalDAV) { - $this->tree[] = new CalDAV\Principal\Collection( - $this->principalBackend - ); - } elseif ($this->setupCardDAV || $this->setupACL) { - $this->tree[] = new DAVACL\PrincipalCollection( - $this->principalBackend - ); - } - if ($this->setupFiles) { - $this->tree[] = new DAV\Mock\Collection('files'); - } - } - - public function setUpBackends() - { - if ($this->setupCalDAVSharing && is_null($this->caldavBackend)) { - $this->caldavBackend = new CalDAV\Backend\MockSharing($this->caldavCalendars, $this->caldavCalendarObjects); - } - if ($this->setupCalDAVSubscriptions && is_null($this->caldavBackend)) { - $this->caldavBackend = new CalDAV\Backend\MockSubscriptionSupport($this->caldavCalendars, $this->caldavCalendarObjects); - } - if ($this->setupCalDAV && is_null($this->caldavBackend)) { - if ($this->setupCalDAVScheduling) { - $this->caldavBackend = new CalDAV\Backend\MockScheduling($this->caldavCalendars, $this->caldavCalendarObjects); - } else { - $this->caldavBackend = new CalDAV\Backend\Mock($this->caldavCalendars, $this->caldavCalendarObjects); - } - } - if ($this->setupCardDAV && is_null($this->carddavBackend)) { - $this->carddavBackend = new CardDAV\Backend\Mock($this->carddavAddressBooks, $this->carddavCards); - } - if ($this->setupCardDAV || $this->setupCalDAV || $this->setupACL) { - $this->principalBackend = new DAVACL\PrincipalBackend\Mock(); - } - if ($this->setupLocks) { - $this->locksBackend = new DAV\Locks\Backend\Mock(); - } - if ($this->setupPropertyStorage) { - $this->propertyStorageBackend = new DAV\PropertyStorage\Backend\Mock(); - } - } - - public function assertHttpStatus($expectedStatus, HTTP\Request $req) - { - $resp = $this->request($req); - $this->assertEquals((int) $expectedStatus, (int) $resp->getStatus(), 'Incorrect HTTP status received: '.$resp->getStatus()); - } -} diff --git a/vendor/sabre/dav/tests/Sabre/HTTP/ResponseMock.php b/vendor/sabre/dav/tests/Sabre/HTTP/ResponseMock.php deleted file mode 100644 index c5357928a..000000000 --- a/vendor/sabre/dav/tests/Sabre/HTTP/ResponseMock.php +++ /dev/null @@ -1,23 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre\HTTP; - -/** - * HTTP Response Mock object. - * - * This class exists to make the transition to sabre/http easier. - * - * @copyright Copyright (C) fruux GmbH (https://fruux.com/) - * @author Evert Pot (http://evertpot.com/) - * @license http://sabre.io/license/ Modified BSD License - */ -class ResponseMock extends Response -{ - /** - * Making these public. - */ - public $body; - public $status; -} diff --git a/vendor/sabre/dav/tests/Sabre/TestUtil.php b/vendor/sabre/dav/tests/Sabre/TestUtil.php deleted file mode 100644 index 4e7ca2fc4..000000000 --- a/vendor/sabre/dav/tests/Sabre/TestUtil.php +++ /dev/null @@ -1,66 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Sabre; - -class TestUtil -{ - /** - * This function deletes all the contents of the temporary directory. - */ - public static function clearTempDir() - { - self::deleteTree(SABRE_TEMPDIR, false); - } - - private static function deleteTree($path, $deleteRoot = true) - { - foreach (scandir($path) as $node) { - if ('.' == $node || '..' == $node) { - continue; - } - $myPath = $path.'/'.$node; - if (is_file($myPath)) { - unlink($myPath); - } else { - self::deleteTree($myPath); - } - } - if ($deleteRoot) { - rmdir($path); - } - } - - public static function getMySQLDB() - { - try { - $pdo = new \PDO(SABRE_MYSQLDSN, SABRE_MYSQLUSER, SABRE_MYSQLPASS); - $pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); - - return $pdo; - } catch (\PDOException $e) { - return null; - } - } - - public static function getSQLiteDB() - { - $pdo = new \PDO('sqlite:'.SABRE_TEMPDIR.'/pdobackend'); - $pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); - - return $pdo; - } - - public static function getPgSqlDB() - { - //try { - $pdo = new \PDO(SABRE_PGSQLDSN); - $pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); - - return $pdo; - //} catch (\PDOException $e) { - // return null; - //} - } -} diff --git a/vendor/sabre/dav/tests/bootstrap.php b/vendor/sabre/dav/tests/bootstrap.php deleted file mode 100644 index d15805382..000000000 --- a/vendor/sabre/dav/tests/bootstrap.php +++ /dev/null @@ -1,65 +0,0 @@ -<?php - -declare(strict_types=1); - -set_include_path(__DIR__.'/../lib/'.PATH_SEPARATOR.__DIR__.PATH_SEPARATOR.get_include_path()); - -$autoLoader = include __DIR__.'/../vendor/autoload.php'; - -// SabreDAV tests auto loading -$autoLoader->add('Sabre\\', __DIR__); -// VObject tests auto loading -$autoLoader->addPsr4('Sabre\\VObject\\', __DIR__.'/../vendor/sabre/vobject/tests/VObject'); -$autoLoader->addPsr4('Sabre\\Xml\\', __DIR__.'/../vendor/sabre/xml/tests/Sabre/Xml'); - -date_default_timezone_set('UTC'); - -if ('TRUE' === getenv('RUN_TEST_WITH_STREAMING_PROPFIND')) { - echo 'Running unit tests with \Sabre\DAV\Server::$streamMultiStatus = true'; - \Sabre\DAV\Server::$streamMultiStatus = true; -} - -// List of variables that can be set by the environment -$environmentVars = [ - 'SABRE_MYSQLUSER', - 'SABRE_MYSQLPASS', - 'SABRE_MYSQLDSN', - 'SABRE_PGSQLDSN', -]; -foreach ($environmentVars as $var) { - if ($value = getenv($var)) { - define($var, $value); - } -} - -$config = [ - 'SABRE_TEMPDIR' => dirname(__FILE__).'/temp/', - 'SABRE_HASSQLITE' => in_array('sqlite', PDO::getAvailableDrivers()), - 'SABRE_HASMYSQL' => in_array('mysql', PDO::getAvailableDrivers()), - 'SABRE_HASPGSQL' => in_array('pgsql', PDO::getAvailableDrivers()), - 'SABRE_MYSQLDSN' => 'mysql:host=127.0.0.1;dbname=sabredav_test', - 'SABRE_MYSQLUSER' => 'sabredav', - 'SABRE_MYSQLPASS' => '', - 'SABRE_PGSQLDSN' => 'pgsql:host=localhost;dbname=sabredav_test;user=sabredav;password=sabredav', -]; - -if (file_exists(__DIR__.'/config.user.php')) { - $userConfig = []; - include __DIR__.'/config.user.php'; - foreach ($userConfig as $key => $value) { - $config[$key] = $value; - } -} - -foreach ($config as $key => $value) { - if (!defined($key)) { - define($key, $value); - } -} - -if (!file_exists(SABRE_TEMPDIR)) { - mkdir(SABRE_TEMPDIR); -} -if (file_exists('.sabredav')) { - unlink('.sabredav'); -} diff --git a/vendor/sabre/vobject/.gitignore b/vendor/sabre/vobject/.gitignore deleted file mode 100644 index 82b7dad3f..000000000 --- a/vendor/sabre/vobject/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -# Composer stuff -vendor/ -composer.lock -tests/cov/ -tests/temp -tests/.phpunit.result.cache - -# Development stuff -.php_cs.cache diff --git a/vendor/sabre/vobject/.php_cs.dist b/vendor/sabre/vobject/.php_cs.dist deleted file mode 100644 index c5c78a971..000000000 --- a/vendor/sabre/vobject/.php_cs.dist +++ /dev/null @@ -1,12 +0,0 @@ -<?php - -$config = PhpCsFixer\Config::create(); -$config->getFinder() - ->exclude('vendor') - ->in(__DIR__); -$config->setRules([ - '@PSR1' => true, - '@Symfony' => true -]); - -return $config;
\ No newline at end of file diff --git a/vendor/sabre/vobject/.travis.yml b/vendor/sabre/vobject/.travis.yml deleted file mode 100644 index 4f50e97fd..000000000 --- a/vendor/sabre/vobject/.travis.yml +++ /dev/null @@ -1,49 +0,0 @@ -language: php -php: - - 7.1 - - 7.2 - - 7.3 - - 7.4 - -env: - global: - - MEMCACHED_SERVER=127.0.0.1 - - RUN_PHPCSFIXER="TRUE" - - RUN_PHPUNIT="TRUE" - - RUN_PHPSTAN="FALSE" - matrix: - - PREFER_LOWEST="" REPORT_COVERAGE="TRUE" WITH_COVERAGE="--coverage-clover=coverage.xml" - - PREFER_LOWEST="--prefer-lowest" REPORT_COVERAGE="FALSE" WITH_COVERAGE="" - -matrix: - include: - - name: 'PHP8' - dist: focal - php: nightly - env: - - RUN_PHPCSFIXER="FALSE" - - REPORT_COVERAGE="FALSE" - - name: 'PHPStan' - php: 7.4 - env: - - RUN_PHPCSFIXER="FALSE" - - RUN_PHPUNIT="FALSE" - - RUN_PHPSTAN="TRUE" - - REPORT_COVERAGE="FALSE" - fast_finish: true - -before_script: - - if [ $RUN_PHPCSFIXER == "FALSE" ]; then composer remove --no-update --dev friendsofphp/php-cs-fixer; fi - - composer update $PREFER_LOWEST - -script: - - if [ $RUN_PHPCSFIXER == "TRUE" ]; then php vendor/bin/php-cs-fixer fix --dry-run --diff; fi - - if [ $RUN_PHPUNIT == "TRUE" ]; then php vendor/bin/phpunit --configuration tests/phpunit.xml $WITH_COVERAGE; fi - - if [ $RUN_PHPSTAN == "TRUE" ]; then composer phpstan; fi - -after_success: - - if [ $REPORT_COVERAGE == "TRUE" ]; then bash <(curl -s https://codecov.io/bash); fi - -cache: - directories: - - $HOME/.composer/cache diff --git a/vendor/sabre/vobject/CHANGELOG.md b/vendor/sabre/vobject/CHANGELOG.md deleted file mode 100644 index 7d6b096fd..000000000 --- a/vendor/sabre/vobject/CHANGELOG.md +++ /dev/null @@ -1,868 +0,0 @@ -ChangeLog -========= - -4.3.3 (2020-11-09) ------------------- - -* #519: Remove US/Pacific-New obsolete timezone (@phil-davis) - -4.3.2 (2020-10-03) ------------------- - -* #513: Added Support for PHP 8.0 (@phil-davis) - -4.3.1 (2020-07-13) ------------------- - -* #510: Fix an incomplete phpdoc type annotation (@mstilkerich) -* #505: Refactor unit test code for phpunit9 (@phil-davis) -* #500: Standardize CI (@phil-davis) -* #496: CI tooling changes (@JeroenVanOort) - -4.3.0 (2020-01-31) ------------------- - -* Added support for PHP 7.4, dropped support for PHP 7.0 (@phil-davis) -* #487: Added phpstan coverage, updated testsuite for phpunit8 (@phil-davis, @JeroenVanOort) -* #495: refactored maps to use ::class notation (@JeroenVanOort) - -4.2.2 (2020-01-14) ------------------- - -* #465: Add TZ in iTip REPLY iTip messages -* #486: Add PHONE-NUMBER value type (used for TEL in vCard 3.0) - -4.2.1 (2019-12-18) ------------------- - -* #469, #451: fix compat with php 7.4 -* #443: prevent running in indefinte loop -* #449: Preventing creating a component for a root document -* #450: Fix parse with option Forgiving with trailing equal -* #459: fixed typo in VCalendar which resulting in usage of the wrong TimeZone -* #462: Broker::parseEventForOrganizer copies DTSTAMP from $eventInfo that causes broken scheduling - -4.2.0 (2019-02-19) ------------------- - -* #432: DTSTAMP must be specified in UTC -* #435: ORGANIZER e-mail address are case-insensitive -* #441: Repairing BASE64 encoded vCard version 3 - -4.2.0-alpha1 (2018-09-26) -------------------------- - -* #412: Broker: add timezone to CANCEL messages -* #424: Support php7.3 - -4.1.6 (2018-04-20) ------------------- - -* #406, #407, #408, #409: Another round of performance improvements in serialization of properties (@gharlan, @staabm) -* #410: Fixes in iTip for handling `BYDAY=SA,SO` (@gharlan) -* #381: Fixes in iTip handling of `SCHEDULE-FORCE-SEND` (@alecpl) - -4.1.5 (2018-03-08) ------------------- - -* #404: Serialization: Performance boost for long properties (@gharlan) - -4.1.4 (2017-12-22) ------------------- - -* #383: Fix possible infinite loop in RRuleIterator, when the RRule FREQ - is YEARLY and it uses BYYEARDAY only (@mvdnes). -* #392: Improved significant change detection. This should reduce the number of - unneeded update emails in scheduling systems. (@alecpl). -* #395: Removed `Canada/East-Saskatchewan` timezone, as it got removed - from PHP as well. (@remicollet). - - -4.1.3 (2017-10-18) ------------------- - -* #363: Repair script and de-duplicate properties that are only allowed once, - but appear more than once. (@ddolcimascolo). -* #377: Added Pacific Time (US & Canada) as exchange timezone -* #384: Added fallback for VCards without `FN` - - -4.1.2 (2016-12-15) ------------------- - -* #340: Support for `BYYEARDAY` recurrence when `FREQ=YEARLY`. (@PHPGangsta) -* #341: Support for `BYWEEKNO` recurrence when `FREQ=YEARLY`. (@PHPGangsta) -* Updated to the latest windows timezone data mappings. -* #344: Auto-detecting more Outlook 365-generated timezone identifiers. - (@jpirkey) -* #348: `FreeBusyGenerator` can now accept streams. -* Support sabre/xml 1.5 and 2.0. -* #355: Support `DateTimeInterface` in more places where only `DateTime` was - supported. (@gharlan). -* #351: Fixing an inclusive/exclusive problem with `isInTimeRange` and - `fastForward` with all-day events. (@strokyl, thanks you are brilliant). - - -4.1.1 (2016-07-15) ------------------- - -* #327: Throwing `InvalidDataException` in more cases where invalid iCalendar - dates and times were provided. (@rsto) -* #331: Fix dealing with multiple overridden instances falling on the same - date/time (@afedyk-sugarcrm). -* #333: Fix endless loop on invalid `BYMONTH` values in recurrence. - (@PHPGangsta) -* #339: Fixed a few `validate()` results when repair is off. (@PHPGangsta) -* #338: Stripping invalid `BYMONTH=` rules during `validate()` (@PHPGangsta) -* #336: Fix incorrect `BYSECOND=` validation. (@PHPGangsta) - - -4.1.0 (2016-04-06) ------------------- - -* #309: When expanding recurring events, the first event should also have a - `RECURRENCE-ID` property. -* #306: iTip REPLYs to the first instance of a recurring event was not handled - correctly. -* Slightly better error message during validation of `N` and `ADR` properties. -* #312: Correctly extracing timezone in the iTip broker, even when we don't - have a master event. (@vkomrakov-sugar). -* When validating a component's property that must appear once and which could - automatically be repaired, make sure we report the change as 'repaired'. -* Added a PHPUnitAssertions trait. This trait makes it easy to compare two - vcards or iCalendar objects semantically. -* Better error message when parsing objects with an invalid `VALUE` parameter. - - -4.0.3 (2016-03-12) ------------------- - -* #300: Added `VCard::getByType()` to quickly get a property with a specific - `TYPE` parameter. (@kbond) -* #302: `UNTIL` was not encoded correctly when converting to jCal. - (@GrahamLinagora) -* #303: `COUNT` is now encoded as an int in jCal instead of a string. (@strokyl) -* #295: `RRULE` now has more validation and repair rules. - - -4.0.2 (2016-01-11) ------------------- - -* #288: Only decode `CHARSET` if we're reading vCard 2.1. If it appears - in any other document, we must ignore it. - - -4.0.1 (2016-01-04) ------------------- - -* #284: When generating `CANCEL` iTip messages, we now include `DTEND`. - (@kewisch) - - -4.0.0 (2015-12-11) ------------------- - -* #274: When creating new vCards, the default vCard version is now 4.0. -* #275: `VEVENT`, `VTODO` and `VCARD` now automatically get a `UID` and - `DTSTAMP` property if this was not already specified. -* `ParseException` now extends `\Exception`. -* `Sabre\VObject\Reader::read` now has a `$charset` argument. -* #272: `Sabre\VObject\Recur\EventIterator::$maxInstances` is now - `Sabre\VObject\Settings::$maxRecurrences` and is also honored by the - FreeBusyGenerator. -* #278: `expand()` did not work correctly on events with sub-components. - - -4.0.0-beta1 (2015-12-02) ------------------------- - -* #258: Support for expanding events that use `RDATE`. (@jabdoa2) -* #258: Correctly support TZID for events that use `RDATE`. (@jabdoa2) -* #240: `Component\VCalendar::expand()` now returns a new expanded `VCalendar` - object, instead of editing the existing `VCalendar` in-place. This is a BC - break. -* #265: Using the new `InvalidDataException` in place of - `InvalidArgumentException` and `LogicException` in all places where we fail - because there was something wrong with input data. -* #227: Always add `VALUE=URI` to `PHOTO` properties. -* #235: Always add `VALUE=URI` to `URL` properties. -* It's now possible to override which class is used instead of - `Component\VCalendar` or `Component\VCard` during parsing. -* #263: Lots of small cleanups. (@jakobsack) -* #220: Automatically stop recurring after 3500 recurrences. -* #41: Allow user to set different encoding than UTF-8 when decoding vCards. -* #41: Support the `ENCODING` parameter from vCard 2.1. - Both ISO-8859-1 and Windows-1252 are currently supported. -* #185: Fix encoding/decoding of `TIME` values in jCal/jCard. - - -4.0.0-alpha2 (2015-09-04) -------------------------- - -* Updated windows timezone file to support new mexican timezone. -* #239: Added a `BirthdayCalendarGenerator`. (@DominikTo) -* #250: `isInTimeRange()` now considers the timezone for floating dates and - times. (@armin-hackmann) -* Added a duplicate vcard merging tool for the command line. -* #253: `isInTimeRange()` now correctly handles events that throw the - `NoInstancesException` exception. (@migrax, @DominikTo) -* #254: The parser threw an `E_NOTICE` for certain invalid objects. It now - correctly throws a `ParseException`. - - -4.0.0-alpha1 (2015-07-17) -------------------------- - -* sabre/vobject now requires PHP 5.5. -* #244: PHP7 support. -* Lots of speedups and reduced memory usage! -* #160: Support for xCal a.k.a. RFC6321! (@Hywan) -* #192: Support for xCard a.k.a. RFC6351! (@Hywan) -* #139: We now accept `DateTimeInterface` wherever it accepted `DateTime` - before in arguments. This means that either `DateTime` or - `DateTimeImmutable` may be used everywhere. -* #242: Full support for the `VAVAILABILITY` component, and calculating - `VFREEBUSY` based on `VAVAILABILITY` data. -* #186: Fixing conversion of `UTC-OFFSET` properties when going back and - forward between jCal and iCalendar. -* Properties, Components and Parameters now implement PHP's `JsonSerializable` - interface. -* #139: We now _always_ return `DateTimeImmutable` from any method. This could - potentially have big implications if you manipulate Date objects anywhere. -* #161: Simplified `ElementList` by extending `ArrayIterator`. -* Removed `RecurrenceIterator` (use Recur\EventIterator instead). -* Now using php-cs-fixer to automatically enforce and correct CS. -* #233: The `+00:00` timezone is now recognized as UTC. (@c960657) -* #237: Added a `destroy()` method to all documents. This method breaks any - circular references, allowing PHP to free up memory. -* #197: Made accessing properties and objects by their name a lot faster. This - especially helps objects that have a lot of sub-components or properties, - such as large iCalendar objects. -* #197: The `$children` property on components has been changed from `public` - to `protected`. Use the `children()` method instead to get a flat list of - objects. -* #244: The `Float` and `Integer` classes have been renamed to `FloatValue` - and `IntegerValue` to allow PHP 7 compatibility. - - -3.5.3 (2016-10-06) ------------------- - -* #331: Fix dealing with multiple overridden instances falling on the same - date/time (@afedyk-sugarcrm). - - -3.5.2 (2016-04-24) ------------------ - -* #312: Backported a fix related to iTip processing of events with timezones, - without a master event. - - -3.5.1 (2016-04-06) ------------------- - -* #309: When expanding recurring events, the first event should also have a - `RECURRENCE-ID` property. -* #306: iTip REPLYs to the first instance of a recurring event was not handled - correctly. - - -3.5.0 (2016-01-11) ------------------- - -* This release supports PHP 7, contrary to 3.4.x versions. -* BC Break: `Sabre\VObject\Property\Float` has been renamed to - `Sabre\VObject\Property\FloatValue`. -* BC Break: `Sabre\VObject\Property\Integer` has been renamed to - `Sabre\VObject\Property\IntegerValue`. - - -3.4.9 (2016-01-11) ------------------- - -* This package now specifies in composer.json that it does not support PHP 7. - For PHP 7, use version 3.5.x or 4.x. - - -3.4.8 (2016-01-04) ------------------- - -* #284: When generating `CANCEL` iTip messages, we now include `DTEND`. - (@kewisch). - - -3.4.7 (2015-09-05) ------------------- - -* #253: Handle `isInTimeRange` for recurring events that have 0 valid - instances. (@DominikTo, @migrax). - - -3.4.6 (2015-08-06) ------------------- - -* #250: Recurring all-day events are incorrectly included in time range - requests when not using UTC in the time range. (@armin-hackmann) - - -3.4.5 (2015-06-02) ------------------- - -* #229: Converting vcards from 3.0 to 4.0 that contained a `LANG` property - would throw an error. - - -3.4.4 (2015-05-27) ------------------- - -* #228: Fixed a 'party crasher' bug in the iTip broker. This would break - scheduling in some cases. - - -3.4.3 (2015-05-19) ------------------- - -* #219: Corrected validation of `EXDATE` properties with more than one value. -* #212: `BYSETPOS` with values below `-1` was broken and could cause infinite - loops. -* #211: Fix `BYDAY=-5TH` in recurrence iterator. (@lindquist) -* #216: `ENCODING` parameter is now validated for all document types. -* #217: Initializing vCard `DATE` objects with a PHP DateTime object will now - work correctly. (@thomascube) - - -3.4.2 (2015-02-25) ------------------- - -* #210: iTip: Replying to an event without a master event was broken. - - -3.4.1 (2015-02-24) ------------------- - -* A minor change to ensure that unittests work correctly in the sabre/dav - test-suite. - - -3.4.0 (2015-02-23) ------------------- - -* #196: Made parsing recurrence rules a lot faster on big calendars. -* Updated windows timezone mappings to latest unicode version. -* #202: Support for parsing and validating `VAVAILABILITY` components. (@Hywan) -* #195: PHP 5.3 compatibility in 'generatevcards' script. (@rickdenhaan) -* #205: Improving handling of multiple `EXDATE` when processing iTip changes. - (@armin-hackmann) -* #187: Fixed validator rules for `LAST-MODIFIED` properties. -* #188: Retain floating times when generating instances using - `Recur\EventIterator`. -* #203: Skip tests for timezones that are not supported on older PHP versions, - instead of a hard fail. -* #204: Dealing a bit better with vCard date-time values that contained - milliseconds. (which is normally invalid). (@armin-hackmann) - - -3.3.5 (2015-01-09) ------------------- - -* #168: Expanding calendars now removes objects with recurrence rules that - don't have a valid recurrence instance. -* #177: SCHEDULE-STATUS should not contain a reason phrase, only a status - code. -* #175: Parser can now read and skip the UTF-8 BOM. -* #179: Added `isFloating` to `DATE-TIME` properties. -* #179: Fixed jCal serialization of floating `DATE-TIME` properties. -* #173: vCard converter failed for `X-ABDATE` properties that had no - `X-ABLABEL`. -* #180: Added `PROFILE_CALDAV` and `PROFILE_CARDDAV` to enable validation rules - specific for CalDAV/CardDAV servers. -* #176: A missing `UID` is no longer an error, but a warning for the vCard - validator, unless `PROFILE_CARDDAV` is specified. - - -3.3.4 (2014-11-19) ------------------- - -* #154: Converting `ANNIVERSARY` to `X-ANNIVERSARY` and `X-ABDATE` and - vice-versa when converting to/from vCard 4. -* #154: It's now possible to easily select all vCard properties belonging to - a single group with `$vcard->{'ITEM1.'}` syntax. (@armin-hackmann) -* #156: Simpler way to check if a string is UTF-8. (@Hywan) -* Unittest improvements. -* #159: The recurrence iterator, freebusy generator and iCalendar DATE and - DATE-TIME properties can now all accept a reference timezone when working - floating times or all-day events. -* #159: Master events will no longer get a `RECURRENCE-ID` when expanding. -* #159: `RECURRENCE-ID` for all-day events will now be correct when expanding. -* #163: Added a `getTimeZone()` method to `VTIMEZONE` components. - - -3.3.3 (2014-10-09) ------------------- - -* #142: `CANCEL` and `REPLY` messages now include the `DTSTART` from the - original event. -* #143: `SCHEDULE-AGENT` on the `ORGANIZER` property is respected. -* #144: `PARTSTAT=NEEDS-ACTION` is now set for new invites, if no `PARTSTAT` is - set to support the inbox feature of iOS. -* #147: Bugs related to scheduling all-day events. -* #148: Ignore events that have attendees but no organizer. -* #149: Avoiding logging errors during timezone detection. This is a workaround - for a PHP bug. -* Support for "Line Islands Standard Time" windows timezone. -* #154: Correctly work around vCard parameters that have a value but no name. - - -3.3.2 (2014-09-19) ------------------- - -* Changed: iTip broker now sets RSVP status to false when replies are received. -* #118: iTip Message now has a `getScheduleStatus()` method. -* #119: Support for detecting 'significant changes'. -* #120: Support for `SCHEDULE-FORCE-SEND`. -* #121: iCal demands parameters containing the + sign to be quoted. -* #122: Don't generate REPLY messages for events that have been cancelled. -* #123: Added `SUMMARY` to iTip messages. -* #130: Incorrect validation rules for `RELATED` (should be `RELATED-TO`). -* #128: `ATTACH` in iCalendar is `URI` by default, not `BINARY`. -* #131: RRULE that doesn't provide a single valid instance now throws an - exception. -* #136: Validator rejects *all* control characters. We were missing a few. -* #133: Splitter objects will throw exceptions when receiving incompatible - objects. -* #127: Attendees who delete recurring event instances events they had already - declined earlier will no longer generate another reply. -* #125: Send CANCEL messages when ORGANIZER property gets deleted. - - -3.3.1 (2014-08-18) ------------------- - -* Changed: It's now possible to pass DateTime objects when using the magic - setters on properties. (`$event->DTSTART = new DateTime('now')`). -* #111: iTip Broker does not process attendee adding events to EXDATE. -* #112: EventIterator now sets TZID on RECURRENCE-ID. -* #113: Timezone support during creation of iTip REPLY messages. -* #114: VTIMEZONE is retained when generating new REQUEST objects. -* #114: Support for 'MAILTO:' style email addresses (in uppercase) in the iTip - broker. This improves evolution support. -* #115: Using REQUEST-STATUS from REPLY messages and now propegating that into - SCHEDULE-STATUS. - - -3.3.0 (2014-08-07) ------------------- - -* We now use PSR-4 for the directory structure. This means that everything - that was used to be in the `lib/Sabre/VObject` directory is now moved to - `lib/`. If you use composer to load this library, you shouldn't have to do - anything about that though. -* VEVENT now get populated with a DTSTAMP and UID property by default. -* BC Break: Removed the 'includes.php' file. Use composer instead. -* #103: Added support for processing [iTip][iTip] messages. This allows a user - to parse incoming iTip messages and apply the result on existing calendars, - or automatically generate invites/replies/cancellations based on changes that - a user made on objects. -* #75, #58, #18: Fixes related to overriding the first event in recurrences. -* Added: VCalendar::getBaseComponent to find the 'master' component in a - calendar. -* #51: Support for iterating RDATE properties. -* Fixed: Issue #101: RecurrenceIterator::nextMonthly() shows events that are - excluded events with wrong time - - -3.2.4 (2014-07-14) ------------------- - -* Added: Issue #98. The VCardConverter now takes `X-APPLE-OMIT-YEAR` into - consideration when converting between vCard 3 and 4. -* Fixed: Issue #96. Some support for Yahoo's broken vcards. -* Fixed: PHP 5.3 support was broken in the cli tool. - - -3.2.3 (2014-06-12) ------------------- - -* Validator now checks if DUE and DTSTART are of the same type in VTODO, and - ensures that DUE is always after DTSTART. -* Removed documentation from source repository, to http://sabre.io/vobject/ -* Expanded the vobject cli tool validation output to make it easier to find - issues. -* Fixed: vobject repair. It was not working for iCalendar objects. - - -3.2.2 (2014-05-07) ------------------- - -* Minor tweak in unittests to make it run on PHP 5.5.12. Json-prettifying - slightly changed which caused the test to fail. - - -3.2.1 (2014-05-03) ------------------- - -* Minor tweak to make the unittests run with the latest hhvm on travis. -* Updated timezone definitions. -* Updated copyright links to point to http://sabre.io/ - - -3.2.0 (2014-04-02) ------------------- - -* Now hhvm compatible! -* The validator can now detect a _lot_ more problems. Many rules for both - iCalendar and vCard were added. -* Added: bin/generate_vcards, a utility to generate random vcards for testing - purposes. Patches are welcome to add more data. -* Updated: Windows timezone mapping to latest version from unicode.org -* Changed: The timezone maps are now loaded in from external files, in - lib/Sabre/VObject/timezonedata. -* Added: Fixing badly encoded URL's from google contacts vcards. -* Fixed: Issue #68. Couldn't decode properties ending in a colon. -* Fixed: Issue #72. RecurrenceIterator should respect timezone in the UNTIL - clause. -* Fixed: Issue #67. BYMONTH limit on DAILY recurrences. -* Fixed: Issue #26. Return a more descriptive error when coming across broken - BYDAY rules. -* Fixed: Issue #28. Incorrect timezone detection for some timezones. -* Fixed: Issue #70. Casting a parameter with a null value to string would fail. -* Added: Support for rfc6715 and rfc6474. -* Added: Support for DateTime objects in the VCard DATE-AND-OR-TIME property. -* Added: UUIDUtil, for easily creating unique identifiers. -* Fixed: Issue #83. Creating new VALUE=DATE objects using php's DateTime. -* Fixed: Issue #86. Don't go into an infinite loop when php errors are - disabled and an invalid file is read. - - -3.1.4 (2014-03-30) ------------------- - -* Fixed: Issue #87: Several compatibility fixes related to timezone handling - changes in PHP 5.5.10. - - -3.1.3 (2013-10-02) ------------------- - -* Fixed: Support from properties from draft-daboo-valarm-extensions-04. Issue - #56. -* Fixed: Issue #54. Parsing a stream of multiple vcards separated by more than - one newline. Thanks @Vedmak for the patch. -* Fixed: Serializing vcard 2.1 parameters with no name caused a literal '1' to - be inserted. -* Added: VCardConverter removed properties that are no longer supported in vCard - 4.0. -* Added: vCards with a minimum number of values (such as N), but don't have that - many, are now automatically padded with empty components. -* Added: The vCard validator now also checks for a minimum number of components, - and has the ability to repair these. -* Added: Some support for vCard 2.1 in the VCard converter, to upgrade to vCard - 3.0 or 4.0. -* Fixed: Issue 60 Use Document::$componentMap when instantiating the top-level - VCalendar and VCard components. -* Fixed: Issue 62: Parsing iCalendar parameters with no value. -* Added: --forgiving option to vobject utility. -* Fixed: Compound properties such as ADR were not correctly split up in vCard - 2.1 quoted printable-encoded properties. -* Fixed: Issue 64: Encoding of binary properties of converted vCards. Thanks - @DominikTo for the patch. - - -3.1.2 (2013-08-13) ------------------- - -* Fixed: Setting correct property group on VCard conversion - - -3.1.1 (2013-08-02) ------------------- - -* Fixed: Issue #53. A regression in RecurrenceIterator. - - -3.1.0 (2013-07-27) ------------------- - -* Added: bad-ass new cli debugging utility (in bin/vobject). -* Added: jCal and jCard parser. -* Fixed: URI properties should not escape ; and ,. -* Fixed: VCard 4 documents now correctly use URI as a default value-type for - PHOTO and others. BINARY no longer exists in vCard 4. -* Added: Utility to convert between 2.1, 3.0 and 4.0 vCards. -* Added: You can now add() multiple parameters to a property in one call. -* Added: Parameter::has() for easily checking if a parameter value exists. -* Added: VCard::preferred() to find a preferred email, phone number, etc for a - contact. -* Changed: All $duration properties are now public. -* Added: A few validators for iCalendar documents. -* Fixed: Issue #50. RecurrenceIterator gives incorrect result when exception - events are out of order in the iCalendar file. -* Fixed: Issue #48. Overridden events in the recurrence iterator that were past - the UNTIL date were ignored. -* Added: getDuration for DURATION values such as TRIGGER. Thanks to - @SimonSimCity. -* Fixed: Issue #52. vCard 2.1 parameters with no name may lose values if there's - more than 1. Thanks to @Vedmak. - - -3.0.0 (2013-06-21) ------------------- - -* Fixed: includes.php file was still broken. Our tool to generate it had some - bugs. - - -3.0.0-beta4 (2013-06-21) ------------------------- - -* Fixed: includes.php was no longer up to date. - - -3.0.0-beta3 (2013-06-17) ------------------------- - -* Added: OPTION_FORGIVING now also allows slashes in property names. -* Fixed: DateTimeParser no longer fails on dates with years < 1000 & > 4999 -* Fixed: Issue 36: Workaround for the recurrenceiterator and caldav events with - a missing base event. -* Fixed: jCard encoding of TIME properties. -* Fixed: jCal encoding of REQUEST-STATUS, GEO and PERIOD values. - - -3.0.0-beta2 (2013-06-10) ------------------------- - -* Fixed: Corrected includes.php file. -* Fixed: vCard date-time parser supported extended-format dates as well. -* Changed: Properties have been moved to an ICalendar or VCard directory. -* Fixed: Couldn't parse vCard 3 extended format dates and times. -* Fixed: Couldn't export jCard DATE values correctly. -* Fixed: Recursive loop in ICalendar\DateTime property. - - -3.0.0-beta1 (2013-06-07) ------------------------- - -* Added: jsonSerialize() for creating jCal and jCard documents. -* Added: helper method to parse vCard dates and times. -* Added: Specialized classes for FLOAT, LANGUAGE-TAG, TIME, TIMESTAMP, - DATE-AND-OR-TIME, CAL-ADDRESS, UNKNOWN and UTC-OFFSET properties. -* Removed: CommaSeparatedText property. Now included into Text. -* Fixed: Multiple parameters with the same name are now correctly encoded. -* Fixed: Parameter values containing a comma are now enclosed in double-quotes. -* Fixed: Iterating parameter values should now fully work as expected. -* Fixed: Support for vCard 2.1 nameless parameters. -* Changed: $valueMap, $componentMap and $propertyMap now all use fully-qualified - class names, so they are actually overridable. -* Fixed: Updating DATE-TIME to DATE values now behaves like expected. - - -3.0.0-alpha4 (2013-05-31) -------------------------- - -* Added: It's now possible to send parser options to the splitter classes. -* Added: A few tweaks to improve component and property creation. - - -3.0.0-alpha3 (2013-05-13) -------------------------- - -* Changed: propertyMap, valueMap and componentMap are now static properties. -* Changed: Component::remove() will throw an exception when trying to a node - that's not a child of said component. -* Added: Splitter objects are now faster, line numbers are accurately reported - and use less memory. -* Added: MimeDir parser can now continue parsing with the same stream buffer. -* Fixed: vobjectvalidate.php is operational again. -* Fixed: \r is properly stripped in text values. -* Fixed: QUOTED-PRINTABLE is now correctly encoded as well as encoded, for - vCards 2.1. -* Fixed: Parser assumes vCard 2.1, if no version was supplied. - - -3.0.0-alpha2 (2013-05-22) -------------------------- - -* Fixed: vCard URL properties were referencing a non-existant class. - - -3.0.0-alpha1 (2013-05-21) -------------------------- - -* Fixed: Now correctly dealing with escaping of properties. This solves the - problem with double-backslashes where they don't belong. -* Added: Easy support for properties with more than one value, using setParts - and getParts. -* Added: Support for broken 2.1 vCards produced by microsoft. -* Added: Automatically decoding quoted-printable values. -* Added: Automatically decoding base64 values. -* Added: Decoding RFC6868 parameter values (uses ^ as an escape character). -* Added: Fancy new MimeDir parser that can also parse streams. -* Added: Automatically mapping many, many properties to a property-class with - specialized API's. -* Added: remove() method for easily removing properties and sub-components - components. -* Changed: Components, Properties and Parameters can no longer be created with - Component::create, Property::create and Parameter::create. They must instead - be created through the root component. (A VCalendar or VCard object). -* Changed: API for DateTime properties has slightly changed. -* Changed: the ->value property is now protected everywhere. Use getParts() and - getValue() instead. -* BC Break: No support for mac newlines (\r). Never came across these anyway. -* Added: add() method to the Property class. -* Added: It's now possible to easy set multi-value properties as arrays. -* Added: When setting date-time properties you can just pass PHP's DateTime - object. -* Added: New components automatically get a bunch of default properties, such as - VERSION and CALSCALE. -* Added: You can add new sub-components much quicker with the magic setters, and - add() method. - - -2.1.7 (2015-01-21) ------------------- - -* Fixed: Issue #94, a workaround for bad escaping of ; and , in compound - properties. It's not a full solution, but it's an improvement for those - stuck in the 2.1 versions. - - -2.1.6 (2014-12-10) ------------------- - -* Fixed: Minor change to make sure that unittests succeed on every PHP version. - - -2.1.5 (2014-06-03) ------------------- - -* Fixed: #94: Better parameter escaping. -* Changed: Documentation cleanups. - - -2.1.4 (2014-03-30) ------------------- - -* Fixed: Issue #87: Several compatibility fixes related to timezone handling - changes in PHP 5.5.10. - - -2.1.3 (2013-10-02) ------------------- - -* Fixed: Issue #55. \r must be stripped from property values. -* Fixed: Issue #65. Putting quotes around parameter values that contain a colon. - - -2.1.2 (2013-08-02) ------------------- - -* Fixed: Issue #53. A regression in RecurrenceIterator. - - -2.1.1 (2013-07-27) ------------------- - -* Fixed: Issue #50. RecurrenceIterator gives incorrect result when exception - events are out of order in the iCalendar file. -* Fixed: Issue #48. Overridden events in the recurrence iterator that were past - the UNTIL date were ignored. - - -2.1.0 (2013-06-17) ------------------- - -* This version is fully backwards compatible with 2.0.\*. However, it contains a - few new API's that mimic the VObject 3 API. This allows it to be used a - 'bridge' version. Specifically, this new version exists so SabreDAV 1.7 and - 1.8 can run with both the 2 and 3 versions of this library. -* Added: Property\DateTime::hasTime(). -* Added: Property\MultiDateTime::hasTime(). -* Added: Property::getValue(). -* Added: Document class. -* Added: Document::createComponent and Document::createProperty. -* Added: Parameter::getValue(). - - -2.0.7 (2013-03-05) ------------------- - -* Fixed: Microsoft re-uses their magic numbers for different timezones, - specifically id 2 for both Sarajevo and Lisbon). A workaround was added to - deal with this. - - -2.0.6 (2013-02-17) ------------------- - -* Fixed: The reader now properly parses parameters without a value. - - -2.0.5 (2012-11-05) ------------------- - -* Fixed: The FreeBusyGenerator is now properly using the factory methods for - creation of components and properties. - - -2.0.4 (2012-11-02) ------------------- - -* Added: Known Lotus Notes / Domino timezone id's. - - -2.0.3 (2012-10-29) ------------------- - -* Added: Support for 'GMT+????' format in TZID's. -* Added: Support for formats like SystemV/EST5EDT in TZID's. -* Fixed: RecurrenceIterator now repairs recurrence rules where UNTIL < DTSTART. -* Added: Support for BYHOUR in FREQ=DAILY (@hollodk). -* Added: Support for BYHOUR and BYDAY in FREQ=WEEKLY. - - -2.0.2 (2012-10-06) ------------------- - -* Added: includes.php file, to load the entire library in one go. -* Fixed: A problem with determining alarm triggers for TODO's. - - -2.0.1 (2012-09-22) ------------------- - -* Removed: Element class. It wasn't used. -* Added: Basic validation and repair methods for broken input data. -* Fixed: RecurrenceIterator could infinitely loop when an INTERVAL of 0 was - specified. -* Added: A cli script that can validate and automatically repair vcards and - iCalendar objects. -* Added: A new 'Compound' property, that can automatically split up parts for - properties such as N, ADR, ORG and CATEGORIES. -* Added: Splitter classes, that can split up large objects (such as exports) - into individual objects (thanks @DominikTo and @armin-hackmann). -* Added: VFREEBUSY component, which allows easily checking wether timeslots are - available. -* Added: The Reader class now has a 'FORGIVING' option, which allows it to parse - properties with incorrect characters in the name (at this time, it just allows - underscores). -* Added: Also added the 'IGNORE_INVALID_LINES' option, to completely disregard - any invalid lines. -* Fixed: A bug in Windows timezone-id mappings for times created in Greenlands - timezone (sorry Greenlanders! I do care!). -* Fixed: DTEND was not generated correctly for VFREEBUSY reports. -* Fixed: Parser is at least 25% faster with real-world data. - - -2.0.0 (2012-08-08) ------------------- - -* VObject is now a separate project from SabreDAV. See the SabreDAV changelog - for version information before 2.0. -* New: VObject library now uses PHP 5.3 namespaces. -* New: It's possible to specify lists of parameters when constructing - properties. -* New: made it easier to construct the FreeBusyGenerator. - -[iTip]: http://tools.ietf.org/html/rfc5546 diff --git a/vendor/sabre/vobject/bin/bench.php b/vendor/sabre/vobject/bin/bench.php index 0a2736fa6..0a2736fa6 100644..100755 --- a/vendor/sabre/vobject/bin/bench.php +++ b/vendor/sabre/vobject/bin/bench.php diff --git a/vendor/sabre/vobject/bin/bench_freebusygenerator.php b/vendor/sabre/vobject/bin/bench_freebusygenerator.php index 1299c14fb..963623d18 100644 --- a/vendor/sabre/vobject/bin/bench_freebusygenerator.php +++ b/vendor/sabre/vobject/bin/bench_freebusygenerator.php @@ -11,7 +11,7 @@ if ($argc < 2) { echo "The process will be repeated 100 times to get accurate stats\n"; echo "\n"; echo 'Usage: '.$argv[0]." inputfile.ics\n"; - die(); + exit(); } list(, $inputFile) = $argv; diff --git a/vendor/sabre/vobject/bin/bench_manipulatevcard.php b/vendor/sabre/vobject/bin/bench_manipulatevcard.php index f229091db..df6d9f23d 100644 --- a/vendor/sabre/vobject/bin/bench_manipulatevcard.php +++ b/vendor/sabre/vobject/bin/bench_manipulatevcard.php @@ -10,7 +10,7 @@ if ($argc < 2) { echo 'system.'; echo "\n"; echo 'Usage: '.$argv[0]." inputfile.vcf\n"; - die(); + exit(); } list(, $inputFile) = $argv; diff --git a/vendor/sabre/vobject/bin/fetch_windows_zones.php b/vendor/sabre/vobject/bin/fetch_windows_zones.php index 9c4e51abd..2361dc309 100644..100755 --- a/vendor/sabre/vobject/bin/fetch_windows_zones.php +++ b/vendor/sabre/vobject/bin/fetch_windows_zones.php @@ -1,13 +1,12 @@ #!/usr/bin/env php <?php -$windowsZonesUrl = 'http://unicode.org/repos/cldr/trunk/common/supplemental/windowsZones.xml'; +$windowsZonesUrl = 'https://raw.githubusercontent.com/unicode-org/cldr/master/common/supplemental/windowsZones.xml'; $outputFile = __DIR__.'/../lib/timezonedata/windowszones.php'; echo 'Fetching timezone map from: '.$windowsZonesUrl, "\n"; $data = file_get_contents($windowsZonesUrl); - $xml = simplexml_load_string($data); $map = []; @@ -44,6 +43,6 @@ fclose($f); echo "Formatting\n"; -exec(__DIR__.'/sabre-cs-fixer fix '.escapeshellarg($outputFile)); +exec(__DIR__.'/../vendor/bin/php-cs-fixer fix '.escapeshellarg($outputFile)); echo "Done\n"; diff --git a/vendor/sabre/vobject/bin/generateicalendardata.php b/vendor/sabre/vobject/bin/generateicalendardata.php index 62b6107c5..019ed9745 100644..100755 --- a/vendor/sabre/vobject/bin/generateicalendardata.php +++ b/vendor/sabre/vobject/bin/generateicalendardata.php @@ -18,7 +18,7 @@ The iCalendar output goes to stdout. Other messages to stderr. HI ); - die(); + exit(); } $events = 100; @@ -77,7 +77,7 @@ $result = $calendar->validate(); if ($result) { fwrite(STDERR, "Errors!\n"); fwrite(STDERR, print_r($result, true)); - die(-1); + exit(-1); } fwrite(STDERR, "Serializing this beast\n"); diff --git a/vendor/sabre/vobject/bin/mergeduplicates.php b/vendor/sabre/vobject/bin/mergeduplicates.php index e6cde73dd..31b2c14ab 100644..100755 --- a/vendor/sabre/vobject/bin/mergeduplicates.php +++ b/vendor/sabre/vobject/bin/mergeduplicates.php @@ -19,7 +19,7 @@ foreach ($paths as $path) { if (!class_exists('Sabre\\VObject\\Version')) { fwrite(STDERR, "Composer autoloader could not be loaded.\n"); - die(1); + exit(1); } echo 'sabre/vobject ', Version::VERSION, " duplicate contact merge tool\n"; @@ -27,7 +27,7 @@ echo 'sabre/vobject ', Version::VERSION, " duplicate contact merge tool\n"; if ($argc < 3) { echo "\n"; echo 'Usage: ', $argv[0], " input.vcf output.vcf [debug.log]\n"; - die(1); + exit(1); } $input = fopen($argv[1], 'r'); diff --git a/vendor/sabre/vobject/bin/rrulebench.php b/vendor/sabre/vobject/bin/rrulebench.php index 583da574c..69008002e 100644 --- a/vendor/sabre/vobject/bin/rrulebench.php +++ b/vendor/sabre/vobject/bin/rrulebench.php @@ -9,7 +9,7 @@ if ($argc < 4) { echo 'system.'; echo "\n"; echo 'Usage: '.$argv[0]." inputfile.ics startdate enddate\n"; - die(); + exit(); } list(, $inputFile, $startDate, $endDate) = $argv; diff --git a/vendor/sabre/vobject/composer.json b/vendor/sabre/vobject/composer.json index f26c0b5ec..b745b1fa6 100644 --- a/vendor/sabre/vobject/composer.json +++ b/vendor/sabre/vobject/composer.json @@ -37,8 +37,9 @@ "sabre/xml" : "^2.1" }, "require-dev" : { - "friendsofphp/php-cs-fixer": "~2.16.7", + "friendsofphp/php-cs-fixer": "~2.17.1", "phpunit/phpunit" : "^7.5 || ^8.5 || ^9.0", + "phpunit/php-invoker" : "^2.0 || ^3.1", "phpstan/phpstan": "^0.12" }, "suggest" : { diff --git a/vendor/sabre/vobject/lib/Cli.php b/vendor/sabre/vobject/lib/Cli.php index f3e419b15..4984ac9b2 100644 --- a/vendor/sabre/vobject/lib/Cli.php +++ b/vendor/sabre/vobject/lib/Cli.php @@ -2,8 +2,7 @@ namespace Sabre\VObject; -use - InvalidArgumentException; +use InvalidArgumentException; /** * This is the CLI interface for sabre-vobject. @@ -137,17 +136,14 @@ class Cli // jcard/jcal documents case 'jcard': case 'jcal': - // specific document versions case 'vcard21': case 'vcard30': case 'vcard40': case 'icalendar20': - // specific formats case 'json': case 'mimedir': - // icalendar/vcad case 'icalendar': case 'vcard': @@ -183,7 +179,6 @@ class Cli case 'vcard30': case 'vcard40': case 'icalendar20': - $this->inputFormat = 'mimedir'; break; @@ -211,7 +206,7 @@ class Cli } if (!in_array($positional[0], ['validate', 'repair', 'convert', 'color'])) { - throw new InvalidArgumentException('Uknown command: '.$positional[0]); + throw new InvalidArgumentException('Unknown command: '.$positional[0]); } } catch (InvalidArgumentException $e) { $this->showHelp(); diff --git a/vendor/sabre/vobject/lib/Component.php b/vendor/sabre/vobject/lib/Component.php index da45eb29f..07f6a627f 100644 --- a/vendor/sabre/vobject/lib/Component.php +++ b/vendor/sabre/vobject/lib/Component.php @@ -160,9 +160,9 @@ class Component extends Node return; } } - } - throw new \InvalidArgumentException('The item you passed to remove() was not a child of this component'); + throw new \InvalidArgumentException('The item you passed to remove() was not a child of this component'); + } } /** diff --git a/vendor/sabre/vobject/lib/Component/VCalendar.php b/vendor/sabre/vobject/lib/Component/VCalendar.php index 40e09a1c0..4db318135 100644 --- a/vendor/sabre/vobject/lib/Component/VCalendar.php +++ b/vendor/sabre/vobject/lib/Component/VCalendar.php @@ -309,7 +309,7 @@ class VCalendar extends VObject\Document foreach ($this->children() as $child) { if ($child instanceof Property && 'PRODID' !== $child->name) { - // We explictly want to ignore PRODID, because we want to + // We explicitly want to ignore PRODID, because we want to // overwrite it with our own. $newChildren[] = clone $child; } elseif ($child instanceof Component && 'VTIMEZONE' !== $child->name) { diff --git a/vendor/sabre/vobject/lib/Component/VCard.php b/vendor/sabre/vobject/lib/Component/VCard.php index 51321949f..2430df621 100644 --- a/vendor/sabre/vobject/lib/Component/VCard.php +++ b/vendor/sabre/vobject/lib/Component/VCard.php @@ -373,7 +373,7 @@ class VCard extends VObject\Document /** * Returns a preferred field. * - * VCards can indicate wether a field such as ADR, TEL or EMAIL is + * VCards can indicate whether a field such as ADR, TEL or EMAIL is * preferred by specifying TYPE=PREF (vcard 2.1, 3) or PREF=x (vcard 4, x * being a number between 1 and 100). * diff --git a/vendor/sabre/vobject/lib/FreeBusyData.php b/vendor/sabre/vobject/lib/FreeBusyData.php index d05dfc799..4d9f441ce 100644 --- a/vendor/sabre/vobject/lib/FreeBusyData.php +++ b/vendor/sabre/vobject/lib/FreeBusyData.php @@ -84,7 +84,7 @@ class FreeBusyData 'type' => $type, ]; - $preceedingItem = $this->data[$insertStartIndex - 1]; + $precedingItem = $this->data[$insertStartIndex - 1]; if ($this->data[$insertStartIndex - 1]['start'] === $start) { // The old item starts at the exact same point as the new item. --$insertStartIndex; @@ -122,11 +122,11 @@ class FreeBusyData // between. if (-1 === $itemsToDelete) { $itemsToDelete = 0; - if ($newItem['end'] < $preceedingItem['end']) { + if ($newItem['end'] < $precedingItem['end']) { $newItems[] = [ 'start' => $newItem['end'] + 1, - 'end' => $preceedingItem['end'], - 'type' => $preceedingItem['type'], + 'end' => $precedingItem['end'], + 'type' => $precedingItem['type'], ]; } } diff --git a/vendor/sabre/vobject/lib/FreeBusyGenerator.php b/vendor/sabre/vobject/lib/FreeBusyGenerator.php index a1c24044c..81b8126d5 100644 --- a/vendor/sabre/vobject/lib/FreeBusyGenerator.php +++ b/vendor/sabre/vobject/lib/FreeBusyGenerator.php @@ -126,7 +126,7 @@ class FreeBusyGenerator /** * Sets the input objects. * - * You must either specify a valendar object as a string, or as the parse + * You must either specify a vcalendar object as a string, or as the parse * Component. * It's also possible to specify multiple objects as an array. * @@ -362,7 +362,6 @@ class FreeBusyGenerator foreach ($object->getBaseComponents() as $component) { switch ($component->name) { case 'VEVENT': - $FBTYPE = 'BUSY'; if (isset($component->TRANSP) && ('TRANSPARENT' === strtoupper($component->TRANSP))) { break; diff --git a/vendor/sabre/vobject/lib/Parameter.php b/vendor/sabre/vobject/lib/Parameter.php index e39d320a1..72f2ecbcb 100644 --- a/vendor/sabre/vobject/lib/Parameter.php +++ b/vendor/sabre/vobject/lib/Parameter.php @@ -95,13 +95,11 @@ class Parameter extends Node case 'WORK': case 'HOME': case 'PREF': - // Delivery Label Type case 'DOM': case 'INTL': case 'POSTAL': case 'PARCEL': - // Telephone types case 'VOICE': case 'FAX': @@ -113,7 +111,6 @@ class Parameter extends Node case 'CAR': case 'ISDN': case 'VIDEO': - // EMAIL types (lol) case 'AOL': case 'APPLELINK': @@ -127,7 +124,6 @@ class Parameter extends Node case 'PRODIGY': case 'TLX': case 'X400': - // Photo / Logo format types case 'GIF': case 'CGM': @@ -143,12 +139,10 @@ class Parameter extends Node case 'MPEG2': case 'AVI': case 'QTIME': - // Sound Digital Audio Type case 'WAVE': case 'PCM': case 'AIFF': - // Key types case 'X509': case 'PGP': @@ -299,7 +293,7 @@ class Parameter extends Node // https://tools.ietf.org/html/rfc6868 // // But we've found that iCal (7.0, shipped with OSX 10.9) - // severaly trips on + characters not being quoted, so we + // severely trips on + characters not being quoted, so we // added + as well. if (!preg_match('#(?: [\n":;\^,\+] )#x', $item)) { return $out.$item; diff --git a/vendor/sabre/vobject/lib/Parser/MimeDir.php b/vendor/sabre/vobject/lib/Parser/MimeDir.php index ea5ac0326..385d340d7 100644 --- a/vendor/sabre/vobject/lib/Parser/MimeDir.php +++ b/vendor/sabre/vobject/lib/Parser/MimeDir.php @@ -343,7 +343,7 @@ class MimeDir extends Parser ) (?=[;:,]) /xi"; - //echo $regex, "\n"; die(); + //echo $regex, "\n"; exit(); preg_match_all($regex, $line, $matches, PREG_SET_ORDER); $property = [ diff --git a/vendor/sabre/vobject/lib/Property/Boolean.php b/vendor/sabre/vobject/lib/Property/Boolean.php index 9fb2bce35..4bd6ffdfe 100644 --- a/vendor/sabre/vobject/lib/Property/Boolean.php +++ b/vendor/sabre/vobject/lib/Property/Boolean.php @@ -2,8 +2,7 @@ namespace Sabre\VObject\Property; -use - Sabre\VObject\Property; +use Sabre\VObject\Property; /** * Boolean property. diff --git a/vendor/sabre/vobject/lib/Property/ICalendar/CalAddress.php b/vendor/sabre/vobject/lib/Property/ICalendar/CalAddress.php index e89bb31f9..86be66c15 100644 --- a/vendor/sabre/vobject/lib/Property/ICalendar/CalAddress.php +++ b/vendor/sabre/vobject/lib/Property/ICalendar/CalAddress.php @@ -2,8 +2,7 @@ namespace Sabre\VObject\Property\ICalendar; -use - Sabre\VObject\Property\Text; +use Sabre\VObject\Property\Text; /** * CalAddress property. diff --git a/vendor/sabre/vobject/lib/Property/ICalendar/DateTime.php b/vendor/sabre/vobject/lib/Property/ICalendar/DateTime.php index f2dbdeba3..d635e17ae 100644 --- a/vendor/sabre/vobject/lib/Property/ICalendar/DateTime.php +++ b/vendor/sabre/vobject/lib/Property/ICalendar/DateTime.php @@ -184,7 +184,7 @@ class DateTime extends Property * Sets the property as multiple date-time objects. * * The first value will be used as a reference for the timezones, and all - * the otehr values will be adjusted for that timezone + * the other values will be adjusted for that timezone * * @param DateTimeInterface[] $dt * @param bool isFloating If set to true, timezones will be ignored diff --git a/vendor/sabre/vobject/lib/Property/IntegerValue.php b/vendor/sabre/vobject/lib/Property/IntegerValue.php index 6f709bfff..3ae775214 100644 --- a/vendor/sabre/vobject/lib/Property/IntegerValue.php +++ b/vendor/sabre/vobject/lib/Property/IntegerValue.php @@ -2,8 +2,7 @@ namespace Sabre\VObject\Property; -use - Sabre\VObject\Property; +use Sabre\VObject\Property; /** * Integer property. diff --git a/vendor/sabre/vobject/lib/Property/VCard/LanguageTag.php b/vendor/sabre/vobject/lib/Property/VCard/LanguageTag.php index 697273989..318ea0231 100644 --- a/vendor/sabre/vobject/lib/Property/VCard/LanguageTag.php +++ b/vendor/sabre/vobject/lib/Property/VCard/LanguageTag.php @@ -2,8 +2,7 @@ namespace Sabre\VObject\Property\VCard; -use - Sabre\VObject\Property; +use Sabre\VObject\Property; /** * LanguageTag property. diff --git a/vendor/sabre/vobject/lib/Recur/EventIterator.php b/vendor/sabre/vobject/lib/Recur/EventIterator.php index fd904b383..e42ca1360 100644 --- a/vendor/sabre/vobject/lib/Recur/EventIterator.php +++ b/vendor/sabre/vobject/lib/Recur/EventIterator.php @@ -83,7 +83,7 @@ class EventIterator implements \Iterator * 2. You can pass an array of VEVENTs (all UIDS should match). * 3. You can pass a single VEVENT component. * - * Only the second method is recomended. The other 1 and 3 will be removed + * Only the second method is recommended. The other 1 and 3 will be removed * at some point in the future. * * The $uid parameter is only required for the first method. diff --git a/vendor/sabre/vobject/lib/Recur/RRuleIterator.php b/vendor/sabre/vobject/lib/Recur/RRuleIterator.php index 55581e9ac..0511f0ade 100644 --- a/vendor/sabre/vobject/lib/Recur/RRuleIterator.php +++ b/vendor/sabre/vobject/lib/Recur/RRuleIterator.php @@ -468,6 +468,13 @@ class RRuleIterator implements Iterator // beginning. $currentDayOfMonth = 0; + // For some reason the "until" parameter was not being used here, + // that's why the workaround of the 10000 year bug was needed at all + // let's stop it before the "until" parameter date + if ($this->until && $this->currentDate->getTimestamp() >= $this->until->getTimestamp()) { + return; + } + // To prevent running this forever (better: until we hit the max date of DateTimeImmutable) we simply // stop at 9999-12-31. Looks like the year 10000 problem is not solved in php .... if ($this->currentDate->getTimestamp() > 253402300799) { @@ -536,7 +543,7 @@ class RRuleIterator implements Iterator foreach ($this->byWeekNo as $byWeekNo) { foreach ($dayOffsets as $dayOffset) { $date = clone $this->currentDate; - $date->setISODate($currentYear, $byWeekNo, $dayOffset); + $date = $date->setISODate($currentYear, $byWeekNo, $dayOffset); if ($date > $this->currentDate) { $checkDates[] = $date; @@ -717,7 +724,6 @@ class RRuleIterator implements Iterator break; case 'INTERVAL': - case 'COUNT': $val = (int) $value; if ($val < 1) { @@ -877,7 +883,7 @@ class RRuleIterator implements Iterator foreach ($this->byMonthDay as $monthDay) { // Removing values that are out of range for this month if ($monthDay > $startDate->format('t') || - $monthDay < 0 - $startDate->format('t')) { + $monthDay < 0 - $startDate->format('t')) { continue; } if ($monthDay > 0) { diff --git a/vendor/sabre/vobject/lib/Version.php b/vendor/sabre/vobject/lib/Version.php index 29ba84f88..63452400f 100644 --- a/vendor/sabre/vobject/lib/Version.php +++ b/vendor/sabre/vobject/lib/Version.php @@ -14,5 +14,5 @@ class Version /** * Full version number. */ - const VERSION = '4.3.3'; + const VERSION = '4.3.5'; } diff --git a/vendor/sabre/vobject/lib/timezonedata/windowszones.php b/vendor/sabre/vobject/lib/timezonedata/windowszones.php index af3904b12..2049a95c1 100644 --- a/vendor/sabre/vobject/lib/timezonedata/windowszones.php +++ b/vendor/sabre/vobject/lib/timezonedata/windowszones.php @@ -3,14 +3,14 @@ /** * Automatically generated timezone file. * - * Last update: 2016-08-24T17:35:38-04:00 - * Source: http://unicode.org/repos/cldr/trunk/common/supplemental/windowsZones.xml + * Last update: 2020-12-13T17:38:12+05:45 + * Source: https://raw.githubusercontent.com/unicode-org/cldr/master/common/supplemental/windowsZones.xml * - * @copyright Copyright (C) 2011-2015 fruux GmbH (https://fruux.com/). + * @copyright Copyright (C) fruux GmbH (https://fruux.com/). * @license http://sabre.io/license/ Modified BSD License */ -return [ +return [ 'AUS Central Standard Time' => 'Australia/Darwin', 'AUS Eastern Standard Time' => 'Australia/Sydney', 'Afghanistan Standard Time' => 'Asia/Kabul', @@ -74,6 +74,7 @@ return [ 'Line Islands Standard Time' => 'Pacific/Kiritimati', 'Lord Howe Standard Time' => 'Australia/Lord_Howe', 'Magadan Standard Time' => 'Asia/Magadan', + 'Magallanes Standard Time' => 'America/Punta_Arenas', 'Marquesas Standard Time' => 'Pacific/Marquesas', 'Mauritius Standard Time' => 'Indian/Mauritius', 'Middle East Standard Time' => 'Asia/Beirut', @@ -91,11 +92,13 @@ return [ 'North Asia East Standard Time' => 'Asia/Irkutsk', 'North Asia Standard Time' => 'Asia/Krasnoyarsk', 'North Korea Standard Time' => 'Asia/Pyongyang', + 'Omsk Standard Time' => 'Asia/Omsk', 'Pacific SA Standard Time' => 'America/Santiago', 'Pacific Standard Time' => 'America/Los_Angeles', 'Pacific Standard Time (Mexico)' => 'America/Tijuana', 'Pakistan Standard Time' => 'Asia/Karachi', 'Paraguay Standard Time' => 'America/Asuncion', + 'Qyzylorda Standard Time' => 'Asia/Qyzylorda', 'Romance Standard Time' => 'Europe/Paris', 'Russia Time Zone 10' => 'Asia/Srednekolymsk', 'Russia Time Zone 11' => 'Asia/Kamchatka', @@ -108,9 +111,12 @@ return [ 'Saint Pierre Standard Time' => 'America/Miquelon', 'Sakhalin Standard Time' => 'Asia/Sakhalin', 'Samoa Standard Time' => 'Pacific/Apia', + 'Sao Tome Standard Time' => 'Africa/Sao_Tome', + 'Saratov Standard Time' => 'Europe/Saratov', 'Singapore Standard Time' => 'Asia/Singapore', 'South Africa Standard Time' => 'Africa/Johannesburg', 'Sri Lanka Standard Time' => 'Asia/Colombo', + 'Sudan Standard Time' => 'Africa/Khartoum', 'Syria Standard Time' => 'Asia/Damascus', 'Taipei Standard Time' => 'Asia/Taipei', 'Tasmania Standard Time' => 'Australia/Hobart', @@ -125,6 +131,7 @@ return [ 'US Mountain Standard Time' => 'America/Phoenix', 'UTC' => 'Etc/GMT', 'UTC+12' => 'Etc/GMT-12', + 'UTC+13' => 'Etc/GMT-13', 'UTC-02' => 'Etc/GMT+2', 'UTC-08' => 'Etc/GMT+8', 'UTC-09' => 'Etc/GMT+9', @@ -132,6 +139,7 @@ return [ 'Ulaanbaatar Standard Time' => 'Asia/Ulaanbaatar', 'Venezuela Standard Time' => 'America/Caracas', 'Vladivostok Standard Time' => 'Asia/Vladivostok', + 'Volgograd Standard Time' => 'Europe/Volgograd', 'W. Australia Standard Time' => 'Australia/Perth', 'W. Central Africa Standard Time' => 'Africa/Lagos', 'W. Europe Standard Time' => 'Europe/Berlin', @@ -140,4 +148,5 @@ return [ 'West Bank Standard Time' => 'Asia/Hebron', 'West Pacific Standard Time' => 'Pacific/Port_Moresby', 'Yakutsk Standard Time' => 'Asia/Yakutsk', + 'Yukon Standard Time' => 'America/Whitehorse', ]; diff --git a/vendor/sabre/vobject/phpstan.neon b/vendor/sabre/vobject/phpstan.neon deleted file mode 100644 index c705178c9..000000000 --- a/vendor/sabre/vobject/phpstan.neon +++ /dev/null @@ -1,4 +0,0 @@ -parameters: - level: 1 - universalObjectCratesClasses: - - \Sabre\VObject\Component diff --git a/vendor/sabre/vobject/tests/bootstrap.php b/vendor/sabre/vobject/tests/bootstrap.php deleted file mode 100644 index 2496aa4ff..000000000 --- a/vendor/sabre/vobject/tests/bootstrap.php +++ /dev/null @@ -1,15 +0,0 @@ -<?php - -date_default_timezone_set('UTC'); - -$try = [ - __DIR__.'/../vendor/autoload.php', - __DIR__.'/../../../autoload.php', -]; - -foreach ($try as $path) { - if (file_exists($path)) { - $autoLoader = include $path; - break; - } -} diff --git a/vendor/sabre/vobject/tests/phpunit.xml b/vendor/sabre/vobject/tests/phpunit.xml deleted file mode 100644 index c0588d460..000000000 --- a/vendor/sabre/vobject/tests/phpunit.xml +++ /dev/null @@ -1,21 +0,0 @@ -<phpunit - colors="true" - bootstrap="bootstrap.php" - convertErrorsToExceptions="true" - convertNoticesToExceptions="true" - convertWarningsToExceptions="true" - beStrictAboutTestsThatDoNotTestAnything="true" - beStrictAboutOutputDuringTests="true" - > - <testsuites> - <testsuite name="Sabre\VObject"> - <directory>.</directory> - </testsuite> - </testsuites> - - <filter> - <whitelist addUncoveredFilesFromWhitelist="true"> - <directory suffix=".php">../lib/</directory> - </whitelist> - </filter> -</phpunit> |