From 35329f65ff885fa4033e6e343b5d175ade496eb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= <1005065+DeepDiver1975@users.noreply.github.com> Date: Thu, 9 Nov 2023 12:15:05 +0100 Subject: [PATCH 1/3] feat: use php7.4 as minimum --- .github/workflows/ci.yml | 2 +- composer.json | 27 +++++---- lib/CalDAV/Xml/Notification/Invite.php | 2 +- lib/CalDAV/Xml/Notification/InviteReply.php | 2 +- lib/CalDAV/Xml/Notification/SystemStatus.php | 2 +- .../Xml/Property/AllowedSharingModes.php | 2 +- lib/CalDAV/Xml/Property/EmailAddressSet.php | 2 +- lib/CalDAV/Xml/Property/Invite.php | 2 +- .../Xml/Property/ScheduleCalendarTransp.php | 2 +- .../SupportedCalendarComponentSet.php | 2 +- .../Xml/Property/SupportedCalendarData.php | 2 +- .../Xml/Property/SupportedCollationSet.php | 2 +- .../Xml/Property/SupportedAddressData.php | 2 +- .../Xml/Property/SupportedCollationSet.php | 2 +- lib/DAV/Xml/Element/Response.php | 2 +- lib/DAV/Xml/Element/Sharee.php | 2 +- lib/DAV/Xml/Property/Complex.php | 8 +-- lib/DAV/Xml/Property/GetLastModified.php | 2 +- lib/DAV/Xml/Property/Href.php | 2 +- lib/DAV/Xml/Property/Invite.php | 2 +- lib/DAV/Xml/Property/LockDiscovery.php | 2 +- lib/DAV/Xml/Property/ShareAccess.php | 2 +- lib/DAV/Xml/Property/SupportedLock.php | 2 +- lib/DAV/Xml/Property/SupportedMethodSet.php | 2 +- lib/DAV/Xml/Property/SupportedReportSet.php | 2 +- lib/DAV/Xml/Request/PropPatch.php | 4 +- lib/DAV/Xml/Response/MultiStatus.php | 2 +- lib/DAV/Xml/Service.php | 6 +- lib/DAVACL/Xml/Property/Acl.php | 2 +- lib/DAVACL/Xml/Property/AclRestrictions.php | 2 +- .../Xml/Property/CurrentUserPrivilegeSet.php | 2 +- lib/DAVACL/Xml/Property/Principal.php | 2 +- .../Xml/Property/SupportedPrivilegeSet.php | 2 +- tests/Sabre/CalDAV/Backend/SimplePDOTest.php | 10 +--- .../CalDAV/Schedule/SchedulingObjectTest.php | 3 - tests/Sabre/DAV/AbstractServer.php | 14 ++--- tests/Sabre/DAV/Auth/Backend/FileTest.php | 12 ++-- .../DAV/Browser/GuessContentTypeTest.php | 4 +- tests/Sabre/DAV/Browser/PluginTest.php | 2 +- tests/Sabre/DAV/ClientMock.php | 2 +- tests/Sabre/DAV/DbTestHelperTrait.php | 14 +++-- tests/Sabre/DAV/FSExt/DirectoryTest.php | 4 +- tests/Sabre/DAV/FSExt/FileTest.php | 38 ++++++------ tests/Sabre/DAV/Issue33Test.php | 10 ++-- tests/Sabre/DAV/Locks/Backend/FileTest.php | 2 +- tests/Sabre/DAV/Locks/MSWordTest.php | 6 +- tests/Sabre/DAV/Locks/Plugin2Test.php | 2 +- tests/Sabre/DAV/Locks/PluginTest.php | 6 +- tests/Sabre/DAV/ObjectTreeTest.php | 40 ++++++------- .../DAV/PartialUpdate/SpecificationTest.php | 4 +- .../DAV/ServerPropsInfiniteDepthTest.php | 20 +++---- tests/Sabre/DAV/ServerPropsTest.php | 18 +++--- tests/Sabre/DAV/TemporaryFileFilterTest.php | 14 ++--- tests/Sabre/DAVACL/FS/CollectionTest.php | 10 ++-- tests/Sabre/DAVACL/FS/HomeCollectionTest.php | 2 +- tests/Sabre/HTTP/ResponseMock.php | 2 +- tests/Sabre/HTTP/SapiMock.php | 2 +- tests/Sabre/TestUtil.php | 40 ++----------- tests/bootstrap.php | 47 ++------------- tests/phpunit.xml | 58 ++++++++----------- 60 files changed, 205 insertions(+), 284 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 150f4678c2..f973f5d73d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,7 +53,7 @@ jobs: strategy: fail-fast: false matrix: - php-versions: [ '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2' ] + php-versions: [ '7.4', '8.0', '8.1', '8.2' ] coverage: [ 'xdebug' ] streaming: [ false ] include: diff --git a/composer.json b/composer.json index a1296ed0b0..2e72316f21 100644 --- a/composer.json +++ b/composer.json @@ -14,25 +14,24 @@ } ], "require": { - "php": "^7.1.0 || ^8.0", - "sabre/vobject": "^4.2.1", - "sabre/event" : "^5.0", - "sabre/xml" : "^2.0.1", - "sabre/http" : "^5.0.5", - "sabre/uri" : "^2.0", + "php": "^7.4.0 || ^8.0", + "ext-ctype": "*", + "ext-date": "*", "ext-dom": "*", + "ext-iconv": "*", + "ext-json": "*", + "ext-mbstring": "*", "ext-pcre": "*", - "ext-spl": "*", "ext-simplexml": "*", - "ext-mbstring" : "*", - "ext-ctype" : "*", - "ext-date" : "*", - "ext-iconv" : "*", - "lib-libxml" : ">=2.7.0", + "ext-spl": "*", + "lib-libxml": ">=2.7.0", "psr/log": "^1.0 || ^2.0 || ^3.0", - "ext-json": "*" + "sabre/event": "^6.0", + "sabre/http": "^7.0", + "sabre/vobject": "^4.5" }, "require-dev" : { + "ext-sqlite3": "*", "friendsofphp/php-cs-fixer": "^2.19", "monolog/monolog": "^1.27", "phpstan/phpstan": "^0.12 || ^1.0", @@ -70,7 +69,7 @@ "php-cs-fixer fix" ], "phpunit": [ - "phpunit --configuration tests/phpunit.xml" + "phpunit --configuration tests/phpunit.xml tests" ], "test": [ "composer phpstan", diff --git a/lib/CalDAV/Xml/Notification/Invite.php b/lib/CalDAV/Xml/Notification/Invite.php index 2dbb0f4984..71ccf49b15 100644 --- a/lib/CalDAV/Xml/Notification/Invite.php +++ b/lib/CalDAV/Xml/Notification/Invite.php @@ -182,7 +182,7 @@ public function __construct(array $values) * * If you are opening new elements, you must also close them again. */ - public function xmlSerialize(Writer $writer) + public function xmlSerialize(Writer $writer): void { $writer->writeElement('{'.CalDAV\Plugin::NS_CALENDARSERVER.'}invite-notification'); } diff --git a/lib/CalDAV/Xml/Notification/InviteReply.php b/lib/CalDAV/Xml/Notification/InviteReply.php index dbdba3b027..60bd0015bb 100644 --- a/lib/CalDAV/Xml/Notification/InviteReply.php +++ b/lib/CalDAV/Xml/Notification/InviteReply.php @@ -131,7 +131,7 @@ public function __construct(array $values) * * If you are opening new elements, you must also close them again. */ - public function xmlSerialize(Writer $writer) + public function xmlSerialize(Writer $writer): void { $writer->writeElement('{'.CalDAV\Plugin::NS_CALENDARSERVER.'}invite-reply'); } diff --git a/lib/CalDAV/Xml/Notification/SystemStatus.php b/lib/CalDAV/Xml/Notification/SystemStatus.php index 6d196b30c6..666f8f4c5e 100644 --- a/lib/CalDAV/Xml/Notification/SystemStatus.php +++ b/lib/CalDAV/Xml/Notification/SystemStatus.php @@ -91,7 +91,7 @@ public function __construct($id, $etag, $type = self::TYPE_HIGH, $description = * Important note 2: If you are writing any new elements, you are also * responsible for closing them. */ - public function xmlSerialize(Writer $writer) + public function xmlSerialize(Writer $writer): void { switch ($this->type) { case self::TYPE_LOW: diff --git a/lib/CalDAV/Xml/Property/AllowedSharingModes.php b/lib/CalDAV/Xml/Property/AllowedSharingModes.php index 58acb6d540..589f1be3c0 100644 --- a/lib/CalDAV/Xml/Property/AllowedSharingModes.php +++ b/lib/CalDAV/Xml/Property/AllowedSharingModes.php @@ -69,7 +69,7 @@ public function __construct($canBeShared, $canBePublished) * * If you are opening new elements, you must also close them again. */ - public function xmlSerialize(Writer $writer) + public function xmlSerialize(Writer $writer): void { if ($this->canBeShared) { $writer->writeElement('{'.Plugin::NS_CALENDARSERVER.'}can-be-shared'); diff --git a/lib/CalDAV/Xml/Property/EmailAddressSet.php b/lib/CalDAV/Xml/Property/EmailAddressSet.php index 84f7ae02f1..0348649b4c 100644 --- a/lib/CalDAV/Xml/Property/EmailAddressSet.php +++ b/lib/CalDAV/Xml/Property/EmailAddressSet.php @@ -62,7 +62,7 @@ public function getValue() * * If you are opening new elements, you must also close them again. */ - public function xmlSerialize(Writer $writer) + public function xmlSerialize(Writer $writer): void { foreach ($this->emails as $email) { $writer->writeElement('{http://calendarserver.org/ns/}email-address', $email); diff --git a/lib/CalDAV/Xml/Property/Invite.php b/lib/CalDAV/Xml/Property/Invite.php index c389ca827d..ea5e505456 100644 --- a/lib/CalDAV/Xml/Property/Invite.php +++ b/lib/CalDAV/Xml/Property/Invite.php @@ -68,7 +68,7 @@ public function getValue() * * If you are opening new elements, you must also close them again. */ - public function xmlSerialize(Writer $writer) + public function xmlSerialize(Writer $writer): void { $cs = '{'.Plugin::NS_CALENDARSERVER.'}'; diff --git a/lib/CalDAV/Xml/Property/ScheduleCalendarTransp.php b/lib/CalDAV/Xml/Property/ScheduleCalendarTransp.php index 1595220250..45e290bc01 100644 --- a/lib/CalDAV/Xml/Property/ScheduleCalendarTransp.php +++ b/lib/CalDAV/Xml/Property/ScheduleCalendarTransp.php @@ -77,7 +77,7 @@ public function getValue() * * If you are opening new elements, you must also close them again. */ - public function xmlSerialize(Writer $writer) + public function xmlSerialize(Writer $writer): void { switch ($this->value) { case self::TRANSPARENT: diff --git a/lib/CalDAV/Xml/Property/SupportedCalendarComponentSet.php b/lib/CalDAV/Xml/Property/SupportedCalendarComponentSet.php index d86e7b77c4..3fe03f4f2d 100644 --- a/lib/CalDAV/Xml/Property/SupportedCalendarComponentSet.php +++ b/lib/CalDAV/Xml/Property/SupportedCalendarComponentSet.php @@ -68,7 +68,7 @@ public function getValue() * * If you are opening new elements, you must also close them again. */ - public function xmlSerialize(Writer $writer) + public function xmlSerialize(Writer $writer): void { foreach ($this->components as $component) { $writer->startElement('{'.Plugin::NS_CALDAV.'}comp'); diff --git a/lib/CalDAV/Xml/Property/SupportedCalendarData.php b/lib/CalDAV/Xml/Property/SupportedCalendarData.php index 5b08933058..1ab646d090 100644 --- a/lib/CalDAV/Xml/Property/SupportedCalendarData.php +++ b/lib/CalDAV/Xml/Property/SupportedCalendarData.php @@ -40,7 +40,7 @@ class SupportedCalendarData implements XmlSerializable * * If you are opening new elements, you must also close them again. */ - public function xmlSerialize(Writer $writer) + public function xmlSerialize(Writer $writer): void { $writer->startElement('{'.Plugin::NS_CALDAV.'}calendar-data'); $writer->writeAttributes([ diff --git a/lib/CalDAV/Xml/Property/SupportedCollationSet.php b/lib/CalDAV/Xml/Property/SupportedCollationSet.php index c5ffeee385..af73a02ffc 100644 --- a/lib/CalDAV/Xml/Property/SupportedCollationSet.php +++ b/lib/CalDAV/Xml/Property/SupportedCollationSet.php @@ -39,7 +39,7 @@ class SupportedCollationSet implements XmlSerializable * * If you are opening new elements, you must also close them again. */ - public function xmlSerialize(Writer $writer) + public function xmlSerialize(Writer $writer): void { $collations = [ 'i;ascii-casemap', diff --git a/lib/CardDAV/Xml/Property/SupportedAddressData.php b/lib/CardDAV/Xml/Property/SupportedAddressData.php index fe5f976a03..a912724bf9 100644 --- a/lib/CardDAV/Xml/Property/SupportedAddressData.php +++ b/lib/CardDAV/Xml/Property/SupportedAddressData.php @@ -63,7 +63,7 @@ public function __construct(array $supportedData = null) * * If you are opening new elements, you must also close them again. */ - public function xmlSerialize(Writer $writer) + public function xmlSerialize(Writer $writer): void { foreach ($this->supportedData as $supported) { $writer->startElement('{'.Plugin::NS_CARDDAV.'}address-data-type'); diff --git a/lib/CardDAV/Xml/Property/SupportedCollationSet.php b/lib/CardDAV/Xml/Property/SupportedCollationSet.php index b19eddd9c2..d8ca982aa7 100644 --- a/lib/CardDAV/Xml/Property/SupportedCollationSet.php +++ b/lib/CardDAV/Xml/Property/SupportedCollationSet.php @@ -35,7 +35,7 @@ class SupportedCollationSet implements XmlSerializable * * If you are opening new elements, you must also close them again. */ - public function xmlSerialize(Writer $writer) + public function xmlSerialize(Writer $writer): void { foreach (['i;ascii-casemap', 'i;octet', 'i;unicode-casemap'] as $coll) { $writer->writeElement('{urn:ietf:params:xml:ns:carddav}supported-collation', $coll); diff --git a/lib/DAV/Xml/Element/Response.php b/lib/DAV/Xml/Element/Response.php index df92914650..86f2d33882 100644 --- a/lib/DAV/Xml/Element/Response.php +++ b/lib/DAV/Xml/Element/Response.php @@ -110,7 +110,7 @@ public function getResponseProperties() * Important note 2: If you are writing any new elements, you are also * responsible for closing them. */ - public function xmlSerialize(Writer $writer) + public function xmlSerialize(Writer $writer): void { /* * Accordingly to the RFC the element looks like: diff --git a/lib/DAV/Xml/Element/Sharee.php b/lib/DAV/Xml/Element/Sharee.php index 33564d8f24..79d6aa90db 100644 --- a/lib/DAV/Xml/Element/Sharee.php +++ b/lib/DAV/Xml/Element/Sharee.php @@ -112,7 +112,7 @@ public function __construct(array $properties = []) * * If you are opening new elements, you must also close them again. */ - public function xmlSerialize(Writer $writer) + public function xmlSerialize(Writer $writer): void { $writer->write([ new Href($this->href), diff --git a/lib/DAV/Xml/Property/Complex.php b/lib/DAV/Xml/Property/Complex.php index 787d30d954..9db5ad6790 100644 --- a/lib/DAV/Xml/Property/Complex.php +++ b/lib/DAV/Xml/Property/Complex.php @@ -77,11 +77,9 @@ public static function xmlDeserialize(Reader $reader) $reader->read(); if ($nonText) { - $new = new self($xml); - - return $new; - } else { - return $text; + return new self($xml); } + + return $text; } } diff --git a/lib/DAV/Xml/Property/GetLastModified.php b/lib/DAV/Xml/Property/GetLastModified.php index efc15c293a..0a1b7f800e 100644 --- a/lib/DAV/Xml/Property/GetLastModified.php +++ b/lib/DAV/Xml/Property/GetLastModified.php @@ -69,7 +69,7 @@ public function getTime() * Important note 2: If you are writing any new elements, you are also * responsible for closing them. */ - public function xmlSerialize(Writer $writer) + public function xmlSerialize(Writer $writer): void { $writer->write( HTTP\toDate($this->time) diff --git a/lib/DAV/Xml/Property/Href.php b/lib/DAV/Xml/Property/Href.php index f88ce814ad..898a4e2328 100644 --- a/lib/DAV/Xml/Property/Href.php +++ b/lib/DAV/Xml/Property/Href.php @@ -85,7 +85,7 @@ public function getHrefs() * * If you are opening new elements, you must also close them again. */ - public function xmlSerialize(Writer $writer) + public function xmlSerialize(Writer $writer): void { foreach ($this->getHrefs() as $href) { $href = Uri\resolve($writer->contextUri, $href); diff --git a/lib/DAV/Xml/Property/Invite.php b/lib/DAV/Xml/Property/Invite.php index e3f0a611bf..a6654dd398 100644 --- a/lib/DAV/Xml/Property/Invite.php +++ b/lib/DAV/Xml/Property/Invite.php @@ -57,7 +57,7 @@ public function __construct(array $sharees) * * If you are opening new elements, you must also close them again. */ - public function xmlSerialize(Writer $writer) + public function xmlSerialize(Writer $writer): void { foreach ($this->sharees as $sharee) { $writer->writeElement('{DAV:}sharee', $sharee); diff --git a/lib/DAV/Xml/Property/LockDiscovery.php b/lib/DAV/Xml/Property/LockDiscovery.php index ec4cbc0c6c..7fdc8ef591 100644 --- a/lib/DAV/Xml/Property/LockDiscovery.php +++ b/lib/DAV/Xml/Property/LockDiscovery.php @@ -63,7 +63,7 @@ public function __construct($locks) * Important note 2: If you are writing any new elements, you are also * responsible for closing them. */ - public function xmlSerialize(Writer $writer) + public function xmlSerialize(Writer $writer): void { foreach ($this->locks as $lock) { $writer->startElement('{DAV:}activelock'); diff --git a/lib/DAV/Xml/Property/ShareAccess.php b/lib/DAV/Xml/Property/ShareAccess.php index fdd55558c9..878e3eeca3 100644 --- a/lib/DAV/Xml/Property/ShareAccess.php +++ b/lib/DAV/Xml/Property/ShareAccess.php @@ -72,7 +72,7 @@ public function getValue() * * If you are opening new elements, you must also close them again. */ - public function xmlSerialize(Writer $writer) + public function xmlSerialize(Writer $writer): void { switch ($this->value) { case SharingPlugin::ACCESS_NOTSHARED: diff --git a/lib/DAV/Xml/Property/SupportedLock.php b/lib/DAV/Xml/Property/SupportedLock.php index 100829c60a..fcbe2fa459 100644 --- a/lib/DAV/Xml/Property/SupportedLock.php +++ b/lib/DAV/Xml/Property/SupportedLock.php @@ -38,7 +38,7 @@ class SupportedLock implements XmlSerializable * * If you are opening new elements, you must also close them again. */ - public function xmlSerialize(Writer $writer) + public function xmlSerialize(Writer $writer): void { $writer->writeElement('{DAV:}lockentry', [ '{DAV:}lockscope' => ['{DAV:}exclusive' => null], diff --git a/lib/DAV/Xml/Property/SupportedMethodSet.php b/lib/DAV/Xml/Property/SupportedMethodSet.php index 6344010932..95d2c29ac6 100644 --- a/lib/DAV/Xml/Property/SupportedMethodSet.php +++ b/lib/DAV/Xml/Property/SupportedMethodSet.php @@ -82,7 +82,7 @@ public function has($methodName) * * If you are opening new elements, you must also close them again. */ - public function xmlSerialize(Writer $writer) + public function xmlSerialize(Writer $writer): void { foreach ($this->getValue() as $val) { $writer->startElement('{DAV:}supported-method'); diff --git a/lib/DAV/Xml/Property/SupportedReportSet.php b/lib/DAV/Xml/Property/SupportedReportSet.php index 0b4990e961..35e1614423 100644 --- a/lib/DAV/Xml/Property/SupportedReportSet.php +++ b/lib/DAV/Xml/Property/SupportedReportSet.php @@ -110,7 +110,7 @@ public function has($reportName) * * If you are opening new elements, you must also close them again. */ - public function xmlSerialize(Writer $writer) + public function xmlSerialize(Writer $writer): void { foreach ($this->getValue() as $val) { $writer->startElement('{DAV:}supported-report'); diff --git a/lib/DAV/Xml/Request/PropPatch.php b/lib/DAV/Xml/Request/PropPatch.php index 4a27095025..c1ed0d3afe 100644 --- a/lib/DAV/Xml/Request/PropPatch.php +++ b/lib/DAV/Xml/Request/PropPatch.php @@ -46,10 +46,10 @@ class PropPatch implements Element * * If you are opening new elements, you must also close them again. */ - public function xmlSerialize(Writer $writer) + public function xmlSerialize(Writer $writer): void { foreach ($this->properties as $propertyName => $propertyValue) { - if (is_null($propertyValue)) { + if (null === $propertyValue) { $writer->startElement('{DAV:}remove'); $writer->write(['{DAV:}prop' => [$propertyName => $propertyValue]]); $writer->endElement(); diff --git a/lib/DAV/Xml/Response/MultiStatus.php b/lib/DAV/Xml/Response/MultiStatus.php index e824cda429..8f9d45c80f 100644 --- a/lib/DAV/Xml/Response/MultiStatus.php +++ b/lib/DAV/Xml/Response/MultiStatus.php @@ -81,7 +81,7 @@ public function getSyncToken() * Important note 2: If you are writing any new elements, you are also * responsible for closing them. */ - public function xmlSerialize(Writer $writer) + public function xmlSerialize(Writer $writer): void { foreach ($this->getResponses() as $response) { $writer->writeElement('{DAV:}response', $response); diff --git a/lib/DAV/Xml/Service.php b/lib/DAV/Xml/Service.php index 4406b022d0..e718606b96 100644 --- a/lib/DAV/Xml/Service.php +++ b/lib/DAV/Xml/Service.php @@ -19,7 +19,7 @@ class Service extends \Sabre\Xml\Service * For instance, this list may contain an entry `{DAV:}propfind` that would * be mapped to Sabre\DAV\Xml\Request\PropFind */ - public $elementMap = [ + public array $elementMap = [ '{DAV:}multistatus' => 'Sabre\\DAV\\Xml\\Response\\MultiStatus', '{DAV:}response' => 'Sabre\\DAV\\Xml\\Element\\Response', @@ -37,10 +37,8 @@ class Service extends \Sabre\Xml\Service * * If you are defining your own custom namespace, add it here to reduce * bandwidth and improve legibility of xml bodies. - * - * @var array */ - public $namespaceMap = [ + public array $namespaceMap = [ 'DAV:' => 'd', 'http://sabredav.org/ns' => 's', ]; diff --git a/lib/DAVACL/Xml/Property/Acl.php b/lib/DAVACL/Xml/Property/Acl.php index c6e236dc59..086d123037 100644 --- a/lib/DAVACL/Xml/Property/Acl.php +++ b/lib/DAVACL/Xml/Property/Acl.php @@ -92,7 +92,7 @@ public function getPrivileges() * * If you are opening new elements, you must also close them again. */ - public function xmlSerialize(Writer $writer) + public function xmlSerialize(Writer $writer): void { foreach ($this->privileges as $ace) { $this->serializeAce($writer, $ace); diff --git a/lib/DAVACL/Xml/Property/AclRestrictions.php b/lib/DAVACL/Xml/Property/AclRestrictions.php index b5629c8096..f93f415a24 100644 --- a/lib/DAVACL/Xml/Property/AclRestrictions.php +++ b/lib/DAVACL/Xml/Property/AclRestrictions.php @@ -34,7 +34,7 @@ class AclRestrictions implements XmlSerializable * * If you are opening new elements, you must also close them again. */ - public function xmlSerialize(Writer $writer) + public function xmlSerialize(Writer $writer): void { $writer->writeElement('{DAV:}grant-only'); $writer->writeElement('{DAV:}no-invert'); diff --git a/lib/DAVACL/Xml/Property/CurrentUserPrivilegeSet.php b/lib/DAVACL/Xml/Property/CurrentUserPrivilegeSet.php index e38a45c61e..4a7ad25b48 100644 --- a/lib/DAVACL/Xml/Property/CurrentUserPrivilegeSet.php +++ b/lib/DAVACL/Xml/Property/CurrentUserPrivilegeSet.php @@ -55,7 +55,7 @@ public function __construct(array $privileges) * * If you are opening new elements, you must also close them again. */ - public function xmlSerialize(Writer $writer) + public function xmlSerialize(Writer $writer): void { foreach ($this->privileges as $privName) { $writer->startElement('{DAV:}privilege'); diff --git a/lib/DAVACL/Xml/Property/Principal.php b/lib/DAVACL/Xml/Property/Principal.php index 52092128f3..e19ad61744 100644 --- a/lib/DAVACL/Xml/Property/Principal.php +++ b/lib/DAVACL/Xml/Property/Principal.php @@ -99,7 +99,7 @@ public function getType() * * If you are opening new elements, you must also close them again. */ - public function xmlSerialize(Writer $writer) + public function xmlSerialize(Writer $writer): void { switch ($this->type) { case self::UNAUTHENTICATED: diff --git a/lib/DAVACL/Xml/Property/SupportedPrivilegeSet.php b/lib/DAVACL/Xml/Property/SupportedPrivilegeSet.php index 6e7514bd95..b965f3c078 100644 --- a/lib/DAVACL/Xml/Property/SupportedPrivilegeSet.php +++ b/lib/DAVACL/Xml/Property/SupportedPrivilegeSet.php @@ -66,7 +66,7 @@ public function getValue() * * If you are opening new elements, you must also close them again. */ - public function xmlSerialize(Writer $writer) + public function xmlSerialize(Writer $writer): void { $this->serializePriv($writer, '{DAV:}all', ['aggregates' => $this->privileges]); } diff --git a/tests/Sabre/CalDAV/Backend/SimplePDOTest.php b/tests/Sabre/CalDAV/Backend/SimplePDOTest.php index 932c975236..cb1bd8efec 100644 --- a/tests/Sabre/CalDAV/Backend/SimplePDOTest.php +++ b/tests/Sabre/CalDAV/Backend/SimplePDOTest.php @@ -13,15 +13,11 @@ class SimplePDOTest extends \PHPUnit\Framework\TestCase public function setup(): void { - if (!SABRE_HASSQLITE) { - $this->markTestSkipped('SQLite driver is not available'); + if (file_exists(\Sabre\TestUtil::SABRE_TEMPDIR.'/testdb.sqlite')) { + unlink(\Sabre\TestUtil::SABRE_TEMPDIR.'/testdb.sqlite'); } - if (file_exists(SABRE_TEMPDIR.'/testdb.sqlite')) { - unlink(SABRE_TEMPDIR.'/testdb.sqlite'); - } - - $pdo = new \PDO('sqlite:'.SABRE_TEMPDIR.'/testdb.sqlite'); + $pdo = new \PDO('sqlite:'.\Sabre\TestUtil::SABRE_TEMPDIR.'/testdb.sqlite'); $pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); $pdo->exec(<<markTestSkipped('SQLite driver is not available'); - } $this->backend = new Backend\MockScheduling(); $this->data = <<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'); + $this->deleteTree(\Sabre\TestUtil::SABRE_TEMPDIR, false); + file_put_contents(\Sabre\TestUtil::SABRE_TEMPDIR.'/test.txt', 'Test contents'); + mkdir(\Sabre\TestUtil::SABRE_TEMPDIR.'/dir'); + file_put_contents(\Sabre\TestUtil::SABRE_TEMPDIR.'/dir/child.txt', 'Child contents'); } public function teardown(): void { - $this->deleteTree(SABRE_TEMPDIR, false); + $this->deleteTree(\Sabre\TestUtil::SABRE_TEMPDIR, false); } protected function getRootNode() { - return new FS\Directory(SABRE_TEMPDIR); + return new FS\Directory(\Sabre\TestUtil::SABRE_TEMPDIR); } protected function getSanitizedBody() diff --git a/tests/Sabre/DAV/Auth/Backend/FileTest.php b/tests/Sabre/DAV/Auth/Backend/FileTest.php index 956768835f..46b253c79f 100644 --- a/tests/Sabre/DAV/Auth/Backend/FileTest.php +++ b/tests/Sabre/DAV/Auth/Backend/FileTest.php @@ -8,8 +8,8 @@ class FileTest extends \PHPUnit\Framework\TestCase { public function teardown(): void { - if (file_exists(SABRE_TEMPDIR.'/filebackend')) { - unlink(SABRE_TEMPDIR.'/filebackend'); + if (file_exists(\Sabre\TestUtil::SABRE_TEMPDIR.'/filebackend')) { + unlink(\Sabre\TestUtil::SABRE_TEMPDIR.'/filebackend'); } } @@ -22,15 +22,15 @@ public function testConstruct() public function testLoadFileBroken() { $this->expectException('Sabre\DAV\Exception'); - file_put_contents(SABRE_TEMPDIR.'/backend', 'user:realm:hash'); - $file = new File(SABRE_TEMPDIR.'/backend'); + file_put_contents(\Sabre\TestUtil::SABRE_TEMPDIR.'/backend', 'user:realm:hash'); + $file = new File(\Sabre\TestUtil::SABRE_TEMPDIR.'/backend'); } public function testLoadFile() { - file_put_contents(SABRE_TEMPDIR.'/backend', 'user:realm:'.md5('user:realm:password')); + file_put_contents(\Sabre\TestUtil::SABRE_TEMPDIR.'/backend', 'user:realm:'.md5('user:realm:password')); $file = new File(); - $file->loadFile(SABRE_TEMPDIR.'/backend'); + $file->loadFile(\Sabre\TestUtil::SABRE_TEMPDIR.'/backend'); self::assertFalse($file->getDigestHash('realm', 'blabla')); self::assertEquals(md5('user:realm:password'), $file->getDigestHash('realm', 'user')); diff --git a/tests/Sabre/DAV/Browser/GuessContentTypeTest.php b/tests/Sabre/DAV/Browser/GuessContentTypeTest.php index e856127bb8..3da77f8b33 100644 --- a/tests/Sabre/DAV/Browser/GuessContentTypeTest.php +++ b/tests/Sabre/DAV/Browser/GuessContentTypeTest.php @@ -12,8 +12,8 @@ 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'); + file_put_contents(\Sabre\TestUtil::SABRE_TEMPDIR.'/somefile.jpg', 'blabla'); + file_put_contents(\Sabre\TestUtil::SABRE_TEMPDIR.'/somefile.hoi', 'blabla'); } public function tearDown(): void diff --git a/tests/Sabre/DAV/Browser/PluginTest.php b/tests/Sabre/DAV/Browser/PluginTest.php index ead458e27e..9e2cfd692e 100644 --- a/tests/Sabre/DAV/Browser/PluginTest.php +++ b/tests/Sabre/DAV/Browser/PluginTest.php @@ -146,7 +146,7 @@ public function testPostMkCol() 'Location' => ['/'], ], $this->response->getHeaders()); - self::assertTrue(is_dir(SABRE_TEMPDIR.'/new_collection')); + self::assertTrue(is_dir(\Sabre\TestUtil::SABRE_TEMPDIR.'/new_collection')); } public function testGetAsset() diff --git a/tests/Sabre/DAV/ClientMock.php b/tests/Sabre/DAV/ClientMock.php index 7d787744a1..ab4675f8b9 100644 --- a/tests/Sabre/DAV/ClientMock.php +++ b/tests/Sabre/DAV/ClientMock.php @@ -13,7 +13,7 @@ class ClientMock extends Client public $response; public $url; - public $curlSettings; + public array $curlSettings; /** * Just making this method public. diff --git a/tests/Sabre/DAV/DbTestHelperTrait.php b/tests/Sabre/DAV/DbTestHelperTrait.php index 007a40f924..6fee5e2f94 100644 --- a/tests/Sabre/DAV/DbTestHelperTrait.php +++ b/tests/Sabre/DAV/DbTestHelperTrait.php @@ -6,6 +6,7 @@ use PDO; use PDOException; +use Sabre\TestUtil; class DbCache { @@ -44,13 +45,16 @@ public function getDb() try { switch ($this->driver) { case 'mysql': - $pdo = new PDO(SABRE_MYSQLDSN, SABRE_MYSQLUSER, SABRE_MYSQLPASS); + $dsn = getenv('SABRE_MYSQLDSN'); + $user = getenv('SABRE_MYSQLUSER'); + $pass = getenv('SABRE_MYSQLPASS'); + $pdo = new PDO($dsn, $user, $pass); break; case 'sqlite': - $pdo = new \PDO('sqlite:'.SABRE_TEMPDIR.'/testdb'); + $pdo = new PDO('sqlite:'.TestUtil::SABRE_TEMPDIR.'/testdb'); break; case 'pgsql': - $pdo = new \PDO(SABRE_PGSQLDSN); + $pdo = new PDO(getenv('SABRE_PGSQLDSN')); $version = $pdo->query('SELECT VERSION()')->fetchColumn(); preg_match('|([0-9\.]){5,}|', $version, $matches); $version = $matches[0]; @@ -65,7 +69,7 @@ public function getDb() $this->markTestSkipped($this->driver.' was not recognised'); } - $pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); + $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } catch (PDOException $e) { $this->markTestSkipped($this->driver.' was not enabled or not correctly configured. Error message: '.$e->getMessage()); } @@ -127,7 +131,7 @@ public function tearDown(): void case 'sqlite': // Recreating sqlite, just in case unset(DbCache::$cache[$this->driver]); - unlink(SABRE_TEMPDIR.'/testdb'); + unlink(TestUtil::SABRE_TEMPDIR.'/testdb'); } } } diff --git a/tests/Sabre/DAV/FSExt/DirectoryTest.php b/tests/Sabre/DAV/FSExt/DirectoryTest.php index 5c9efc8e08..aecd9580f5 100644 --- a/tests/Sabre/DAV/FSExt/DirectoryTest.php +++ b/tests/Sabre/DAV/FSExt/DirectoryTest.php @@ -8,13 +8,13 @@ class DirectoryTest extends \PHPUnit\Framework\TestCase { public function create() { - return new Directory(SABRE_TEMPDIR); + return new Directory(\Sabre\TestUtil::SABRE_TEMPDIR); } public function testCreate() { $dir = $this->create(); - self::assertEquals(basename(SABRE_TEMPDIR), $dir->getName()); + self::assertEquals(basename(\Sabre\TestUtil::SABRE_TEMPDIR), $dir->getName()); } public function testChildExistDot() diff --git a/tests/Sabre/DAV/FSExt/FileTest.php b/tests/Sabre/DAV/FSExt/FileTest.php index c5aa82b577..db050b2f39 100644 --- a/tests/Sabre/DAV/FSExt/FileTest.php +++ b/tests/Sabre/DAV/FSExt/FileTest.php @@ -8,7 +8,7 @@ class FileTest extends \PHPUnit\Framework\TestCase { public function setup(): void { - file_put_contents(SABRE_TEMPDIR.'/file.txt', 'Contents'); + file_put_contents(\Sabre\TestUtil::SABRE_TEMPDIR.'/file.txt', 'Contents'); } public function teardown(): void @@ -18,11 +18,11 @@ public function teardown(): void public function testPut() { - $filename = SABRE_TEMPDIR.'/file.txt'; + $filename = \Sabre\TestUtil::SABRE_TEMPDIR.'/file.txt'; $file = new File($filename); $result = $file->put('New contents'); - self::assertEquals('New contents', file_get_contents(SABRE_TEMPDIR.'/file.txt')); + self::assertEquals('New contents', file_get_contents(\Sabre\TestUtil::SABRE_TEMPDIR.'/file.txt')); self::assertEquals( '"'. sha1( @@ -36,38 +36,38 @@ public function testPut() public function testRangeAppend() { - $file = new File(SABRE_TEMPDIR.'/file.txt'); + $file = new File(\Sabre\TestUtil::SABRE_TEMPDIR.'/file.txt'); $file->put('0000000'); $file->patch('111', 1); - self::assertEquals('0000000111', file_get_contents(SABRE_TEMPDIR.'/file.txt')); + self::assertEquals('0000000111', file_get_contents(\Sabre\TestUtil::SABRE_TEMPDIR.'/file.txt')); } public function testRangeOffset() { - $file = new File(SABRE_TEMPDIR.'/file.txt'); + $file = new File(\Sabre\TestUtil::SABRE_TEMPDIR.'/file.txt'); $file->put('0000000'); $file->patch('111', 2, 3); - self::assertEquals('0001110', file_get_contents(SABRE_TEMPDIR.'/file.txt')); + self::assertEquals('0001110', file_get_contents(\Sabre\TestUtil::SABRE_TEMPDIR.'/file.txt')); } public function testRangeOffsetEnd() { - $file = new File(SABRE_TEMPDIR.'/file.txt'); + $file = new File(\Sabre\TestUtil::SABRE_TEMPDIR.'/file.txt'); $file->put('0000000'); $file->patch('11', 3, -4); - self::assertEquals('0001100', file_get_contents(SABRE_TEMPDIR.'/file.txt')); + self::assertEquals('0001100', file_get_contents(\Sabre\TestUtil::SABRE_TEMPDIR.'/file.txt')); } public function testRangeOffsetDefault() { - $file = new File(SABRE_TEMPDIR.'/file.txt'); + $file = new File(\Sabre\TestUtil::SABRE_TEMPDIR.'/file.txt'); $file->put('0000000'); $file->patch('11', 0); - self::assertEquals('000000011', file_get_contents(SABRE_TEMPDIR.'/file.txt')); + self::assertEquals('000000011', file_get_contents(\Sabre\TestUtil::SABRE_TEMPDIR.'/file.txt')); } public function testRangeStream() @@ -76,30 +76,30 @@ public function testRangeStream() fwrite($stream, '222'); rewind($stream); - $file = new File(SABRE_TEMPDIR.'/file.txt'); + $file = new File(\Sabre\TestUtil::SABRE_TEMPDIR.'/file.txt'); $file->put('0000000'); $file->patch($stream, 2, 3); - self::assertEquals('0002220', file_get_contents(SABRE_TEMPDIR.'/file.txt')); + self::assertEquals('0002220', file_get_contents(\Sabre\TestUtil::SABRE_TEMPDIR.'/file.txt')); } public function testGet() { - $file = new File(SABRE_TEMPDIR.'/file.txt'); + $file = new File(\Sabre\TestUtil::SABRE_TEMPDIR.'/file.txt'); self::assertEquals('Contents', stream_get_contents($file->get())); } public function testDelete() { - $file = new File(SABRE_TEMPDIR.'/file.txt'); + $file = new File(\Sabre\TestUtil::SABRE_TEMPDIR.'/file.txt'); $file->delete(); - self::assertFalse(file_exists(SABRE_TEMPDIR.'/file.txt')); + self::assertFalse(file_exists(\Sabre\TestUtil::SABRE_TEMPDIR.'/file.txt')); } public function testGetETag() { - $filename = SABRE_TEMPDIR.'/file.txt'; + $filename = \Sabre\TestUtil::SABRE_TEMPDIR.'/file.txt'; $file = new File($filename); self::assertEquals( '"'. @@ -114,13 +114,13 @@ public function testGetETag() public function testGetContentType() { - $file = new File(SABRE_TEMPDIR.'/file.txt'); + $file = new File(\Sabre\TestUtil::SABRE_TEMPDIR.'/file.txt'); self::assertNull($file->getContentType()); } public function testGetSize() { - $file = new File(SABRE_TEMPDIR.'/file.txt'); + $file = new File(\Sabre\TestUtil::SABRE_TEMPDIR.'/file.txt'); self::assertEquals(8, $file->getSize()); } } diff --git a/tests/Sabre/DAV/Issue33Test.php b/tests/Sabre/DAV/Issue33Test.php index 6bdb68b2d9..f9598f1529 100644 --- a/tests/Sabre/DAV/Issue33Test.php +++ b/tests/Sabre/DAV/Issue33Test.php @@ -37,8 +37,8 @@ public function testCopyMoveInfo() public function testTreeMove() { - mkdir(SABRE_TEMPDIR.'/issue33'); - $dir = new FS\Directory(SABRE_TEMPDIR.'/issue33'); + mkdir(\Sabre\TestUtil::SABRE_TEMPDIR.'/issue33'); + $dir = new FS\Directory(\Sabre\TestUtil::SABRE_TEMPDIR.'/issue33'); $dir->createDirectory('bar'); @@ -73,8 +73,8 @@ public function testEverything() $response = new HTTP\ResponseMock(); // Server setup - mkdir(SABRE_TEMPDIR.'/issue33'); - $dir = new FS\Directory(SABRE_TEMPDIR.'/issue33'); + mkdir(\Sabre\TestUtil::SABRE_TEMPDIR.'/issue33'); + $dir = new FS\Directory(\Sabre\TestUtil::SABRE_TEMPDIR.'/issue33'); $dir->createDirectory('bar'); @@ -88,6 +88,6 @@ public function testEverything() $server->sapi = new HTTP\SapiMock(); $server->exec(); - self::assertTrue(file_exists(SABRE_TEMPDIR.'/issue33/'.urldecode('%C3%A0fo%C3%B3'))); + self::assertTrue(file_exists(\Sabre\TestUtil::SABRE_TEMPDIR.'/issue33/'.urldecode('%C3%A0fo%C3%B3'))); } } diff --git a/tests/Sabre/DAV/Locks/Backend/FileTest.php b/tests/Sabre/DAV/Locks/Backend/FileTest.php index 57a3255c71..f96c09e282 100644 --- a/tests/Sabre/DAV/Locks/Backend/FileTest.php +++ b/tests/Sabre/DAV/Locks/Backend/FileTest.php @@ -9,7 +9,7 @@ class FileTest extends AbstractTest public function getBackend() { \Sabre\TestUtil::clearTempDir(); - $backend = new File(SABRE_TEMPDIR.'/lockdb'); + $backend = new File(\Sabre\TestUtil::SABRE_TEMPDIR.'/lockdb'); return $backend; } diff --git a/tests/Sabre/DAV/Locks/MSWordTest.php b/tests/Sabre/DAV/Locks/MSWordTest.php index d16782322e..2fb9aeb2e7 100644 --- a/tests/Sabre/DAV/Locks/MSWordTest.php +++ b/tests/Sabre/DAV/Locks/MSWordTest.php @@ -16,12 +16,12 @@ public function teardown(): void public function testLockEtc() { - mkdir(SABRE_TEMPDIR.'/mstest'); - $tree = new DAV\FS\Directory(SABRE_TEMPDIR.'/mstest'); + mkdir(\Sabre\TestUtil::SABRE_TEMPDIR.'/mstest'); + $tree = new DAV\FS\Directory(\Sabre\TestUtil::SABRE_TEMPDIR.'/mstest'); $server = new DAV\Server($tree); $server->debugExceptions = true; - $locksBackend = new Backend\File(SABRE_TEMPDIR.'/locksdb'); + $locksBackend = new Backend\File(\Sabre\TestUtil::SABRE_TEMPDIR.'/locksdb'); $locksPlugin = new Plugin($locksBackend); $server->addPlugin($locksPlugin); diff --git a/tests/Sabre/DAV/Locks/Plugin2Test.php b/tests/Sabre/DAV/Locks/Plugin2Test.php index ddd634c234..9548363e9d 100644 --- a/tests/Sabre/DAV/Locks/Plugin2Test.php +++ b/tests/Sabre/DAV/Locks/Plugin2Test.php @@ -12,7 +12,7 @@ class Plugin2Test extends \Sabre\DAVServerTest public function setUpTree() { - $this->tree = new \Sabre\DAV\FS\Directory(SABRE_TEMPDIR); + $this->tree = new \Sabre\DAV\FS\Directory(\Sabre\TestUtil::SABRE_TEMPDIR); } public function teardown(): void diff --git a/tests/Sabre/DAV/Locks/PluginTest.php b/tests/Sabre/DAV/Locks/PluginTest.php index fbfb758557..70530d2f53 100644 --- a/tests/Sabre/DAV/Locks/PluginTest.php +++ b/tests/Sabre/DAV/Locks/PluginTest.php @@ -17,7 +17,7 @@ class PluginTest extends DAV\AbstractServer public function setup(): void { parent::setUp(); - $locksBackend = new Backend\File(SABRE_TEMPDIR.'/locksdb'); + $locksBackend = new Backend\File(\Sabre\TestUtil::SABRE_TEMPDIR.'/locksdb'); $locksPlugin = new Plugin($locksBackend); $this->server->addPlugin($locksPlugin); $this->locksPlugin = $locksPlugin; @@ -853,10 +853,10 @@ public function testPutWithIncorrectETag() public function testPutWithCorrectETag() { // We need an ETag-enabled file node. - $tree = new DAV\Tree(new DAV\FSExt\Directory(SABRE_TEMPDIR)); + $tree = new DAV\Tree(new DAV\FSExt\Directory(\Sabre\TestUtil::SABRE_TEMPDIR)); $this->server->tree = $tree; - $filename = SABRE_TEMPDIR.'/test.txt'; + $filename = \Sabre\TestUtil::SABRE_TEMPDIR.'/test.txt'; $etag = sha1( fileinode($filename). filesize($filename). diff --git a/tests/Sabre/DAV/ObjectTreeTest.php b/tests/Sabre/DAV/ObjectTreeTest.php index 6173e54247..682a8c38cd 100644 --- a/tests/Sabre/DAV/ObjectTreeTest.php +++ b/tests/Sabre/DAV/ObjectTreeTest.php @@ -11,11 +11,11 @@ class ObjectTreeTest extends \PHPUnit\Framework\TestCase 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'); + mkdir(\Sabre\TestUtil::SABRE_TEMPDIR.'/root'); + mkdir(\Sabre\TestUtil::SABRE_TEMPDIR.'/root/subdir'); + file_put_contents(\Sabre\TestUtil::SABRE_TEMPDIR.'/root/file.txt', 'contents'); + file_put_contents(\Sabre\TestUtil::SABRE_TEMPDIR.'/root/subdir/subfile.txt', 'subcontents'); + $rootNode = new FSExt\Directory(\Sabre\TestUtil::SABRE_TEMPDIR.'/root'); $this->tree = new Tree($rootNode); } @@ -39,8 +39,8 @@ public function testGetSubDir() public function testCopyFile() { $this->tree->copy('file.txt', 'file2.txt'); - self::assertTrue(file_exists(SABRE_TEMPDIR.'/root/file2.txt')); - self::assertEquals('contents', file_get_contents(SABRE_TEMPDIR.'/root/file2.txt')); + self::assertTrue(file_exists(\Sabre\TestUtil::SABRE_TEMPDIR.'/root/file2.txt')); + self::assertEquals('contents', file_get_contents(\Sabre\TestUtil::SABRE_TEMPDIR.'/root/file2.txt')); } /** @@ -49,9 +49,9 @@ public function testCopyFile() public function testCopyDirectory() { $this->tree->copy('subdir', 'subdir2'); - self::assertTrue(file_exists(SABRE_TEMPDIR.'/root/subdir2')); - self::assertTrue(file_exists(SABRE_TEMPDIR.'/root/subdir2/subfile.txt')); - self::assertEquals('subcontents', file_get_contents(SABRE_TEMPDIR.'/root/subdir2/subfile.txt')); + self::assertTrue(file_exists(\Sabre\TestUtil::SABRE_TEMPDIR.'/root/subdir2')); + self::assertTrue(file_exists(\Sabre\TestUtil::SABRE_TEMPDIR.'/root/subdir2/subfile.txt')); + self::assertEquals('subcontents', file_get_contents(\Sabre\TestUtil::SABRE_TEMPDIR.'/root/subdir2/subfile.txt')); } /** @@ -60,9 +60,9 @@ public function testCopyDirectory() public function testMoveFile() { $this->tree->move('file.txt', 'file2.txt'); - self::assertTrue(file_exists(SABRE_TEMPDIR.'/root/file2.txt')); - self::assertFalse(file_exists(SABRE_TEMPDIR.'/root/file.txt')); - self::assertEquals('contents', file_get_contents(SABRE_TEMPDIR.'/root/file2.txt')); + self::assertTrue(file_exists(\Sabre\TestUtil::SABRE_TEMPDIR.'/root/file2.txt')); + self::assertFalse(file_exists(\Sabre\TestUtil::SABRE_TEMPDIR.'/root/file.txt')); + self::assertEquals('contents', file_get_contents(\Sabre\TestUtil::SABRE_TEMPDIR.'/root/file2.txt')); } /** @@ -71,9 +71,9 @@ public function testMoveFile() public function testMoveFileNewParent() { $this->tree->move('file.txt', 'subdir/file2.txt'); - self::assertTrue(file_exists(SABRE_TEMPDIR.'/root/subdir/file2.txt')); - self::assertFalse(file_exists(SABRE_TEMPDIR.'/root/file.txt')); - self::assertEquals('contents', file_get_contents(SABRE_TEMPDIR.'/root/subdir/file2.txt')); + self::assertTrue(file_exists(\Sabre\TestUtil::SABRE_TEMPDIR.'/root/subdir/file2.txt')); + self::assertFalse(file_exists(\Sabre\TestUtil::SABRE_TEMPDIR.'/root/file.txt')); + self::assertEquals('contents', file_get_contents(\Sabre\TestUtil::SABRE_TEMPDIR.'/root/subdir/file2.txt')); } /** @@ -82,9 +82,9 @@ public function testMoveFileNewParent() public function testMoveDirectory() { $this->tree->move('subdir', 'subdir2'); - self::assertTrue(file_exists(SABRE_TEMPDIR.'/root/subdir2')); - self::assertTrue(file_exists(SABRE_TEMPDIR.'/root/subdir2/subfile.txt')); - self::assertFalse(file_exists(SABRE_TEMPDIR.'/root/subdir')); - self::assertEquals('subcontents', file_get_contents(SABRE_TEMPDIR.'/root/subdir2/subfile.txt')); + self::assertTrue(file_exists(\Sabre\TestUtil::SABRE_TEMPDIR.'/root/subdir2')); + self::assertTrue(file_exists(\Sabre\TestUtil::SABRE_TEMPDIR.'/root/subdir2/subfile.txt')); + self::assertFalse(file_exists(\Sabre\TestUtil::SABRE_TEMPDIR.'/root/subdir')); + self::assertEquals('subcontents', file_get_contents(\Sabre\TestUtil::SABRE_TEMPDIR.'/root/subdir2/subfile.txt')); } } diff --git a/tests/Sabre/DAV/PartialUpdate/SpecificationTest.php b/tests/Sabre/DAV/PartialUpdate/SpecificationTest.php index 48e6c91490..f92c475071 100644 --- a/tests/Sabre/DAV/PartialUpdate/SpecificationTest.php +++ b/tests/Sabre/DAV/PartialUpdate/SpecificationTest.php @@ -21,7 +21,7 @@ class SpecificationTest extends \PHPUnit\Framework\TestCase public function setup(): void { $tree = [ - new File(SABRE_TEMPDIR.'/foobar.txt'), + new File(\Sabre\TestUtil::SABRE_TEMPDIR.'/foobar.txt'), ]; $server = new Server($tree); $server->debugExceptions = true; @@ -66,7 +66,7 @@ public function testUpdateRange($headerValue, $httpStatus, $endResult, $contentL self::assertEquals($httpStatus, $this->server->httpResponse->status, 'Incorrect http status received: '.$this->server->httpResponse->body); if (!is_null($endResult)) { - self::assertEquals($endResult, file_get_contents(SABRE_TEMPDIR.'/foobar.txt')); + self::assertEquals($endResult, file_get_contents(\Sabre\TestUtil::SABRE_TEMPDIR.'/foobar.txt')); } } diff --git a/tests/Sabre/DAV/ServerPropsInfiniteDepthTest.php b/tests/Sabre/DAV/ServerPropsInfiniteDepthTest.php index 6e4cd900a2..db28680816 100644 --- a/tests/Sabre/DAV/ServerPropsInfiniteDepthTest.php +++ b/tests/Sabre/DAV/ServerPropsInfiniteDepthTest.php @@ -10,28 +10,28 @@ class ServerPropsInfiniteDepthTest extends AbstractServer { protected function getRootNode() { - return new FSExt\Directory(SABRE_TEMPDIR); + return new FSExt\Directory(\Sabre\TestUtil::SABRE_TEMPDIR); } public function setup(): void { - if (file_exists(SABRE_TEMPDIR.'../.sabredav')) { - unlink(SABRE_TEMPDIR.'../.sabredav'); + if (file_exists(\Sabre\TestUtil::SABRE_TEMPDIR.'../.sabredav')) { + unlink(\Sabre\TestUtil::SABRE_TEMPDIR.'../.sabredav'); } parent::setUp(); - file_put_contents(SABRE_TEMPDIR.'/test2.txt', 'Test contents2'); - mkdir(SABRE_TEMPDIR.'/col'); - mkdir(SABRE_TEMPDIR.'/col/col'); - file_put_contents(SABRE_TEMPDIR.'col/col/test.txt', 'Test contents'); - $this->server->addPlugin(new Locks\Plugin(new Locks\Backend\File(SABRE_TEMPDIR.'/.locksdb'))); + file_put_contents(\Sabre\TestUtil::SABRE_TEMPDIR.'/test2.txt', 'Test contents2'); + mkdir(\Sabre\TestUtil::SABRE_TEMPDIR.'/col'); + mkdir(\Sabre\TestUtil::SABRE_TEMPDIR.'/col/col'); + file_put_contents(\Sabre\TestUtil::SABRE_TEMPDIR.'col/col/test.txt', 'Test contents'); + $this->server->addPlugin(new Locks\Plugin(new Locks\Backend\File(\Sabre\TestUtil::SABRE_TEMPDIR.'/.locksdb'))); $this->server->enablePropfindDepthInfinity = true; } public function teardown(): void { parent::tearDown(); - if (file_exists(SABRE_TEMPDIR.'../.locksdb')) { - unlink(SABRE_TEMPDIR.'../.locksdb'); + if (file_exists(\Sabre\TestUtil::SABRE_TEMPDIR.'../.locksdb')) { + unlink(\Sabre\TestUtil::SABRE_TEMPDIR.'../.locksdb'); } } diff --git a/tests/Sabre/DAV/ServerPropsTest.php b/tests/Sabre/DAV/ServerPropsTest.php index 82338c2a54..6f4626f0fd 100644 --- a/tests/Sabre/DAV/ServerPropsTest.php +++ b/tests/Sabre/DAV/ServerPropsTest.php @@ -10,26 +10,26 @@ class ServerPropsTest extends AbstractServer { protected function getRootNode() { - return new FSExt\Directory(SABRE_TEMPDIR); + return new FSExt\Directory(\Sabre\TestUtil::SABRE_TEMPDIR); } public function setup(): void { - if (file_exists(SABRE_TEMPDIR.'../.sabredav')) { - unlink(SABRE_TEMPDIR.'../.sabredav'); + if (file_exists(\Sabre\TestUtil::SABRE_TEMPDIR.'../.sabredav')) { + unlink(\Sabre\TestUtil::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'))); + file_put_contents(\Sabre\TestUtil::SABRE_TEMPDIR.'/test2.txt', 'Test contents2'); + mkdir(\Sabre\TestUtil::SABRE_TEMPDIR.'/col'); + file_put_contents(\Sabre\TestUtil::SABRE_TEMPDIR.'col/test.txt', 'Test contents'); + $this->server->addPlugin(new Locks\Plugin(new Locks\Backend\File(\Sabre\TestUtil::SABRE_TEMPDIR.'/.locksdb'))); } public function teardown(): void { parent::tearDown(); - if (file_exists(SABRE_TEMPDIR.'../.locksdb')) { - unlink(SABRE_TEMPDIR.'../.locksdb'); + if (file_exists(\Sabre\TestUtil::SABRE_TEMPDIR.'../.locksdb')) { + unlink(\Sabre\TestUtil::SABRE_TEMPDIR.'../.locksdb'); } } diff --git a/tests/Sabre/DAV/TemporaryFileFilterTest.php b/tests/Sabre/DAV/TemporaryFileFilterTest.php index 560327ba60..95469141e5 100644 --- a/tests/Sabre/DAV/TemporaryFileFilterTest.php +++ b/tests/Sabre/DAV/TemporaryFileFilterTest.php @@ -11,7 +11,7 @@ class TemporaryFileFilterTest extends AbstractServer public function setup(): void { parent::setUp(); - $plugin = new TemporaryFileFilterPlugin(SABRE_TEMPDIR.'/tff'); + $plugin = new TemporaryFileFilterPlugin(\Sabre\TestUtil::SABRE_TEMPDIR.'/tff'); $this->server->addPlugin($plugin); } @@ -26,7 +26,7 @@ public function testPutNormal() self::assertEquals(201, $this->response->status); self::assertEquals('0', $this->response->getHeader('Content-Length')); - self::assertEquals('Testing new file', file_get_contents(SABRE_TEMPDIR.'/testput.txt')); + self::assertEquals('Testing new file', file_get_contents(\Sabre\TestUtil::SABRE_TEMPDIR.'/testput.txt')); } public function testPutTemp() @@ -43,7 +43,7 @@ public function testPutTemp() 'X-Sabre-Temp' => ['true'], ], $this->response->getHeaders()); - self::assertFalse(file_exists(SABRE_TEMPDIR.'/._testput.txt'), '._testput.txt should not exist in the regular file structure.'); + self::assertFalse(file_exists(\Sabre\TestUtil::SABRE_TEMPDIR.'/._testput.txt'), '._testput.txt should not exist in the regular file structure.'); } public function testPutTempIfNoneMatch() @@ -60,7 +60,7 @@ public function testPutTempIfNoneMatch() 'X-Sabre-Temp' => ['true'], ], $this->response->getHeaders()); - self::assertFalse(file_exists(SABRE_TEMPDIR.'/._testput.txt'), '._testput.txt should not exist in the regular file structure.'); + self::assertFalse(file_exists(\Sabre\TestUtil::SABRE_TEMPDIR.'/._testput.txt'), '._testput.txt should not exist in the regular file structure.'); $this->server->exec(); @@ -112,8 +112,8 @@ public function testGetWithBrowserPlugin() public function testLockNonExistant() { - mkdir(SABRE_TEMPDIR.'/locksdir'); - $locksBackend = new Locks\Backend\File(SABRE_TEMPDIR.'/locks'); + mkdir(\Sabre\TestUtil::SABRE_TEMPDIR.'/locksdir'); + $locksBackend = new Locks\Backend\File(\Sabre\TestUtil::SABRE_TEMPDIR.'/locks'); $locksPlugin = new Locks\Plugin($locksBackend); $this->server->addPlugin($locksPlugin); @@ -136,7 +136,7 @@ public function testLockNonExistant() self::assertTrue(1 === preg_match('/^$/', $this->response->getHeader('Lock-Token')), 'We did not get a valid Locktoken back ('.$this->response->getHeader('Lock-Token').')'); self::assertEquals('true', $this->response->getHeader('X-Sabre-Temp')); - self::assertFalse(file_exists(SABRE_TEMPDIR.'/._testlock.txt'), '._testlock.txt should not exist in the regular file structure.'); + self::assertFalse(file_exists(\Sabre\TestUtil::SABRE_TEMPDIR.'/._testlock.txt'), '._testlock.txt should not exist in the regular file structure.'); } public function testPutDelete() diff --git a/tests/Sabre/DAVACL/FS/CollectionTest.php b/tests/Sabre/DAVACL/FS/CollectionTest.php index 625309ec8f..989fc21981 100644 --- a/tests/Sabre/DAVACL/FS/CollectionTest.php +++ b/tests/Sabre/DAVACL/FS/CollectionTest.php @@ -4,23 +4,25 @@ namespace Sabre\DAVACL\FS; +use Sabre\TestUtil; + class CollectionTest extends FileTest { public function setup(): void { parent::setup(); - $this->path = SABRE_TEMPDIR; + $this->path = TestUtil::SABRE_TEMPDIR; $this->sut = new Collection($this->path, $this->acl, $this->owner); } public function teardown(): void { - \Sabre\TestUtil::clearTempDir(); + TestUtil::clearTempDir(); } public function testGetChildFile() { - file_put_contents(SABRE_TEMPDIR.'/file.txt', 'hello'); + file_put_contents(TestUtil::SABRE_TEMPDIR.'/file.txt', 'hello'); $child = $this->sut->getChild('file.txt'); self::assertInstanceOf('Sabre\\DAVACL\\FS\\File', $child); @@ -31,7 +33,7 @@ public function testGetChildFile() public function testGetChildDirectory() { - mkdir(SABRE_TEMPDIR.'/dir'); + mkdir(TestUtil::SABRE_TEMPDIR.'/dir'); $child = $this->sut->getChild('dir'); self::assertInstanceOf('Sabre\\DAVACL\\FS\\Collection', $child); diff --git a/tests/Sabre/DAVACL/FS/HomeCollectionTest.php b/tests/Sabre/DAVACL/FS/HomeCollectionTest.php index fbfcb2bfda..69f65ba90d 100644 --- a/tests/Sabre/DAVACL/FS/HomeCollectionTest.php +++ b/tests/Sabre/DAVACL/FS/HomeCollectionTest.php @@ -22,7 +22,7 @@ public function setup(): void { $principalBackend = new PrincipalBackend(); - $this->path = SABRE_TEMPDIR.'/home'; + $this->path = \Sabre\TestUtil::SABRE_TEMPDIR.'/home'; $this->sut = new HomeCollection($principalBackend, $this->path); $this->sut->collectionName = $this->name; diff --git a/tests/Sabre/HTTP/ResponseMock.php b/tests/Sabre/HTTP/ResponseMock.php index c5357928a3..0d968e178f 100644 --- a/tests/Sabre/HTTP/ResponseMock.php +++ b/tests/Sabre/HTTP/ResponseMock.php @@ -19,5 +19,5 @@ class ResponseMock extends Response * Making these public. */ public $body; - public $status; + public int $status; } diff --git a/tests/Sabre/HTTP/SapiMock.php b/tests/Sabre/HTTP/SapiMock.php index 4860030d01..c885078324 100644 --- a/tests/Sabre/HTTP/SapiMock.php +++ b/tests/Sabre/HTTP/SapiMock.php @@ -20,7 +20,7 @@ class SapiMock extends Sapi /** * Overriding this so nothing is ever echo'd. */ - public static function sendResponse(ResponseInterface $response) + public static function sendResponse(ResponseInterface $response): void { ++self::$sent; } diff --git a/tests/Sabre/TestUtil.php b/tests/Sabre/TestUtil.php index 4e7ca2fc45..f1a768e6c1 100644 --- a/tests/Sabre/TestUtil.php +++ b/tests/Sabre/TestUtil.php @@ -6,15 +6,17 @@ class TestUtil { + public const SABRE_TEMPDIR = __DIR__.'/../temp/'; + /** * This function deletes all the contents of the temporary directory. */ - public static function clearTempDir() + public static function clearTempDir(): void { - self::deleteTree(SABRE_TEMPDIR, false); + self::deleteTree(self::SABRE_TEMPDIR, false); } - private static function deleteTree($path, $deleteRoot = true) + private static function deleteTree($path, $deleteRoot = true): void { foreach (scandir($path) as $node) { if ('.' == $node || '..' == $node) { @@ -31,36 +33,4 @@ private static function deleteTree($path, $deleteRoot = true) 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/tests/bootstrap.php b/tests/bootstrap.php index d158053825..fec0e72410 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -2,6 +2,9 @@ declare(strict_types=1); +use Sabre\DAV\Server; +use Sabre\TestUtil; + set_include_path(__DIR__.'/../lib/'.PATH_SEPARATOR.__DIR__.PATH_SEPARATOR.get_include_path()); $autoLoader = include __DIR__.'/../vendor/autoload.php'; @@ -16,49 +19,11 @@ 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); - } + Server::$streamMultiStatus = true; } -if (!file_exists(SABRE_TEMPDIR)) { - mkdir(SABRE_TEMPDIR); +if (!file_exists(TestUtil::SABRE_TEMPDIR)) { + mkdir(TestUtil::SABRE_TEMPDIR); } if (file_exists('.sabredav')) { unlink('.sabredav'); diff --git a/tests/phpunit.xml b/tests/phpunit.xml index b836b59964..9186dfc307 100644 --- a/tests/phpunit.xml +++ b/tests/phpunit.xml @@ -1,41 +1,33 @@ - - + + + + ../lib/ + + - - ../vendor/sabre/http/tests/HTTP - - - - Sabre/DAV - - - Sabre/DAVACL - - - Sabre/CalDAV - - - Sabre/CardDAV - + + ../vendor/sabre/http/tests/HTTP + + + Sabre/DAV + + + Sabre/DAVACL + + + Sabre/CalDAV + + + Sabre/CardDAV + - - - - ../lib/ - - - + + + + From 34bb87459428ca30eab9aad2d07726c22e8c399f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= <1005065+DeepDiver1975@users.noreply.github.com> Date: Thu, 9 Nov 2023 12:30:42 +0100 Subject: [PATCH 2/3] ci: fix phpunit call --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f973f5d73d..d2a6bbdfd7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -109,7 +109,7 @@ jobs: - name: PHPUnit if: matrix.streaming == false - run: vendor/bin/phpunit --verbose --configuration tests/phpunit.xml --coverage-clover=coverage.xml + run: vendor/bin/phpunit --verbose --configuration tests/phpunit.xml --coverage-clover=coverage.xml tests env: SABRE_MYSQLUSER: root SABRE_MYSQLPASS: root @@ -118,7 +118,7 @@ jobs: - name: PHPUnit (with streaming) if: matrix.streaming == true - run: vendor/bin/phpunit --verbose --configuration tests/phpunit.xml --coverage-clover=coverage.xml + run: vendor/bin/phpunit --verbose --configuration tests/phpunit.xml --coverage-clover=coverage.xml tests env: SABRE_MYSQLUSER: root SABRE_MYSQLPASS: root From 9296cf272b2c913cdbbdc06d0bcd8192d6a21eb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= <1005065+DeepDiver1975@users.noreply.github.com> Date: Thu, 9 Nov 2023 12:49:02 +0100 Subject: [PATCH 3/3] fix: phpunit deprecation on abstract test classes --- ...Test.php => AbstractDAVServerTestCase.php} | 18 ++-- ...actPDOTest.php => AbstractPDOTestCase.php} | 92 ++++++++++--------- tests/Sabre/CalDAV/Backend/PDOMySQLTest.php | 2 +- tests/Sabre/CalDAV/Backend/PDOPgSqlTest.php | 2 +- tests/Sabre/CalDAV/Backend/PDOSqliteTest.php | 2 +- .../ExpandEventsDTSTARTandDTENDTest.php | 2 +- .../ExpandEventsDTSTARTandDTENDbyDayTest.php | 2 +- .../CalDAV/ExpandEventsDoubleEventsTest.php | 2 +- .../CalDAV/ExpandEventsFloatingTimeTest.php | 2 +- .../Sabre/CalDAV/GetEventsByTimerangeTest.php | 2 +- tests/Sabre/CalDAV/ICSExportPluginTest.php | 2 +- tests/Sabre/CalDAV/Issue203Test.php | 2 +- tests/Sabre/CalDAV/Issue205Test.php | 2 +- tests/Sabre/CalDAV/Issue211Test.php | 2 +- tests/Sabre/CalDAV/Issue220Test.php | 2 +- tests/Sabre/CalDAV/Issue228Test.php | 2 +- tests/Sabre/CalDAV/JCalTransformTest.php | 2 +- .../CalDAV/Schedule/DeliverNewEventTest.php | 2 +- .../Sabre/CalDAV/Schedule/OutboxPostTest.php | 2 +- .../Sabre/CalDAV/Schedule/PluginBasicTest.php | 2 +- .../CalDAV/Schedule/PluginPropertiesTest.php | 2 +- ...PluginPropertiesWithSharedCalendarTest.php | 2 +- .../CalDAV/Schedule/ScheduleDeliverTest.php | 2 +- tests/Sabre/CalDAV/SharingPluginTest.php | 4 +- .../Subscriptions/CreateSubscriptionTest.php | 2 +- .../CalDAV/Xml/Notification/InviteTest.php | 2 +- .../Xml/Property/AllowedSharingModesTest.php | 2 +- .../Xml/Property/EmailAddressSetTest.php | 4 +- .../Sabre/CalDAV/Xml/Property/InviteTest.php | 2 +- .../Property/ScheduleCalendarTranspTest.php | 2 +- .../SupportedCalendarComponentSetTest.php | 2 +- .../Property/SupportedCalendarDataTest.php | 2 +- .../Property/SupportedCollationSetTest.php | 2 +- .../Xml/Request/CalendarQueryReportTest.php | 4 +- .../CalDAV/Xml/Request/InviteReplyTest.php | 4 +- tests/Sabre/CalDAV/Xml/Request/ShareTest.php | 4 +- ...ginTest.php => AbstractPluginTestCase.php} | 14 +-- tests/Sabre/CardDAV/AddressBookQueryTest.php | 2 +- ...actPDOTest.php => AbstractPDOTestCase.php} | 6 +- tests/Sabre/CardDAV/Backend/PDOMySQLTest.php | 2 +- tests/Sabre/CardDAV/Backend/PDOPgSqlTest.php | 2 +- tests/Sabre/CardDAV/Backend/PDOSqliteTest.php | 2 +- tests/Sabre/CardDAV/MultiGetTest.php | 2 +- tests/Sabre/CardDAV/PluginTest.php | 8 +- .../CardDAV/SogoStripContentTypeTest.php | 2 +- tests/Sabre/CardDAV/VCFExportTest.php | 2 +- tests/Sabre/CardDAV/ValidateFilterTest.php | 2 +- .../Xml/Property/SupportedAddressDataTest.php | 2 +- .../Property/SupportedCollationSetTest.php | 2 +- .../Request/AddressBookMultiGetReportTest.php | 4 +- .../Request/AddressBookQueryReportTest.php | 4 +- ...tServer.php => AbstractServerTestCase.php} | 25 ++--- ...t.php => AbstractPDOBasicAuthTestCase.php} | 6 +- ...DOTest.php => AbstractPDOTestCaseCase.php} | 7 +- .../Auth/Backend/PDOBasicAuthSqliteTest.php | 2 +- tests/Sabre/DAV/Auth/Backend/PDOMySQLTest.php | 2 +- tests/Sabre/DAV/Auth/Backend/PDOPgSqlTest.php | 2 +- .../Sabre/DAV/Auth/Backend/PDOSqliteTest.php | 2 +- .../DAV/Browser/GuessContentTypeTest.php | 2 +- .../DAV/Browser/MapGetToPropFindTest.php | 2 +- tests/Sabre/DAV/Browser/PluginTest.php | 2 +- tests/Sabre/DAV/FSExt/ServerTest.php | 2 +- tests/Sabre/DAV/GetIfConditionsTest.php | 2 +- tests/Sabre/DAV/HTTPPreferParsingTest.php | 5 +- tests/Sabre/DAV/HttpCopyTest.php | 4 +- tests/Sabre/DAV/HttpDeleteTest.php | 4 +- tests/Sabre/DAV/HttpGetTest.php | 4 +- tests/Sabre/DAV/HttpHeadTest.php | 4 +- tests/Sabre/DAV/HttpMoveTest.php | 4 +- tests/Sabre/DAV/HttpPutTest.php | 4 +- ...MySQLTest.php => AbstractPDOMySQLTest.php} | 2 +- ...PgSqlTest.php => AbstractPDOPgSqlTest.php} | 2 +- ...liteTest.php => AbstractPDOSqliteTest.php} | 2 +- .../{PDOTest.php => AbstractPDOTestCase.php} | 2 +- ...{AbstractTest.php => AbstractTestCase.php} | 3 +- tests/Sabre/DAV/Locks/Backend/FileTest.php | 2 +- tests/Sabre/DAV/Locks/Plugin2Test.php | 2 +- tests/Sabre/DAV/Locks/PluginTest.php | 2 +- tests/Sabre/DAV/Mount/PluginTest.php | 2 +- tests/Sabre/DAV/PartialUpdate/PluginTest.php | 2 +- ...actPDOTest.php => AbstractPDOTestCase.php} | 6 +- .../PropertyStorage/Backend/PDOMysqlTest.php | 2 +- .../PropertyStorage/Backend/PDOPgSqlTest.php | 2 +- .../PropertyStorage/Backend/PDOSqliteTest.php | 2 +- .../Sabre/DAV/PropertyStorage/PluginTest.php | 2 +- tests/Sabre/DAV/ServerEventsTest.php | 2 +- tests/Sabre/DAV/ServerMKCOLTest.php | 2 +- tests/Sabre/DAV/ServerPluginTest.php | 4 +- .../DAV/ServerPropsInfiniteDepthTest.php | 2 +- tests/Sabre/DAV/ServerPropsTest.php | 2 +- tests/Sabre/DAV/ServerRangeTest.php | 2 +- tests/Sabre/DAV/ServerSimpleTest.php | 2 +- tests/Sabre/DAV/Sharing/PluginTest.php | 2 +- tests/Sabre/DAV/Sharing/ShareResourceTest.php | 2 +- tests/Sabre/DAV/Sync/PluginTest.php | 2 +- tests/Sabre/DAV/SyncTokenPropertyTest.php | 2 +- tests/Sabre/DAV/TemporaryFileFilterTest.php | 2 +- .../{XmlTest.php => AbstractXmlTestCase.php} | 3 +- tests/Sabre/DAV/Xml/Element/PropTest.php | 4 +- tests/Sabre/DAV/Xml/Element/ResponseTest.php | 2 +- tests/Sabre/DAV/Xml/Element/ShareeTest.php | 4 +- tests/Sabre/DAV/Xml/Property/HrefTest.php | 4 +- tests/Sabre/DAV/Xml/Property/InviteTest.php | 4 +- .../DAV/Xml/Property/LastModifiedTest.php | 4 +- .../Sabre/DAV/Xml/Property/LocalHrefTest.php | 4 +- .../DAV/Xml/Property/LockDiscoveryTest.php | 4 +- .../DAV/Xml/Property/ShareAccessTest.php | 4 +- .../Xml/Property/SupportedMethodSetTest.php | 4 +- .../Xml/Property/SupportedReportSetTest.php | 2 +- tests/Sabre/DAV/Xml/Request/PropFindTest.php | 4 +- tests/Sabre/DAV/Xml/Request/PropPatchTest.php | 4 +- .../DAV/Xml/Request/ShareResourceTest.php | 4 +- .../DAV/Xml/Request/SyncCollectionTest.php | 4 +- .../DAVACL/AclPrincipalPropSetReportTest.php | 2 +- ...actPDOTest.php => AbstractPDOTestCase.php} | 31 ++++--- .../DAVACL/PrincipalBackend/PDOMySQLTest.php | 2 +- .../DAVACL/PrincipalBackend/PDOPgSqlTest.php | 2 +- .../DAVACL/PrincipalBackend/PDOSqliteTest.php | 2 +- tests/Sabre/DAVACL/PrincipalMatchTest.php | 2 +- .../Request/AclPrincipalPropSetReportTest.php | 2 +- .../Xml/Request/PrincipalMatchReportTest.php | 4 +- tests/phpunit.xml | 3 - 122 files changed, 262 insertions(+), 237 deletions(-) rename tests/Sabre/{DAVServerTest.php => AbstractDAVServerTestCase.php} (96%) rename tests/Sabre/CalDAV/Backend/{AbstractPDOTest.php => AbstractPDOTestCase.php} (93%) rename tests/Sabre/CardDAV/{AbstractPluginTest.php => AbstractPluginTestCase.php} (76%) rename tests/Sabre/CardDAV/Backend/{AbstractPDOTest.php => AbstractPDOTestCase.php} (98%) rename tests/Sabre/DAV/{AbstractServer.php => AbstractServerTestCase.php} (66%) rename tests/Sabre/DAV/Auth/Backend/{AbstractPDOBasicAuthTest.php => AbstractPDOBasicAuthTestCase.php} (96%) rename tests/Sabre/DAV/Auth/Backend/{AbstractPDOTest.php => AbstractPDOTestCaseCase.php} (84%) rename tests/Sabre/DAV/Locks/Backend/{PDOMySQLTest.php => AbstractPDOMySQLTest.php} (65%) rename tests/Sabre/DAV/Locks/Backend/{PDOPgSqlTest.php => AbstractPDOPgSqlTest.php} (65%) rename tests/Sabre/DAV/Locks/Backend/{PDOSqliteTest.php => AbstractPDOSqliteTest.php} (65%) rename tests/Sabre/DAV/Locks/Backend/{PDOTest.php => AbstractPDOTestCase.php} (83%) rename tests/Sabre/DAV/Locks/Backend/{AbstractTest.php => AbstractTestCase.php} (98%) rename tests/Sabre/DAV/PropertyStorage/Backend/{AbstractPDOTest.php => AbstractPDOTestCase.php} (97%) rename tests/Sabre/DAV/Xml/{XmlTest.php => AbstractXmlTestCase.php} (92%) rename tests/Sabre/DAVACL/PrincipalBackend/{AbstractPDOTest.php => AbstractPDOTestCase.php} (88%) diff --git a/tests/Sabre/DAVServerTest.php b/tests/Sabre/AbstractDAVServerTestCase.php similarity index 96% rename from tests/Sabre/DAVServerTest.php rename to tests/Sabre/AbstractDAVServerTestCase.php index d9908be822..40dcb41dfa 100644 --- a/tests/Sabre/DAVServerTest.php +++ b/tests/Sabre/AbstractDAVServerTestCase.php @@ -4,6 +4,10 @@ namespace Sabre; +use PHPUnit\Framework\TestCase; +use Sabre\CalDAV\SharingPlugin; +use Sabre\DAV\Server; +use Sabre\DAV\Sharing\Plugin; use Sabre\HTTP\Request; use Sabre\HTTP\Response; @@ -17,7 +21,7 @@ * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License */ -abstract class DAVServerTest extends \PHPUnit\Framework\TestCase +abstract class AbstractDAVServerTestCase extends TestCase { protected $setupCalDAV = false; protected $setupCardDAV = false; @@ -43,7 +47,7 @@ abstract class DAVServerTest extends \PHPUnit\Framework\TestCase protected $carddavCards = []; /** - * @var \Sabre\DAV\Server + * @var Server */ protected $server; protected $tree = []; @@ -70,7 +74,7 @@ abstract class DAVServerTest extends \PHPUnit\Framework\TestCase protected $aclPlugin; /** - * @var \Sabre\CalDAV\SharingPlugin + * @var SharingPlugin */ protected $caldavSharingPlugin; @@ -99,7 +103,7 @@ abstract class DAVServerTest extends \PHPUnit\Framework\TestCase /** * Sharing plugin. * - * @var \Sabre\DAV\Sharing\Plugin + * @var Plugin */ protected $sharingPlugin; @@ -190,10 +194,10 @@ public function initializeEverything() * the returned response. If it doesn't match, we'll immediately fail * the test. * - * @param array|\Sabre\HTTP\Request $request - * @param int $expectedStatus + * @param array|Request $request + * @param int $expectedStatus * - * @return \Sabre\HTTP\Response + * @return Response */ public function request($request, $expectedStatus = null) { diff --git a/tests/Sabre/CalDAV/Backend/AbstractPDOTest.php b/tests/Sabre/CalDAV/Backend/AbstractPDOTestCase.php similarity index 93% rename from tests/Sabre/CalDAV/Backend/AbstractPDOTest.php rename to tests/Sabre/CalDAV/Backend/AbstractPDOTestCase.php index 769d215264..f25773e00f 100644 --- a/tests/Sabre/CalDAV/Backend/AbstractPDOTest.php +++ b/tests/Sabre/CalDAV/Backend/AbstractPDOTestCase.php @@ -4,12 +4,16 @@ namespace Sabre\CalDAV\Backend; +use DateTime; +use PHPUnit\Framework\TestCase; use Sabre\CalDAV; use Sabre\DAV; use Sabre\DAV\PropPatch; +use Sabre\DAV\Sharing\Plugin; use Sabre\DAV\Xml\Element\Sharee; +use Sabre\DAV\Xml\Property\Href; -abstract class AbstractPDOTest extends \PHPUnit\Framework\TestCase +abstract class AbstractPDOTestCase extends TestCase { use DAV\DbTestHelperTrait; @@ -64,7 +68,7 @@ public function testCreateCalendarAndFetch() '{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, + 'share-access' => Plugin::ACCESS_SHAREDOWNER, ]; self::assertIsArray($calendars); @@ -765,8 +769,8 @@ public function testCalendarQueryTimeRange() 'prop-filters' => [], 'is-not-defined' => false, 'time-range' => [ - 'start' => new \DateTime('20120103'), - 'end' => new \DateTime('20120104'), + 'start' => new DateTime('20120103'), + 'end' => new DateTime('20120104'), ], ], ], @@ -796,7 +800,7 @@ public function testCalendarQueryTimeRangeEndNull() 'prop-filters' => [], 'is-not-defined' => false, 'time-range' => [ - 'start' => new \DateTime('20120102'), + 'start' => new DateTime('20120102'), 'end' => null, ], ], @@ -827,7 +831,7 @@ public function testCalendarQueryTimeRangeNoEnd() 'prop-filters' => [], 'is-not-defined' => false, 'time-range' => [ - 'start' => new \DateTime('20120102'), + 'start' => new DateTime('20120102'), ], ], ], @@ -857,7 +861,7 @@ public function testCalendarQueryTimeRangeNoStart() 'prop-filters' => [], 'is-not-defined' => false, 'time-range' => [ - 'end' => new \DateTime('20120102'), + 'end' => new DateTime('20120102'), ], ], ], @@ -991,7 +995,7 @@ public function testGetChangesBadId() public function testCreateSubscriptions() { $props = [ - '{http://calendarserver.org/ns/}source' => new \Sabre\DAV\Xml\Property\Href('http://example.org/cal.ics'), + '{http://calendarserver.org/ns/}source' => new Href('http://example.org/cal.ics'), '{DAV:}displayname' => 'cal', '{http://apple.com/ns/ical/}refreshrate' => 'P1W', '{http://apple.com/ns/ical/}calendar-color' => '#FF00FFFF', @@ -1032,7 +1036,7 @@ public function testCreateSubscriptionFail() public function testUpdateSubscriptions() { $props = [ - '{http://calendarserver.org/ns/}source' => new \Sabre\DAV\Xml\Property\Href('http://example.org/cal.ics'), + '{http://calendarserver.org/ns/}source' => new Href('http://example.org/cal.ics'), '{DAV:}displayname' => 'cal', '{http://apple.com/ns/ical/}refreshrate' => 'P1W', '{http://apple.com/ns/ical/}calendar-color' => '#FF00FFFF', @@ -1046,7 +1050,7 @@ public function testUpdateSubscriptions() $newProps = [ '{DAV:}displayname' => 'new displayname', - '{http://calendarserver.org/ns/}source' => new \Sabre\DAV\Xml\Property\Href('http://example.org/cal2.ics'), + '{http://calendarserver.org/ns/}source' => new Href('http://example.org/cal2.ics'), ]; $propPatch = new DAV\PropPatch($newProps); @@ -1074,7 +1078,7 @@ public function testUpdateSubscriptions() public function testUpdateSubscriptionsFail() { $props = [ - '{http://calendarserver.org/ns/}source' => new \Sabre\DAV\Xml\Property\Href('http://example.org/cal.ics'), + '{http://calendarserver.org/ns/}source' => new Href('http://example.org/cal.ics'), '{DAV:}displayname' => 'cal', '{http://apple.com/ns/ical/}refreshrate' => 'P1W', '{http://apple.com/ns/ical/}calendar-color' => '#FF00FFFF', @@ -1088,7 +1092,7 @@ public function testUpdateSubscriptionsFail() $propPatch = new DAV\PropPatch([ '{DAV:}displayname' => 'new displayname', - '{http://calendarserver.org/ns/}source' => new \Sabre\DAV\Xml\Property\Href('http://example.org/cal2.ics'), + '{http://calendarserver.org/ns/}source' => new Href('http://example.org/cal2.ics'), '{DAV:}unknown' => 'foo', ]); @@ -1105,7 +1109,7 @@ public function testUpdateSubscriptionsFail() public function testDeleteSubscriptions() { $props = [ - '{http://calendarserver.org/ns/}source' => new \Sabre\DAV\Xml\Property\Href('http://example.org/cal.ics'), + '{http://calendarserver.org/ns/}source' => new Href('http://example.org/cal.ics'), '{DAV:}displayname' => 'cal', '{http://apple.com/ns/ical/}refreshrate' => 'P1W', '{http://apple.com/ns/ical/}calendar-color' => '#FF00FFFF', @@ -1119,7 +1123,7 @@ public function testDeleteSubscriptions() $newProps = [ '{DAV:}displayname' => 'new displayname', - '{http://calendarserver.org/ns/}source' => new \Sabre\DAV\Xml\Property\Href('http://example.org/cal2.ics'), + '{http://calendarserver.org/ns/}source' => new Href('http://example.org/cal2.ics'), ]; $backend->deleteSubscription(1); @@ -1213,8 +1217,8 @@ public function testGetInvites() new Sharee([ 'href' => 'principals/user1', 'principal' => 'principals/user1', - 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_SHAREDOWNER, - 'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_ACCEPTED, + 'access' => Plugin::ACCESS_SHAREDOWNER, + 'inviteStatus' => Plugin::INVITE_ACCEPTED, ]), ]; @@ -1250,8 +1254,8 @@ public function testUpdateInvites() $ownerSharee = new Sharee([ 'href' => 'principals/user1', 'principal' => 'principals/user1', - 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_SHAREDOWNER, - 'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_ACCEPTED, + 'access' => Plugin::ACCESS_SHAREDOWNER, + 'inviteStatus' => Plugin::INVITE_ACCEPTED, ]); // Add a new invite @@ -1261,8 +1265,8 @@ public function testUpdateInvites() new Sharee([ 'href' => 'mailto:user@example.org', 'principal' => 'principals/user2', - 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_READ, - 'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_ACCEPTED, + 'access' => Plugin::ACCESS_READ, + 'inviteStatus' => Plugin::INVITE_ACCEPTED, 'properties' => ['{DAV:}displayname' => 'User 2'], ]), ] @@ -1274,8 +1278,8 @@ public function testUpdateInvites() new Sharee([ 'href' => 'mailto:user@example.org', 'principal' => 'principals/user2', - 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_READ, - 'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_ACCEPTED, + 'access' => Plugin::ACCESS_READ, + 'inviteStatus' => Plugin::INVITE_ACCEPTED, 'properties' => [ '{DAV:}displayname' => 'User 2', ], @@ -1289,7 +1293,7 @@ public function testUpdateInvites() '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, + 'share-access' => Plugin::ACCESS_READ, 'read-only' => true, 'share-resource-uri' => '/ns/share/1', ]; @@ -1310,8 +1314,8 @@ public function testUpdateInvites() new Sharee([ 'href' => 'mailto:user@example.org', 'principal' => 'principals/user2', - 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_READWRITE, - 'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_ACCEPTED, + 'access' => Plugin::ACCESS_READWRITE, + 'inviteStatus' => Plugin::INVITE_ACCEPTED, ]), ] ); @@ -1322,8 +1326,8 @@ public function testUpdateInvites() new Sharee([ 'href' => 'mailto:user@example.org', 'principal' => 'principals/user2', - 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_READWRITE, - 'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_ACCEPTED, + 'access' => Plugin::ACCESS_READWRITE, + 'inviteStatus' => Plugin::INVITE_ACCEPTED, 'properties' => [ '{DAV:}displayname' => 'User 2', ], @@ -1337,7 +1341,7 @@ public function testUpdateInvites() [ new Sharee([ 'href' => 'mailto:user@example.org', - 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_NOACCESS, + 'access' => Plugin::ACCESS_NOACCESS, ]), ] ); @@ -1354,7 +1358,7 @@ public function testUpdateInvites() [ new Sharee([ 'href' => 'principals/user2', - 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_NOACCESS, + 'access' => Plugin::ACCESS_NOACCESS, ]), ] ); @@ -1364,8 +1368,8 @@ public function testUpdateInvites() new Sharee([ 'href' => 'principals/user1', 'principal' => 'principals/user1', - 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_SHAREDOWNER, - 'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_ACCEPTED, + 'access' => Plugin::ACCESS_SHAREDOWNER, + 'inviteStatus' => Plugin::INVITE_ACCEPTED, ]), ]; self::assertEquals($expected, $result); @@ -1399,8 +1403,8 @@ public function testUpdateInvitesNoPrincipal() $ownerSharee = new Sharee([ 'href' => 'principals/user1', 'principal' => 'principals/user1', - 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_SHAREDOWNER, - 'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_ACCEPTED, + 'access' => Plugin::ACCESS_SHAREDOWNER, + 'inviteStatus' => Plugin::INVITE_ACCEPTED, ]); // Add a new invite @@ -1410,8 +1414,8 @@ public function testUpdateInvitesNoPrincipal() new Sharee([ 'href' => 'mailto:user@example.org', 'principal' => null, - 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_READ, - 'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_ACCEPTED, + 'access' => Plugin::ACCESS_READ, + 'inviteStatus' => Plugin::INVITE_ACCEPTED, 'properties' => ['{DAV:}displayname' => 'User 2'], ]), ] @@ -1423,8 +1427,8 @@ public function testUpdateInvitesNoPrincipal() new Sharee([ 'href' => 'mailto:user@example.org', 'principal' => null, - 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_READ, - 'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_INVALID, + 'access' => Plugin::ACCESS_READ, + 'inviteStatus' => Plugin::INVITE_INVALID, 'properties' => [ '{DAV:}displayname' => 'User 2', ], @@ -1447,8 +1451,8 @@ public function testDeleteSharedCalendar() $ownerSharee = new Sharee([ 'href' => 'principals/user1', 'principal' => 'principals/user1', - 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_SHAREDOWNER, - 'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_ACCEPTED, + 'access' => Plugin::ACCESS_SHAREDOWNER, + 'inviteStatus' => Plugin::INVITE_ACCEPTED, ]); // Add a new invite @@ -1458,8 +1462,8 @@ public function testDeleteSharedCalendar() new Sharee([ 'href' => 'mailto:user@example.org', 'principal' => 'principals/user2', - 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_READ, - 'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_ACCEPTED, + 'access' => Plugin::ACCESS_READ, + 'inviteStatus' => Plugin::INVITE_ACCEPTED, 'properties' => ['{DAV:}displayname' => 'User 2'], ]), ] @@ -1470,7 +1474,7 @@ public function testDeleteSharedCalendar() '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, + 'share-access' => Plugin::ACCESS_READ, 'read-only' => true, 'share-resource-uri' => '/ns/share/1', ]; @@ -1497,8 +1501,8 @@ public function testDeleteSharedCalendar() new Sharee([ 'href' => 'principals/user1', 'principal' => 'principals/user1', - 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_SHAREDOWNER, - 'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_ACCEPTED, + 'access' => Plugin::ACCESS_SHAREDOWNER, + 'inviteStatus' => Plugin::INVITE_ACCEPTED, ]), ]; self::assertEquals($expected, $result); diff --git a/tests/Sabre/CalDAV/Backend/PDOMySQLTest.php b/tests/Sabre/CalDAV/Backend/PDOMySQLTest.php index 66388def4f..d0ba2f31a0 100644 --- a/tests/Sabre/CalDAV/Backend/PDOMySQLTest.php +++ b/tests/Sabre/CalDAV/Backend/PDOMySQLTest.php @@ -4,7 +4,7 @@ namespace Sabre\CalDAV\Backend; -class PDOMySQLTest extends AbstractPDOTest +class PDOMySQLTest extends AbstractPDOTestCase { public $driver = 'mysql'; } diff --git a/tests/Sabre/CalDAV/Backend/PDOPgSqlTest.php b/tests/Sabre/CalDAV/Backend/PDOPgSqlTest.php index feffedfa49..30d26695c0 100644 --- a/tests/Sabre/CalDAV/Backend/PDOPgSqlTest.php +++ b/tests/Sabre/CalDAV/Backend/PDOPgSqlTest.php @@ -4,7 +4,7 @@ namespace Sabre\CalDAV\Backend; -class PDOPgSqlTest extends AbstractPDOTest +class PDOPgSqlTest extends AbstractPDOTestCase { public $driver = 'pgsql'; } diff --git a/tests/Sabre/CalDAV/Backend/PDOSqliteTest.php b/tests/Sabre/CalDAV/Backend/PDOSqliteTest.php index 4470e58109..e645aef926 100644 --- a/tests/Sabre/CalDAV/Backend/PDOSqliteTest.php +++ b/tests/Sabre/CalDAV/Backend/PDOSqliteTest.php @@ -4,7 +4,7 @@ namespace Sabre\CalDAV\Backend; -class PDOSqliteTest extends AbstractPDOTest +class PDOSqliteTest extends AbstractPDOTestCase { public $driver = 'sqlite'; } diff --git a/tests/Sabre/CalDAV/ExpandEventsDTSTARTandDTENDTest.php b/tests/Sabre/CalDAV/ExpandEventsDTSTARTandDTENDTest.php index 77714f0aae..94fa3559b7 100644 --- a/tests/Sabre/CalDAV/ExpandEventsDTSTARTandDTENDTest.php +++ b/tests/Sabre/CalDAV/ExpandEventsDTSTARTandDTENDTest.php @@ -14,7 +14,7 @@ * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License */ -class ExpandEventsDTSTARTandDTENDTest extends \Sabre\DAVServerTest +class ExpandEventsDTSTARTandDTENDTest extends \Sabre\AbstractDAVServerTestCase { protected $setupCalDAV = true; diff --git a/tests/Sabre/CalDAV/ExpandEventsDTSTARTandDTENDbyDayTest.php b/tests/Sabre/CalDAV/ExpandEventsDTSTARTandDTENDbyDayTest.php index fe4691e33f..00d629aaa3 100644 --- a/tests/Sabre/CalDAV/ExpandEventsDTSTARTandDTENDbyDayTest.php +++ b/tests/Sabre/CalDAV/ExpandEventsDTSTARTandDTENDbyDayTest.php @@ -14,7 +14,7 @@ * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License */ -class ExpandEventsDTSTARTandDTENDbyDayTest extends \Sabre\DAVServerTest +class ExpandEventsDTSTARTandDTENDbyDayTest extends \Sabre\AbstractDAVServerTestCase { protected $setupCalDAV = true; diff --git a/tests/Sabre/CalDAV/ExpandEventsDoubleEventsTest.php b/tests/Sabre/CalDAV/ExpandEventsDoubleEventsTest.php index acbf05c7db..21583ef5d3 100644 --- a/tests/Sabre/CalDAV/ExpandEventsDoubleEventsTest.php +++ b/tests/Sabre/CalDAV/ExpandEventsDoubleEventsTest.php @@ -17,7 +17,7 @@ * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License */ -class ExpandEventsDoubleEventsTest extends \Sabre\DAVServerTest +class ExpandEventsDoubleEventsTest extends \Sabre\AbstractDAVServerTestCase { protected $setupCalDAV = true; diff --git a/tests/Sabre/CalDAV/ExpandEventsFloatingTimeTest.php b/tests/Sabre/CalDAV/ExpandEventsFloatingTimeTest.php index 2251c7e5d1..b59e10f567 100644 --- a/tests/Sabre/CalDAV/ExpandEventsFloatingTimeTest.php +++ b/tests/Sabre/CalDAV/ExpandEventsFloatingTimeTest.php @@ -11,7 +11,7 @@ * This unittest is created to check if expand() works correctly with * floating times (using calendar-timezone information). */ -class ExpandEventsFloatingTimeTest extends \Sabre\DAVServerTest +class ExpandEventsFloatingTimeTest extends \Sabre\AbstractDAVServerTestCase { protected $setupCalDAV = true; diff --git a/tests/Sabre/CalDAV/GetEventsByTimerangeTest.php b/tests/Sabre/CalDAV/GetEventsByTimerangeTest.php index 0e265f38bb..02a5f800bb 100644 --- a/tests/Sabre/CalDAV/GetEventsByTimerangeTest.php +++ b/tests/Sabre/CalDAV/GetEventsByTimerangeTest.php @@ -13,7 +13,7 @@ * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License */ -class GetEventsByTimerangeTest extends \Sabre\DAVServerTest +class GetEventsByTimerangeTest extends \Sabre\AbstractDAVServerTestCase { protected $setupCalDAV = true; diff --git a/tests/Sabre/CalDAV/ICSExportPluginTest.php b/tests/Sabre/CalDAV/ICSExportPluginTest.php index b90a0eac44..6119c7624e 100644 --- a/tests/Sabre/CalDAV/ICSExportPluginTest.php +++ b/tests/Sabre/CalDAV/ICSExportPluginTest.php @@ -9,7 +9,7 @@ use Sabre\HTTP; use Sabre\VObject; -class ICSExportPluginTest extends \Sabre\DAVServerTest +class ICSExportPluginTest extends \Sabre\AbstractDAVServerTestCase { protected $setupCalDAV = true; diff --git a/tests/Sabre/CalDAV/Issue203Test.php b/tests/Sabre/CalDAV/Issue203Test.php index 902bab0ac9..580f159907 100644 --- a/tests/Sabre/CalDAV/Issue203Test.php +++ b/tests/Sabre/CalDAV/Issue203Test.php @@ -14,7 +14,7 @@ * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License */ -class Issue203Test extends \Sabre\DAVServerTest +class Issue203Test extends \Sabre\AbstractDAVServerTestCase { protected $setupCalDAV = true; diff --git a/tests/Sabre/CalDAV/Issue205Test.php b/tests/Sabre/CalDAV/Issue205Test.php index 67611c5868..354f4978bb 100644 --- a/tests/Sabre/CalDAV/Issue205Test.php +++ b/tests/Sabre/CalDAV/Issue205Test.php @@ -14,7 +14,7 @@ * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License */ -class Issue205Test extends \Sabre\DAVServerTest +class Issue205Test extends \Sabre\AbstractDAVServerTestCase { protected $setupCalDAV = true; diff --git a/tests/Sabre/CalDAV/Issue211Test.php b/tests/Sabre/CalDAV/Issue211Test.php index b9a103d3c7..e319285df3 100644 --- a/tests/Sabre/CalDAV/Issue211Test.php +++ b/tests/Sabre/CalDAV/Issue211Test.php @@ -13,7 +13,7 @@ * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License */ -class Issue211Test extends \Sabre\DAVServerTest +class Issue211Test extends \Sabre\AbstractDAVServerTestCase { protected $setupCalDAV = true; diff --git a/tests/Sabre/CalDAV/Issue220Test.php b/tests/Sabre/CalDAV/Issue220Test.php index 5ad3ebe917..a4c62fac8d 100644 --- a/tests/Sabre/CalDAV/Issue220Test.php +++ b/tests/Sabre/CalDAV/Issue220Test.php @@ -13,7 +13,7 @@ * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License */ -class Issue220Test extends \Sabre\DAVServerTest +class Issue220Test extends \Sabre\AbstractDAVServerTestCase { protected $setupCalDAV = true; diff --git a/tests/Sabre/CalDAV/Issue228Test.php b/tests/Sabre/CalDAV/Issue228Test.php index 9e88251c7c..bd9e87d66d 100644 --- a/tests/Sabre/CalDAV/Issue228Test.php +++ b/tests/Sabre/CalDAV/Issue228Test.php @@ -13,7 +13,7 @@ * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License */ -class Issue228Test extends \Sabre\DAVServerTest +class Issue228Test extends \Sabre\AbstractDAVServerTestCase { protected $setupCalDAV = true; diff --git a/tests/Sabre/CalDAV/JCalTransformTest.php b/tests/Sabre/CalDAV/JCalTransformTest.php index 605f980198..de4d467b87 100644 --- a/tests/Sabre/CalDAV/JCalTransformTest.php +++ b/tests/Sabre/CalDAV/JCalTransformTest.php @@ -7,7 +7,7 @@ use Sabre\HTTP\Request; use Sabre\VObject; -class JCalTransformTest extends \Sabre\DAVServerTest +class JCalTransformTest extends \Sabre\AbstractDAVServerTestCase { use VObject\PHPUnitAssertions; diff --git a/tests/Sabre/CalDAV/Schedule/DeliverNewEventTest.php b/tests/Sabre/CalDAV/Schedule/DeliverNewEventTest.php index 5fa6120ad8..10d6153739 100644 --- a/tests/Sabre/CalDAV/Schedule/DeliverNewEventTest.php +++ b/tests/Sabre/CalDAV/Schedule/DeliverNewEventTest.php @@ -7,7 +7,7 @@ use Sabre\HTTP\Request; use Sabre\VObject; -class DeliverNewEventTest extends \Sabre\DAVServerTest +class DeliverNewEventTest extends \Sabre\AbstractDAVServerTestCase { public $setupCalDAV = true; public $setupCalDAVScheduling = true; diff --git a/tests/Sabre/CalDAV/Schedule/OutboxPostTest.php b/tests/Sabre/CalDAV/Schedule/OutboxPostTest.php index 6e53abc700..b4e298efef 100644 --- a/tests/Sabre/CalDAV/Schedule/OutboxPostTest.php +++ b/tests/Sabre/CalDAV/Schedule/OutboxPostTest.php @@ -6,7 +6,7 @@ use Sabre\HTTP; -class OutboxPostTest extends \Sabre\DAVServerTest +class OutboxPostTest extends \Sabre\AbstractDAVServerTestCase { protected $setupCalDAV = true; protected $setupACL = true; diff --git a/tests/Sabre/CalDAV/Schedule/PluginBasicTest.php b/tests/Sabre/CalDAV/Schedule/PluginBasicTest.php index 083d141153..8817b030d7 100644 --- a/tests/Sabre/CalDAV/Schedule/PluginBasicTest.php +++ b/tests/Sabre/CalDAV/Schedule/PluginBasicTest.php @@ -4,7 +4,7 @@ namespace Sabre\CalDAV\Schedule; -class PluginBasicTest extends \Sabre\DAVServerTest +class PluginBasicTest extends \Sabre\AbstractDAVServerTestCase { public $setupCalDAV = true; public $setupCalDAVScheduling = true; diff --git a/tests/Sabre/CalDAV/Schedule/PluginPropertiesTest.php b/tests/Sabre/CalDAV/Schedule/PluginPropertiesTest.php index 6fed3ee4f2..73ceb788d0 100644 --- a/tests/Sabre/CalDAV/Schedule/PluginPropertiesTest.php +++ b/tests/Sabre/CalDAV/Schedule/PluginPropertiesTest.php @@ -6,7 +6,7 @@ use Sabre\DAV; -class PluginPropertiesTest extends \Sabre\DAVServerTest +class PluginPropertiesTest extends \Sabre\AbstractDAVServerTestCase { protected $setupCalDAV = true; protected $setupCalDAVScheduling = true; diff --git a/tests/Sabre/CalDAV/Schedule/PluginPropertiesWithSharedCalendarTest.php b/tests/Sabre/CalDAV/Schedule/PluginPropertiesWithSharedCalendarTest.php index 0388d0b0ee..7ece1edd1e 100644 --- a/tests/Sabre/CalDAV/Schedule/PluginPropertiesWithSharedCalendarTest.php +++ b/tests/Sabre/CalDAV/Schedule/PluginPropertiesWithSharedCalendarTest.php @@ -6,7 +6,7 @@ use Sabre\DAV; -class PluginPropertiesWithSharedCalendarTest extends \Sabre\DAVServerTest +class PluginPropertiesWithSharedCalendarTest extends \Sabre\AbstractDAVServerTestCase { protected $setupCalDAV = true; protected $setupCalDAVScheduling = true; diff --git a/tests/Sabre/CalDAV/Schedule/ScheduleDeliverTest.php b/tests/Sabre/CalDAV/Schedule/ScheduleDeliverTest.php index 912ee3b854..8652339519 100644 --- a/tests/Sabre/CalDAV/Schedule/ScheduleDeliverTest.php +++ b/tests/Sabre/CalDAV/Schedule/ScheduleDeliverTest.php @@ -8,7 +8,7 @@ use Sabre\Uri; use Sabre\VObject; -class ScheduleDeliverTest extends \Sabre\DAVServerTest +class ScheduleDeliverTest extends \Sabre\AbstractDAVServerTestCase { use VObject\PHPUnitAssertions; diff --git a/tests/Sabre/CalDAV/SharingPluginTest.php b/tests/Sabre/CalDAV/SharingPluginTest.php index b8fac8b0c5..7a58656abd 100644 --- a/tests/Sabre/CalDAV/SharingPluginTest.php +++ b/tests/Sabre/CalDAV/SharingPluginTest.php @@ -4,12 +4,12 @@ namespace Sabre\CalDAV; +use Sabre\AbstractDAVServerTestCase; use Sabre\DAV; use Sabre\DAV\Xml\Element\Sharee; -use Sabre\DAVServerTest; use Sabre\HTTP; -class SharingPluginTest extends DAVServerTest +class SharingPluginTest extends AbstractDAVServerTestCase { protected $setupCalDAV = true; protected $setupCalDAVSharing = true; diff --git a/tests/Sabre/CalDAV/Subscriptions/CreateSubscriptionTest.php b/tests/Sabre/CalDAV/Subscriptions/CreateSubscriptionTest.php index 5c5ab5f558..5b2c1571fa 100644 --- a/tests/Sabre/CalDAV/Subscriptions/CreateSubscriptionTest.php +++ b/tests/Sabre/CalDAV/Subscriptions/CreateSubscriptionTest.php @@ -6,7 +6,7 @@ use Sabre\HTTP\Request; -class CreateSubscriptionTest extends \Sabre\DAVServerTest +class CreateSubscriptionTest extends \Sabre\AbstractDAVServerTestCase { protected $setupCalDAV = true; protected $setupCalDAVSubscriptions = true; diff --git a/tests/Sabre/CalDAV/Xml/Notification/InviteTest.php b/tests/Sabre/CalDAV/Xml/Notification/InviteTest.php index 2e3d6e42ea..5399de709f 100644 --- a/tests/Sabre/CalDAV/Xml/Notification/InviteTest.php +++ b/tests/Sabre/CalDAV/Xml/Notification/InviteTest.php @@ -7,7 +7,7 @@ use Sabre\DAV; use Sabre\Xml\Writer; -class InviteTest extends DAV\Xml\XmlTest +class InviteTest extends DAV\Xml\AbstractXmlTestCase { /** * @param array $notification diff --git a/tests/Sabre/CalDAV/Xml/Property/AllowedSharingModesTest.php b/tests/Sabre/CalDAV/Xml/Property/AllowedSharingModesTest.php index 75409dce2a..77d8851277 100644 --- a/tests/Sabre/CalDAV/Xml/Property/AllowedSharingModesTest.php +++ b/tests/Sabre/CalDAV/Xml/Property/AllowedSharingModesTest.php @@ -7,7 +7,7 @@ use Sabre\CalDAV; use Sabre\DAV; -class AllowedSharingModesTest extends DAV\Xml\XmlTest +class AllowedSharingModesTest extends DAV\Xml\AbstractXmlTestCase { public function testSimple() { diff --git a/tests/Sabre/CalDAV/Xml/Property/EmailAddressSetTest.php b/tests/Sabre/CalDAV/Xml/Property/EmailAddressSetTest.php index b732b26c53..7fab3e6472 100644 --- a/tests/Sabre/CalDAV/Xml/Property/EmailAddressSetTest.php +++ b/tests/Sabre/CalDAV/Xml/Property/EmailAddressSetTest.php @@ -4,9 +4,9 @@ namespace Sabre\CalDAV\Xml\Property; -use Sabre\DAV\Xml\XmlTest; +use Sabre\DAV\Xml\AbstractXmlTestCase; -class EmailAddressSetTest extends XmlTest +class EmailAddressSetTest extends AbstractXmlTestCase { protected $namespaceMap = [ \Sabre\CalDAV\Plugin::NS_CALENDARSERVER => 'cs', diff --git a/tests/Sabre/CalDAV/Xml/Property/InviteTest.php b/tests/Sabre/CalDAV/Xml/Property/InviteTest.php index 11a26c28e3..309b28291c 100644 --- a/tests/Sabre/CalDAV/Xml/Property/InviteTest.php +++ b/tests/Sabre/CalDAV/Xml/Property/InviteTest.php @@ -9,7 +9,7 @@ use Sabre\DAV\Sharing\Plugin as SP; use Sabre\DAV\Xml\Element\Sharee; -class InviteTest extends DAV\Xml\XmlTest +class InviteTest extends DAV\Xml\AbstractXmlTestCase { public function setup(): void { diff --git a/tests/Sabre/CalDAV/Xml/Property/ScheduleCalendarTranspTest.php b/tests/Sabre/CalDAV/Xml/Property/ScheduleCalendarTranspTest.php index fe6170146f..c2f76b8ae3 100644 --- a/tests/Sabre/CalDAV/Xml/Property/ScheduleCalendarTranspTest.php +++ b/tests/Sabre/CalDAV/Xml/Property/ScheduleCalendarTranspTest.php @@ -7,7 +7,7 @@ use Sabre\CalDAV; use Sabre\DAV; -class ScheduleCalendarTranspTest extends DAV\Xml\XmlTest +class ScheduleCalendarTranspTest extends DAV\Xml\AbstractXmlTestCase { public function setup(): void { diff --git a/tests/Sabre/CalDAV/Xml/Property/SupportedCalendarComponentSetTest.php b/tests/Sabre/CalDAV/Xml/Property/SupportedCalendarComponentSetTest.php index 4be33a7959..9f60c40dd8 100644 --- a/tests/Sabre/CalDAV/Xml/Property/SupportedCalendarComponentSetTest.php +++ b/tests/Sabre/CalDAV/Xml/Property/SupportedCalendarComponentSetTest.php @@ -7,7 +7,7 @@ use Sabre\CalDAV; use Sabre\DAV; -class SupportedCalendarComponentSetTest extends DAV\Xml\XmlTest +class SupportedCalendarComponentSetTest extends DAV\Xml\AbstractXmlTestCase { public function setup(): void { diff --git a/tests/Sabre/CalDAV/Xml/Property/SupportedCalendarDataTest.php b/tests/Sabre/CalDAV/Xml/Property/SupportedCalendarDataTest.php index 6a41a01965..51f558e178 100644 --- a/tests/Sabre/CalDAV/Xml/Property/SupportedCalendarDataTest.php +++ b/tests/Sabre/CalDAV/Xml/Property/SupportedCalendarDataTest.php @@ -7,7 +7,7 @@ use Sabre\CalDAV; use Sabre\DAV; -class SupportedCalendarDataTest extends DAV\Xml\XmlTest +class SupportedCalendarDataTest extends DAV\Xml\AbstractXmlTestCase { public function testSimple() { diff --git a/tests/Sabre/CalDAV/Xml/Property/SupportedCollationSetTest.php b/tests/Sabre/CalDAV/Xml/Property/SupportedCollationSetTest.php index e4737b0cd4..a1f18342ec 100644 --- a/tests/Sabre/CalDAV/Xml/Property/SupportedCollationSetTest.php +++ b/tests/Sabre/CalDAV/Xml/Property/SupportedCollationSetTest.php @@ -7,7 +7,7 @@ use Sabre\CalDAV; use Sabre\DAV; -class SupportedCollationSetTest extends DAV\Xml\XmlTest +class SupportedCollationSetTest extends DAV\Xml\AbstractXmlTestCase { public function testSimple() { diff --git a/tests/Sabre/CalDAV/Xml/Request/CalendarQueryReportTest.php b/tests/Sabre/CalDAV/Xml/Request/CalendarQueryReportTest.php index a7a03f976b..8172c906fe 100644 --- a/tests/Sabre/CalDAV/Xml/Request/CalendarQueryReportTest.php +++ b/tests/Sabre/CalDAV/Xml/Request/CalendarQueryReportTest.php @@ -6,9 +6,9 @@ use DateTimeImmutable; use DateTimeZone; -use Sabre\DAV\Xml\XmlTest; +use Sabre\DAV\Xml\AbstractXmlTestCase; -class CalendarQueryReportTest extends XmlTest +class CalendarQueryReportTest extends AbstractXmlTestCase { protected $elementMap = [ '{urn:ietf:params:xml:ns:caldav}calendar-query' => 'Sabre\\CalDAV\\Xml\\Request\CalendarQueryReport', diff --git a/tests/Sabre/CalDAV/Xml/Request/InviteReplyTest.php b/tests/Sabre/CalDAV/Xml/Request/InviteReplyTest.php index aea49fd219..baf07681d5 100644 --- a/tests/Sabre/CalDAV/Xml/Request/InviteReplyTest.php +++ b/tests/Sabre/CalDAV/Xml/Request/InviteReplyTest.php @@ -5,9 +5,9 @@ namespace Sabre\CalDAV\Xml\Request; use Sabre\DAV; -use Sabre\DAV\Xml\XmlTest; +use Sabre\DAV\Xml\AbstractXmlTestCase; -class InviteReplyTest extends XmlTest +class InviteReplyTest extends AbstractXmlTestCase { protected $elementMap = [ '{http://calendarserver.org/ns/}invite-reply' => 'Sabre\\CalDAV\\Xml\\Request\\InviteReply', diff --git a/tests/Sabre/CalDAV/Xml/Request/ShareTest.php b/tests/Sabre/CalDAV/Xml/Request/ShareTest.php index 0ea00a8009..0d696f17b8 100644 --- a/tests/Sabre/CalDAV/Xml/Request/ShareTest.php +++ b/tests/Sabre/CalDAV/Xml/Request/ShareTest.php @@ -4,10 +4,10 @@ namespace Sabre\CalDAV\Xml\Request; +use Sabre\DAV\Xml\AbstractXmlTestCase; use Sabre\DAV\Xml\Element\Sharee; -use Sabre\DAV\Xml\XmlTest; -class ShareTest extends XmlTest +class ShareTest extends AbstractXmlTestCase { protected $elementMap = [ '{http://calendarserver.org/ns/}share' => 'Sabre\\CalDAV\\Xml\\Request\\Share', diff --git a/tests/Sabre/CardDAV/AbstractPluginTest.php b/tests/Sabre/CardDAV/AbstractPluginTestCase.php similarity index 76% rename from tests/Sabre/CardDAV/AbstractPluginTest.php rename to tests/Sabre/CardDAV/AbstractPluginTestCase.php index 6565fc4592..6d5e588cd3 100644 --- a/tests/Sabre/CardDAV/AbstractPluginTest.php +++ b/tests/Sabre/CardDAV/AbstractPluginTestCase.php @@ -4,22 +4,24 @@ namespace Sabre\CardDAV; -use Sabre\DAV; +use PHPUnit\Framework\TestCase; +use Sabre\CardDAV\Backend\Mock; +use Sabre\DAV\Server; use Sabre\DAVACL; use Sabre\HTTP; -abstract class AbstractPluginTest extends \PHPUnit\Framework\TestCase +abstract class AbstractPluginTestCase extends TestCase { /** - * @var Sabre\CardDAV\Plugin + * @var Plugin */ protected $plugin; /** - * @var Sabre\DAV\Server + * @var Server */ protected $server; /** - * @var Sabre\CardDAV\Backend\Mock; + * @var Mock; */ protected $backend; @@ -35,7 +37,7 @@ public function setup(): void $this->plugin = new Plugin(); $this->plugin->directories = ['directory']; - $this->server = new DAV\Server($tree); + $this->server = new Server($tree); $this->server->sapi = new HTTP\SapiMock(); $this->server->addPlugin($this->plugin); $this->server->debugExceptions = true; diff --git a/tests/Sabre/CardDAV/AddressBookQueryTest.php b/tests/Sabre/CardDAV/AddressBookQueryTest.php index 7404b50dca..3e048ba46a 100644 --- a/tests/Sabre/CardDAV/AddressBookQueryTest.php +++ b/tests/Sabre/CardDAV/AddressBookQueryTest.php @@ -7,7 +7,7 @@ use Sabre\DAV; use Sabre\HTTP; -class AddressBookQueryTest extends AbstractPluginTest +class AddressBookQueryTest extends AbstractPluginTestCase { public function testQuery() { diff --git a/tests/Sabre/CardDAV/Backend/AbstractPDOTest.php b/tests/Sabre/CardDAV/Backend/AbstractPDOTestCase.php similarity index 98% rename from tests/Sabre/CardDAV/Backend/AbstractPDOTest.php rename to tests/Sabre/CardDAV/Backend/AbstractPDOTestCase.php index ad1d4ddeae..aa77b4b1f4 100644 --- a/tests/Sabre/CardDAV/Backend/AbstractPDOTest.php +++ b/tests/Sabre/CardDAV/Backend/AbstractPDOTestCase.php @@ -4,12 +4,14 @@ namespace Sabre\CardDAV\Backend; +use PHPUnit\Framework\TestCase; use Sabre\CardDAV; +use Sabre\DAV\DbTestHelperTrait; use Sabre\DAV\PropPatch; -abstract class AbstractPDOTest extends \PHPUnit\Framework\TestCase +abstract class AbstractPDOTestCase extends TestCase { - use \Sabre\DAV\DbTestHelperTrait; + use DbTestHelperTrait; /** * @var CardDAV\Backend\PDO diff --git a/tests/Sabre/CardDAV/Backend/PDOMySQLTest.php b/tests/Sabre/CardDAV/Backend/PDOMySQLTest.php index 718eec6be7..4b7f9ea9ea 100644 --- a/tests/Sabre/CardDAV/Backend/PDOMySQLTest.php +++ b/tests/Sabre/CardDAV/Backend/PDOMySQLTest.php @@ -4,7 +4,7 @@ namespace Sabre\CardDAV\Backend; -class PDOMySQLTest extends AbstractPDOTest +class PDOMySQLTest extends AbstractPDOTestCase { public $driver = 'mysql'; } diff --git a/tests/Sabre/CardDAV/Backend/PDOPgSqlTest.php b/tests/Sabre/CardDAV/Backend/PDOPgSqlTest.php index 5db6da0a9c..4d58484401 100644 --- a/tests/Sabre/CardDAV/Backend/PDOPgSqlTest.php +++ b/tests/Sabre/CardDAV/Backend/PDOPgSqlTest.php @@ -4,7 +4,7 @@ namespace Sabre\CardDAV\Backend; -class PDOPgSqlTest extends AbstractPDOTest +class PDOPgSqlTest extends AbstractPDOTestCase { public $driver = 'pgsql'; } diff --git a/tests/Sabre/CardDAV/Backend/PDOSqliteTest.php b/tests/Sabre/CardDAV/Backend/PDOSqliteTest.php index b16a00ce28..0aef9a8a4c 100644 --- a/tests/Sabre/CardDAV/Backend/PDOSqliteTest.php +++ b/tests/Sabre/CardDAV/Backend/PDOSqliteTest.php @@ -4,7 +4,7 @@ namespace Sabre\CardDAV\Backend; -class PDOSqliteTest extends AbstractPDOTest +class PDOSqliteTest extends AbstractPDOTestCase { public $driver = 'sqlite'; } diff --git a/tests/Sabre/CardDAV/MultiGetTest.php b/tests/Sabre/CardDAV/MultiGetTest.php index e2ee12b657..3557ddaeaa 100644 --- a/tests/Sabre/CardDAV/MultiGetTest.php +++ b/tests/Sabre/CardDAV/MultiGetTest.php @@ -7,7 +7,7 @@ use Sabre\DAV; use Sabre\HTTP; -class MultiGetTest extends AbstractPluginTest +class MultiGetTest extends AbstractPluginTestCase { public function testMultiGet() { diff --git a/tests/Sabre/CardDAV/PluginTest.php b/tests/Sabre/CardDAV/PluginTest.php index c3a41daf96..6d7d01fcaf 100644 --- a/tests/Sabre/CardDAV/PluginTest.php +++ b/tests/Sabre/CardDAV/PluginTest.php @@ -6,13 +6,13 @@ use Sabre\DAV; -class PluginTest extends AbstractPluginTest +class PluginTest extends AbstractPluginTestCase { public function testConstruct() { self::assertEquals('{'.Plugin::NS_CARDDAV.'}addressbook', $this->server->resourceTypeMapping['Sabre\\CardDAV\\IAddressBook']); - self::assertTrue(in_array('addressbook', $this->plugin->getFeatures())); + self::assertContains('addressbook', $this->plugin->getFeatures()); self::assertEquals('carddav', $this->plugin->getPluginInfo()['name']); } @@ -34,7 +34,7 @@ public function testAddressBookHomeSet() { $result = $this->server->getProperties('principals/user1', ['{'.Plugin::NS_CARDDAV.'}addressbook-home-set']); - self::assertEquals(1, count($result)); + self::assertCount(1, $result); self::assertTrue(isset($result['{'.Plugin::NS_CARDDAV.'}addressbook-home-set'])); self::assertEquals('addressbooks/user1/', $result['{'.Plugin::NS_CARDDAV.'}addressbook-home-set']->getHref()); } @@ -43,7 +43,7 @@ public function testDirectoryGateway() { $result = $this->server->getProperties('principals/user1', ['{'.Plugin::NS_CARDDAV.'}directory-gateway']); - self::assertEquals(1, count($result)); + self::assertCount(1, $result); self::assertTrue(isset($result['{'.Plugin::NS_CARDDAV.'}directory-gateway'])); self::assertEquals(['directory'], $result['{'.Plugin::NS_CARDDAV.'}directory-gateway']->getHrefs()); } diff --git a/tests/Sabre/CardDAV/SogoStripContentTypeTest.php b/tests/Sabre/CardDAV/SogoStripContentTypeTest.php index 9410653628..1c761a5d2d 100644 --- a/tests/Sabre/CardDAV/SogoStripContentTypeTest.php +++ b/tests/Sabre/CardDAV/SogoStripContentTypeTest.php @@ -7,7 +7,7 @@ use Sabre\DAV\PropFind; use Sabre\HTTP; -class SogoStripContentTypeTest extends \Sabre\DAVServerTest +class SogoStripContentTypeTest extends \Sabre\AbstractDAVServerTestCase { protected $setupCardDAV = true; protected $carddavAddressBooks = [ diff --git a/tests/Sabre/CardDAV/VCFExportTest.php b/tests/Sabre/CardDAV/VCFExportTest.php index 2e4eeacf66..65e3742225 100644 --- a/tests/Sabre/CardDAV/VCFExportTest.php +++ b/tests/Sabre/CardDAV/VCFExportTest.php @@ -6,7 +6,7 @@ use Sabre\HTTP; -class VCFExportTest extends \Sabre\DAVServerTest +class VCFExportTest extends \Sabre\AbstractDAVServerTestCase { protected $setupCardDAV = true; protected $autoLogin = 'user1'; diff --git a/tests/Sabre/CardDAV/ValidateFilterTest.php b/tests/Sabre/CardDAV/ValidateFilterTest.php index b56893bafe..b325d8459c 100644 --- a/tests/Sabre/CardDAV/ValidateFilterTest.php +++ b/tests/Sabre/CardDAV/ValidateFilterTest.php @@ -4,7 +4,7 @@ namespace Sabre\CardDAV; -class ValidateFilterTest extends AbstractPluginTest +class ValidateFilterTest extends AbstractPluginTestCase { /** * @param string $input diff --git a/tests/Sabre/CardDAV/Xml/Property/SupportedAddressDataTest.php b/tests/Sabre/CardDAV/Xml/Property/SupportedAddressDataTest.php index e5dc36e9cb..ed8c99ad0b 100644 --- a/tests/Sabre/CardDAV/Xml/Property/SupportedAddressDataTest.php +++ b/tests/Sabre/CardDAV/Xml/Property/SupportedAddressDataTest.php @@ -7,7 +7,7 @@ use Sabre\CardDAV; use Sabre\DAV; -class SupportedAddressDataTest extends DAV\Xml\XmlTest +class SupportedAddressDataTest extends DAV\Xml\AbstractXmlTestCase { public function testSimple() { diff --git a/tests/Sabre/CardDAV/Xml/Property/SupportedCollationSetTest.php b/tests/Sabre/CardDAV/Xml/Property/SupportedCollationSetTest.php index dd6e2d4843..e4f58139d5 100644 --- a/tests/Sabre/CardDAV/Xml/Property/SupportedCollationSetTest.php +++ b/tests/Sabre/CardDAV/Xml/Property/SupportedCollationSetTest.php @@ -7,7 +7,7 @@ use Sabre\CardDAV; use Sabre\DAV; -class SupportedCollationSetTest extends DAV\Xml\XmlTest +class SupportedCollationSetTest extends DAV\Xml\AbstractXmlTestCase { public function testSimple() { diff --git a/tests/Sabre/CardDAV/Xml/Request/AddressBookMultiGetReportTest.php b/tests/Sabre/CardDAV/Xml/Request/AddressBookMultiGetReportTest.php index 29291578c0..d1d612329c 100644 --- a/tests/Sabre/CardDAV/Xml/Request/AddressBookMultiGetReportTest.php +++ b/tests/Sabre/CardDAV/Xml/Request/AddressBookMultiGetReportTest.php @@ -2,9 +2,9 @@ namespace Sabre\CardDAV\Xml\Request; -use Sabre\DAV\Xml\XmlTest; +use Sabre\DAV\Xml\AbstractXmlTestCase; -class AddressBookMultiGetReportTest extends XmlTest +class AddressBookMultiGetReportTest extends AbstractXmlTestCase { protected $elementMap = [ '{urn:ietf:params:xml:ns:carddav}addressbook-multiget' => 'Sabre\\CardDAV\\Xml\\Request\AddressBookMultiGetReport', diff --git a/tests/Sabre/CardDAV/Xml/Request/AddressBookQueryReportTest.php b/tests/Sabre/CardDAV/Xml/Request/AddressBookQueryReportTest.php index b9fb036ecf..b2dbab4e93 100644 --- a/tests/Sabre/CardDAV/Xml/Request/AddressBookQueryReportTest.php +++ b/tests/Sabre/CardDAV/Xml/Request/AddressBookQueryReportTest.php @@ -4,9 +4,9 @@ namespace Sabre\CardDAV\Xml\Request; -use Sabre\DAV\Xml\XmlTest; +use Sabre\DAV\Xml\AbstractXmlTestCase; -class AddressBookQueryReportTest extends XmlTest +class AddressBookQueryReportTest extends AbstractXmlTestCase { protected $elementMap = [ '{urn:ietf:params:xml:ns:carddav}addressbook-query' => 'Sabre\\CardDAV\\Xml\\Request\AddressBookQueryReport', diff --git a/tests/Sabre/DAV/AbstractServer.php b/tests/Sabre/DAV/AbstractServerTestCase.php similarity index 66% rename from tests/Sabre/DAV/AbstractServer.php rename to tests/Sabre/DAV/AbstractServerTestCase.php index ee321fd4c6..053a229dbc 100644 --- a/tests/Sabre/DAV/AbstractServer.php +++ b/tests/Sabre/DAV/AbstractServerTestCase.php @@ -4,42 +4,45 @@ namespace Sabre\DAV; +use PHPUnit\Framework\TestCase; use Sabre\HTTP; +use Sabre\HTTP\ResponseMock; +use Sabre\TestUtil; -abstract class AbstractServer extends \PHPUnit\Framework\TestCase +abstract class AbstractServerTestCase extends TestCase { /** - * @var \Sabre\HTTP\ResponseMock + * @var ResponseMock */ protected $response; protected $request; /** - * @var \Sabre\DAV\Server + * @var Server */ protected $server; - protected $tempDir = \Sabre\TestUtil::SABRE_TEMPDIR; + protected $tempDir = TestUtil::SABRE_TEMPDIR; public function setup(): void { - $this->response = new HTTP\ResponseMock(); + $this->response = new 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\TestUtil::SABRE_TEMPDIR, false); - file_put_contents(\Sabre\TestUtil::SABRE_TEMPDIR.'/test.txt', 'Test contents'); - mkdir(\Sabre\TestUtil::SABRE_TEMPDIR.'/dir'); - file_put_contents(\Sabre\TestUtil::SABRE_TEMPDIR.'/dir/child.txt', 'Child contents'); + $this->deleteTree(TestUtil::SABRE_TEMPDIR, false); + file_put_contents(TestUtil::SABRE_TEMPDIR.'/test.txt', 'Test contents'); + mkdir(TestUtil::SABRE_TEMPDIR.'/dir'); + file_put_contents(TestUtil::SABRE_TEMPDIR.'/dir/child.txt', 'Child contents'); } public function teardown(): void { - $this->deleteTree(\Sabre\TestUtil::SABRE_TEMPDIR, false); + $this->deleteTree(TestUtil::SABRE_TEMPDIR, false); } protected function getRootNode() { - return new FS\Directory(\Sabre\TestUtil::SABRE_TEMPDIR); + return new FS\Directory(TestUtil::SABRE_TEMPDIR); } protected function getSanitizedBody() diff --git a/tests/Sabre/DAV/Auth/Backend/AbstractPDOBasicAuthTest.php b/tests/Sabre/DAV/Auth/Backend/AbstractPDOBasicAuthTestCase.php similarity index 96% rename from tests/Sabre/DAV/Auth/Backend/AbstractPDOBasicAuthTest.php rename to tests/Sabre/DAV/Auth/Backend/AbstractPDOBasicAuthTestCase.php index 3a5d9164d0..9ec8f06cab 100644 --- a/tests/Sabre/DAV/Auth/Backend/AbstractPDOBasicAuthTest.php +++ b/tests/Sabre/DAV/Auth/Backend/AbstractPDOBasicAuthTestCase.php @@ -4,11 +4,13 @@ namespace Sabre\DAV\Auth\Backend; +use PHPUnit\Framework\TestCase; +use Sabre\DAV\DbTestHelperTrait; use Sabre\HTTP; -abstract class AbstractPDOBasicAuthTest extends \PHPUnit\Framework\TestCase +abstract class AbstractPDOBasicAuthTestCase extends TestCase { - use \Sabre\DAV\DbTestHelperTrait; + use DbTestHelperTrait; public function setup(): void { diff --git a/tests/Sabre/DAV/Auth/Backend/AbstractPDOTest.php b/tests/Sabre/DAV/Auth/Backend/AbstractPDOTestCaseCase.php similarity index 84% rename from tests/Sabre/DAV/Auth/Backend/AbstractPDOTest.php rename to tests/Sabre/DAV/Auth/Backend/AbstractPDOTestCaseCase.php index 66a04719d3..65deddcc38 100644 --- a/tests/Sabre/DAV/Auth/Backend/AbstractPDOTest.php +++ b/tests/Sabre/DAV/Auth/Backend/AbstractPDOTestCaseCase.php @@ -4,9 +4,12 @@ namespace Sabre\DAV\Auth\Backend; -abstract class AbstractPDOTest extends \PHPUnit\Framework\TestCase +use PHPUnit\Framework\TestCase; +use Sabre\DAV\DbTestHelperTrait; + +abstract class AbstractPDOTestCaseCase extends TestCase { - use \Sabre\DAV\DbTestHelperTrait; + use DbTestHelperTrait; public function setup(): void { diff --git a/tests/Sabre/DAV/Auth/Backend/PDOBasicAuthSqliteTest.php b/tests/Sabre/DAV/Auth/Backend/PDOBasicAuthSqliteTest.php index e961bf0abb..c524ba4aec 100644 --- a/tests/Sabre/DAV/Auth/Backend/PDOBasicAuthSqliteTest.php +++ b/tests/Sabre/DAV/Auth/Backend/PDOBasicAuthSqliteTest.php @@ -4,7 +4,7 @@ namespace Sabre\DAV\Auth\Backend; -class PDOBasicAuthSqliteTest extends AbstractPDOBasicAuthTest +class PDOBasicAuthSqliteTest extends AbstractPDOBasicAuthTestCase { public $driver = 'sqlite'; } diff --git a/tests/Sabre/DAV/Auth/Backend/PDOMySQLTest.php b/tests/Sabre/DAV/Auth/Backend/PDOMySQLTest.php index 6ad7906c4f..888c677d48 100644 --- a/tests/Sabre/DAV/Auth/Backend/PDOMySQLTest.php +++ b/tests/Sabre/DAV/Auth/Backend/PDOMySQLTest.php @@ -4,7 +4,7 @@ namespace Sabre\DAV\Auth\Backend; -class PDOMySQLTest extends AbstractPDOTest +class PDOMySQLTest extends AbstractPDOTestCaseCase { public $driver = 'mysql'; } diff --git a/tests/Sabre/DAV/Auth/Backend/PDOPgSqlTest.php b/tests/Sabre/DAV/Auth/Backend/PDOPgSqlTest.php index b82b07698c..48b9c84aa2 100644 --- a/tests/Sabre/DAV/Auth/Backend/PDOPgSqlTest.php +++ b/tests/Sabre/DAV/Auth/Backend/PDOPgSqlTest.php @@ -4,7 +4,7 @@ namespace Sabre\DAV\Auth\Backend; -class PDOPgSqlTest extends AbstractPDOTest +class PDOPgSqlTest extends AbstractPDOTestCaseCase { public $driver = 'pgsql'; } diff --git a/tests/Sabre/DAV/Auth/Backend/PDOSqliteTest.php b/tests/Sabre/DAV/Auth/Backend/PDOSqliteTest.php index b42b40eff0..9012a3fa96 100644 --- a/tests/Sabre/DAV/Auth/Backend/PDOSqliteTest.php +++ b/tests/Sabre/DAV/Auth/Backend/PDOSqliteTest.php @@ -4,7 +4,7 @@ namespace Sabre\DAV\Auth\Backend; -class PDOSqliteTest extends AbstractPDOTest +class PDOSqliteTest extends AbstractPDOTestCaseCase { public $driver = 'sqlite'; } diff --git a/tests/Sabre/DAV/Browser/GuessContentTypeTest.php b/tests/Sabre/DAV/Browser/GuessContentTypeTest.php index 3da77f8b33..a918171cf3 100644 --- a/tests/Sabre/DAV/Browser/GuessContentTypeTest.php +++ b/tests/Sabre/DAV/Browser/GuessContentTypeTest.php @@ -6,7 +6,7 @@ use Sabre\DAV; -class GuessContentTypeTest extends DAV\AbstractServer +class GuessContentTypeTest extends DAV\AbstractServerTestCase { public function setUp(): void { diff --git a/tests/Sabre/DAV/Browser/MapGetToPropFindTest.php b/tests/Sabre/DAV/Browser/MapGetToPropFindTest.php index b128289c4d..68193ce6d0 100644 --- a/tests/Sabre/DAV/Browser/MapGetToPropFindTest.php +++ b/tests/Sabre/DAV/Browser/MapGetToPropFindTest.php @@ -7,7 +7,7 @@ use Sabre\DAV; use Sabre\HTTP; -class MapGetToPropFindTest extends DAV\AbstractServer +class MapGetToPropFindTest extends DAV\AbstractServerTestCase { public function setUp(): void { diff --git a/tests/Sabre/DAV/Browser/PluginTest.php b/tests/Sabre/DAV/Browser/PluginTest.php index 9e2cfd692e..6efb00b081 100644 --- a/tests/Sabre/DAV/Browser/PluginTest.php +++ b/tests/Sabre/DAV/Browser/PluginTest.php @@ -7,7 +7,7 @@ use Sabre\DAV; use Sabre\HTTP; -class PluginTest extends DAV\AbstractServer +class PluginTest extends DAV\AbstractServerTestCase { protected $plugin; diff --git a/tests/Sabre/DAV/FSExt/ServerTest.php b/tests/Sabre/DAV/FSExt/ServerTest.php index d6aeaf82f9..3f2277400e 100644 --- a/tests/Sabre/DAV/FSExt/ServerTest.php +++ b/tests/Sabre/DAV/FSExt/ServerTest.php @@ -7,7 +7,7 @@ use Sabre\DAV; use Sabre\HTTP; -class ServerTest extends DAV\AbstractServer +class ServerTest extends DAV\AbstractServerTestCase { protected function getRootNode() { diff --git a/tests/Sabre/DAV/GetIfConditionsTest.php b/tests/Sabre/DAV/GetIfConditionsTest.php index 9f613398fc..afee554377 100644 --- a/tests/Sabre/DAV/GetIfConditionsTest.php +++ b/tests/Sabre/DAV/GetIfConditionsTest.php @@ -6,7 +6,7 @@ use Sabre\HTTP; -class GetIfConditionsTest extends AbstractServer +class GetIfConditionsTest extends AbstractServerTestCase { public function testNoConditions() { diff --git a/tests/Sabre/DAV/HTTPPreferParsingTest.php b/tests/Sabre/DAV/HTTPPreferParsingTest.php index d91882eae6..5ab171b6ba 100644 --- a/tests/Sabre/DAV/HTTPPreferParsingTest.php +++ b/tests/Sabre/DAV/HTTPPreferParsingTest.php @@ -4,11 +4,12 @@ namespace Sabre\DAV; +use Sabre\AbstractDAVServerTestCase; use Sabre\HTTP; -class HTTPPreferParsingTest extends \Sabre\DAVServerTest +class HTTPPreferParsingTest extends AbstractDAVServerTestCase { - public function assertParseResult($input, $expected) + public static function assertParseResult($input, $expected) { $httpRequest = new HTTP\Request('GET', '/foo', [ 'Prefer' => $input, diff --git a/tests/Sabre/DAV/HttpCopyTest.php b/tests/Sabre/DAV/HttpCopyTest.php index 96a516a3b8..1089713000 100644 --- a/tests/Sabre/DAV/HttpCopyTest.php +++ b/tests/Sabre/DAV/HttpCopyTest.php @@ -4,7 +4,7 @@ namespace Sabre\DAV; -use Sabre\DAVServerTest; +use Sabre\AbstractDAVServerTestCase; use Sabre\HTTP; /** @@ -14,7 +14,7 @@ * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License */ -class HttpCopyTest extends DAVServerTest +class HttpCopyTest extends AbstractDAVServerTestCase { /** * Sets up the DAV tree. diff --git a/tests/Sabre/DAV/HttpDeleteTest.php b/tests/Sabre/DAV/HttpDeleteTest.php index 2fc29ee0f6..c286971463 100644 --- a/tests/Sabre/DAV/HttpDeleteTest.php +++ b/tests/Sabre/DAV/HttpDeleteTest.php @@ -4,7 +4,7 @@ namespace Sabre\DAV; -use Sabre\DAVServerTest; +use Sabre\AbstractDAVServerTestCase; use Sabre\HTTP; /** @@ -14,7 +14,7 @@ * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License */ -class HttpDeleteTest extends DAVServerTest +class HttpDeleteTest extends AbstractDAVServerTestCase { /** * Sets up the DAV tree. diff --git a/tests/Sabre/DAV/HttpGetTest.php b/tests/Sabre/DAV/HttpGetTest.php index 61e8f58251..69fadaa8f0 100644 --- a/tests/Sabre/DAV/HttpGetTest.php +++ b/tests/Sabre/DAV/HttpGetTest.php @@ -4,7 +4,7 @@ namespace Sabre\DAV; -use Sabre\DAVServerTest; +use Sabre\AbstractDAVServerTestCase; use Sabre\HTTP; /** @@ -14,7 +14,7 @@ * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License */ -class HttpGetTest extends DAVServerTest +class HttpGetTest extends AbstractDAVServerTestCase { /** * Sets up the DAV tree. diff --git a/tests/Sabre/DAV/HttpHeadTest.php b/tests/Sabre/DAV/HttpHeadTest.php index e719ef3cf6..68d88f7619 100644 --- a/tests/Sabre/DAV/HttpHeadTest.php +++ b/tests/Sabre/DAV/HttpHeadTest.php @@ -4,7 +4,7 @@ namespace Sabre\DAV; -use Sabre\DAVServerTest; +use Sabre\AbstractDAVServerTestCase; use Sabre\HTTP; /** @@ -14,7 +14,7 @@ * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License */ -class HttpHeadTest extends DAVServerTest +class HttpHeadTest extends AbstractDAVServerTestCase { /** * Sets up the DAV tree. diff --git a/tests/Sabre/DAV/HttpMoveTest.php b/tests/Sabre/DAV/HttpMoveTest.php index cd3cce58fc..e9ccfa0917 100644 --- a/tests/Sabre/DAV/HttpMoveTest.php +++ b/tests/Sabre/DAV/HttpMoveTest.php @@ -4,7 +4,7 @@ namespace Sabre\DAV; -use Sabre\DAVServerTest; +use Sabre\AbstractDAVServerTestCase; use Sabre\HTTP; /** @@ -14,7 +14,7 @@ * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License */ -class HttpMoveTest extends DAVServerTest +class HttpMoveTest extends AbstractDAVServerTestCase { /** * Sets up the DAV tree. diff --git a/tests/Sabre/DAV/HttpPutTest.php b/tests/Sabre/DAV/HttpPutTest.php index cdc567c944..ace66e395c 100644 --- a/tests/Sabre/DAV/HttpPutTest.php +++ b/tests/Sabre/DAV/HttpPutTest.php @@ -4,7 +4,7 @@ namespace Sabre\DAV; -use Sabre\DAVServerTest; +use Sabre\AbstractDAVServerTestCase; use Sabre\HTTP; /** @@ -14,7 +14,7 @@ * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License */ -class HttpPutTest extends DAVServerTest +class HttpPutTest extends AbstractDAVServerTestCase { /** * Sets up the DAV tree. diff --git a/tests/Sabre/DAV/Locks/Backend/PDOMySQLTest.php b/tests/Sabre/DAV/Locks/Backend/AbstractPDOMySQLTest.php similarity index 65% rename from tests/Sabre/DAV/Locks/Backend/PDOMySQLTest.php rename to tests/Sabre/DAV/Locks/Backend/AbstractPDOMySQLTest.php index 86ffc0bb32..e9d611dd8a 100644 --- a/tests/Sabre/DAV/Locks/Backend/PDOMySQLTest.php +++ b/tests/Sabre/DAV/Locks/Backend/AbstractPDOMySQLTest.php @@ -4,7 +4,7 @@ namespace Sabre\DAV\Locks\Backend; -class PDOMySQLTest extends PDOTest +class AbstractPDOMySQLTest extends AbstractPDOTestCase { public $driver = 'mysql'; } diff --git a/tests/Sabre/DAV/Locks/Backend/PDOPgSqlTest.php b/tests/Sabre/DAV/Locks/Backend/AbstractPDOPgSqlTest.php similarity index 65% rename from tests/Sabre/DAV/Locks/Backend/PDOPgSqlTest.php rename to tests/Sabre/DAV/Locks/Backend/AbstractPDOPgSqlTest.php index 4ab0579444..0a6bc6353a 100644 --- a/tests/Sabre/DAV/Locks/Backend/PDOPgSqlTest.php +++ b/tests/Sabre/DAV/Locks/Backend/AbstractPDOPgSqlTest.php @@ -4,7 +4,7 @@ namespace Sabre\DAV\Locks\Backend; -class PDOPgSqlTest extends PDOTest +class AbstractPDOPgSqlTest extends AbstractPDOTestCase { public $driver = 'pgsql'; } diff --git a/tests/Sabre/DAV/Locks/Backend/PDOSqliteTest.php b/tests/Sabre/DAV/Locks/Backend/AbstractPDOSqliteTest.php similarity index 65% rename from tests/Sabre/DAV/Locks/Backend/PDOSqliteTest.php rename to tests/Sabre/DAV/Locks/Backend/AbstractPDOSqliteTest.php index f0c384d4c2..fb82a702ce 100644 --- a/tests/Sabre/DAV/Locks/Backend/PDOSqliteTest.php +++ b/tests/Sabre/DAV/Locks/Backend/AbstractPDOSqliteTest.php @@ -4,7 +4,7 @@ namespace Sabre\DAV\Locks\Backend; -class PDOSqliteTest extends PDOTest +class AbstractPDOSqliteTest extends AbstractPDOTestCase { public $driver = 'sqlite'; } diff --git a/tests/Sabre/DAV/Locks/Backend/PDOTest.php b/tests/Sabre/DAV/Locks/Backend/AbstractPDOTestCase.php similarity index 83% rename from tests/Sabre/DAV/Locks/Backend/PDOTest.php rename to tests/Sabre/DAV/Locks/Backend/AbstractPDOTestCase.php index f5ed98f507..b2b23ccd6b 100644 --- a/tests/Sabre/DAV/Locks/Backend/PDOTest.php +++ b/tests/Sabre/DAV/Locks/Backend/AbstractPDOTestCase.php @@ -4,7 +4,7 @@ namespace Sabre\DAV\Locks\Backend; -abstract class PDOTest extends AbstractTest +abstract class AbstractPDOTestCase extends AbstractTestCase { use \Sabre\DAV\DbTestHelperTrait; diff --git a/tests/Sabre/DAV/Locks/Backend/AbstractTest.php b/tests/Sabre/DAV/Locks/Backend/AbstractTestCase.php similarity index 98% rename from tests/Sabre/DAV/Locks/Backend/AbstractTest.php rename to tests/Sabre/DAV/Locks/Backend/AbstractTestCase.php index 1a7c5fa94a..73425e6b8f 100644 --- a/tests/Sabre/DAV/Locks/Backend/AbstractTest.php +++ b/tests/Sabre/DAV/Locks/Backend/AbstractTestCase.php @@ -4,9 +4,10 @@ namespace Sabre\DAV\Locks\Backend; +use PHPUnit\Framework\TestCase; use Sabre\DAV; -abstract class AbstractTest extends \PHPUnit\Framework\TestCase +abstract class AbstractTestCase extends TestCase { /** * @abstract diff --git a/tests/Sabre/DAV/Locks/Backend/FileTest.php b/tests/Sabre/DAV/Locks/Backend/FileTest.php index f96c09e282..90c5b4d4d7 100644 --- a/tests/Sabre/DAV/Locks/Backend/FileTest.php +++ b/tests/Sabre/DAV/Locks/Backend/FileTest.php @@ -4,7 +4,7 @@ namespace Sabre\DAV\Locks\Backend; -class FileTest extends AbstractTest +class FileTest extends AbstractTestCase { public function getBackend() { diff --git a/tests/Sabre/DAV/Locks/Plugin2Test.php b/tests/Sabre/DAV/Locks/Plugin2Test.php index 9548363e9d..ec8b2385c8 100644 --- a/tests/Sabre/DAV/Locks/Plugin2Test.php +++ b/tests/Sabre/DAV/Locks/Plugin2Test.php @@ -6,7 +6,7 @@ use Sabre\HTTP\Request; -class Plugin2Test extends \Sabre\DAVServerTest +class Plugin2Test extends \Sabre\AbstractDAVServerTestCase { public $setupLocks = true; diff --git a/tests/Sabre/DAV/Locks/PluginTest.php b/tests/Sabre/DAV/Locks/PluginTest.php index 70530d2f53..66f16abd81 100644 --- a/tests/Sabre/DAV/Locks/PluginTest.php +++ b/tests/Sabre/DAV/Locks/PluginTest.php @@ -7,7 +7,7 @@ use Sabre\DAV; use Sabre\HTTP; -class PluginTest extends DAV\AbstractServer +class PluginTest extends DAV\AbstractServerTestCase { /** * @var Plugin diff --git a/tests/Sabre/DAV/Mount/PluginTest.php b/tests/Sabre/DAV/Mount/PluginTest.php index 12f75cb363..e630d561f8 100644 --- a/tests/Sabre/DAV/Mount/PluginTest.php +++ b/tests/Sabre/DAV/Mount/PluginTest.php @@ -7,7 +7,7 @@ use Sabre\DAV; use Sabre\HTTP; -class PluginTest extends DAV\AbstractServer +class PluginTest extends DAV\AbstractServerTestCase { public function setup(): void { diff --git a/tests/Sabre/DAV/PartialUpdate/PluginTest.php b/tests/Sabre/DAV/PartialUpdate/PluginTest.php index deb18b5a4a..035813578b 100644 --- a/tests/Sabre/DAV/PartialUpdate/PluginTest.php +++ b/tests/Sabre/DAV/PartialUpdate/PluginTest.php @@ -6,7 +6,7 @@ use Sabre\HTTP; -class PluginTest extends \Sabre\DAVServerTest +class PluginTest extends \Sabre\AbstractDAVServerTestCase { protected $node; protected $plugin; diff --git a/tests/Sabre/DAV/PropertyStorage/Backend/AbstractPDOTest.php b/tests/Sabre/DAV/PropertyStorage/Backend/AbstractPDOTestCase.php similarity index 97% rename from tests/Sabre/DAV/PropertyStorage/Backend/AbstractPDOTest.php rename to tests/Sabre/DAV/PropertyStorage/Backend/AbstractPDOTestCase.php index 79dcdb6dd9..0c8571080f 100644 --- a/tests/Sabre/DAV/PropertyStorage/Backend/AbstractPDOTest.php +++ b/tests/Sabre/DAV/PropertyStorage/Backend/AbstractPDOTestCase.php @@ -4,14 +4,16 @@ namespace Sabre\DAV\PropertyStorage\Backend; +use PHPUnit\Framework\TestCase; +use Sabre\DAV\DbTestHelperTrait; use Sabre\DAV\PropFind; use Sabre\DAV\PropPatch; use Sabre\DAV\Xml\Property\Complex; use Sabre\DAV\Xml\Property\Href; -abstract class AbstractPDOTest extends \PHPUnit\Framework\TestCase +abstract class AbstractPDOTestCase extends TestCase { - use \Sabre\DAV\DbTestHelperTrait; + use DbTestHelperTrait; public function getBackend() { diff --git a/tests/Sabre/DAV/PropertyStorage/Backend/PDOMysqlTest.php b/tests/Sabre/DAV/PropertyStorage/Backend/PDOMysqlTest.php index 6e11317c20..92d60837ac 100644 --- a/tests/Sabre/DAV/PropertyStorage/Backend/PDOMysqlTest.php +++ b/tests/Sabre/DAV/PropertyStorage/Backend/PDOMysqlTest.php @@ -4,7 +4,7 @@ namespace Sabre\DAV\PropertyStorage\Backend; -class PDOMysqlTest extends AbstractPDOTest +class PDOMysqlTest extends AbstractPDOTestCase { public $driver = 'mysql'; } diff --git a/tests/Sabre/DAV/PropertyStorage/Backend/PDOPgSqlTest.php b/tests/Sabre/DAV/PropertyStorage/Backend/PDOPgSqlTest.php index 23955f35d8..cd8883a07e 100644 --- a/tests/Sabre/DAV/PropertyStorage/Backend/PDOPgSqlTest.php +++ b/tests/Sabre/DAV/PropertyStorage/Backend/PDOPgSqlTest.php @@ -4,7 +4,7 @@ namespace Sabre\DAV\PropertyStorage\Backend; -class PDOPgSqlTest extends AbstractPDOTest +class PDOPgSqlTest extends AbstractPDOTestCase { public $driver = 'pgsql'; } diff --git a/tests/Sabre/DAV/PropertyStorage/Backend/PDOSqliteTest.php b/tests/Sabre/DAV/PropertyStorage/Backend/PDOSqliteTest.php index 37b0ed205d..89228e0d54 100644 --- a/tests/Sabre/DAV/PropertyStorage/Backend/PDOSqliteTest.php +++ b/tests/Sabre/DAV/PropertyStorage/Backend/PDOSqliteTest.php @@ -4,7 +4,7 @@ namespace Sabre\DAV\PropertyStorage\Backend; -class PDOSqliteTest extends AbstractPDOTest +class PDOSqliteTest extends AbstractPDOTestCase { public $driver = 'sqlite'; } diff --git a/tests/Sabre/DAV/PropertyStorage/PluginTest.php b/tests/Sabre/DAV/PropertyStorage/PluginTest.php index 7a5d417f48..fd083d467a 100644 --- a/tests/Sabre/DAV/PropertyStorage/PluginTest.php +++ b/tests/Sabre/DAV/PropertyStorage/PluginTest.php @@ -4,7 +4,7 @@ namespace Sabre\DAV\PropertyStorage; -class PluginTest extends \Sabre\DAVServerTest +class PluginTest extends \Sabre\AbstractDAVServerTestCase { protected $backend; protected $plugin; diff --git a/tests/Sabre/DAV/ServerEventsTest.php b/tests/Sabre/DAV/ServerEventsTest.php index e4db38ce44..b7de1c3826 100644 --- a/tests/Sabre/DAV/ServerEventsTest.php +++ b/tests/Sabre/DAV/ServerEventsTest.php @@ -6,7 +6,7 @@ use Sabre\HTTP; -class ServerEventsTest extends AbstractServer +class ServerEventsTest extends AbstractServerTestCase { private $tempPath; diff --git a/tests/Sabre/DAV/ServerMKCOLTest.php b/tests/Sabre/DAV/ServerMKCOLTest.php index 56653dc7db..9e9dfb88bc 100644 --- a/tests/Sabre/DAV/ServerMKCOLTest.php +++ b/tests/Sabre/DAV/ServerMKCOLTest.php @@ -6,7 +6,7 @@ use Sabre\HTTP; -class ServerMKCOLTest extends AbstractServer +class ServerMKCOLTest extends AbstractServerTestCase { public function testMkcol() { diff --git a/tests/Sabre/DAV/ServerPluginTest.php b/tests/Sabre/DAV/ServerPluginTest.php index fc613beef5..19d99b9953 100644 --- a/tests/Sabre/DAV/ServerPluginTest.php +++ b/tests/Sabre/DAV/ServerPluginTest.php @@ -6,10 +6,10 @@ use Sabre\HTTP; -class ServerPluginTest extends AbstractServer +class ServerPluginTest extends AbstractServerTestCase { /** - * @var Sabre\DAV\TestPlugin + * @var TestPlugin */ protected $testPlugin; diff --git a/tests/Sabre/DAV/ServerPropsInfiniteDepthTest.php b/tests/Sabre/DAV/ServerPropsInfiniteDepthTest.php index db28680816..c60e3899ba 100644 --- a/tests/Sabre/DAV/ServerPropsInfiniteDepthTest.php +++ b/tests/Sabre/DAV/ServerPropsInfiniteDepthTest.php @@ -6,7 +6,7 @@ use Sabre\HTTP; -class ServerPropsInfiniteDepthTest extends AbstractServer +class ServerPropsInfiniteDepthTest extends AbstractServerTestCase { protected function getRootNode() { diff --git a/tests/Sabre/DAV/ServerPropsTest.php b/tests/Sabre/DAV/ServerPropsTest.php index 6f4626f0fd..398f04f53c 100644 --- a/tests/Sabre/DAV/ServerPropsTest.php +++ b/tests/Sabre/DAV/ServerPropsTest.php @@ -6,7 +6,7 @@ use Sabre\HTTP; -class ServerPropsTest extends AbstractServer +class ServerPropsTest extends AbstractServerTestCase { protected function getRootNode() { diff --git a/tests/Sabre/DAV/ServerRangeTest.php b/tests/Sabre/DAV/ServerRangeTest.php index d06a4ad6a4..17ca773844 100644 --- a/tests/Sabre/DAV/ServerRangeTest.php +++ b/tests/Sabre/DAV/ServerRangeTest.php @@ -14,7 +14,7 @@ * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License */ -class ServerRangeTest extends \Sabre\DAVServerTest +class ServerRangeTest extends \Sabre\AbstractDAVServerTestCase { protected $setupFiles = true; diff --git a/tests/Sabre/DAV/ServerSimpleTest.php b/tests/Sabre/DAV/ServerSimpleTest.php index c8222227f8..9f741879d9 100644 --- a/tests/Sabre/DAV/ServerSimpleTest.php +++ b/tests/Sabre/DAV/ServerSimpleTest.php @@ -6,7 +6,7 @@ use Sabre\HTTP; -class ServerSimpleTest extends AbstractServer +class ServerSimpleTest extends AbstractServerTestCase { public function testConstructArray() { diff --git a/tests/Sabre/DAV/Sharing/PluginTest.php b/tests/Sabre/DAV/Sharing/PluginTest.php index 71767050e8..2da35529c9 100644 --- a/tests/Sabre/DAV/Sharing/PluginTest.php +++ b/tests/Sabre/DAV/Sharing/PluginTest.php @@ -7,7 +7,7 @@ use Sabre\DAV\Mock; use Sabre\DAV\Xml\Property; -class PluginTest extends \Sabre\DAVServerTest +class PluginTest extends \Sabre\AbstractDAVServerTestCase { protected $setupSharing = true; protected $setupACL = true; diff --git a/tests/Sabre/DAV/Sharing/ShareResourceTest.php b/tests/Sabre/DAV/Sharing/ShareResourceTest.php index 2f39febbe2..aa1092e906 100644 --- a/tests/Sabre/DAV/Sharing/ShareResourceTest.php +++ b/tests/Sabre/DAV/Sharing/ShareResourceTest.php @@ -8,7 +8,7 @@ use Sabre\DAV\Xml\Element\Sharee; use Sabre\HTTP\Request; -class ShareResourceTest extends \Sabre\DAVServerTest +class ShareResourceTest extends \Sabre\AbstractDAVServerTestCase { protected $setupSharing = true; protected $sharingNodeMock; diff --git a/tests/Sabre/DAV/Sync/PluginTest.php b/tests/Sabre/DAV/Sync/PluginTest.php index b5bc96e3eb..bfe0d157a6 100644 --- a/tests/Sabre/DAV/Sync/PluginTest.php +++ b/tests/Sabre/DAV/Sync/PluginTest.php @@ -7,7 +7,7 @@ use Sabre\DAV; use Sabre\HTTP; -class PluginTest extends \Sabre\DAVServerTest +class PluginTest extends \Sabre\AbstractDAVServerTestCase { protected $collection; diff --git a/tests/Sabre/DAV/SyncTokenPropertyTest.php b/tests/Sabre/DAV/SyncTokenPropertyTest.php index ece6f59b82..6603dbbf1d 100644 --- a/tests/Sabre/DAV/SyncTokenPropertyTest.php +++ b/tests/Sabre/DAV/SyncTokenPropertyTest.php @@ -4,7 +4,7 @@ namespace Sabre\DAV; -class SyncTokenPropertyTest extends \Sabre\DAVServerTest +class SyncTokenPropertyTest extends \Sabre\AbstractDAVServerTestCase { /** * The assumption in these tests is that a PROPFIND is going on, and to diff --git a/tests/Sabre/DAV/TemporaryFileFilterTest.php b/tests/Sabre/DAV/TemporaryFileFilterTest.php index 95469141e5..5082a0f73f 100644 --- a/tests/Sabre/DAV/TemporaryFileFilterTest.php +++ b/tests/Sabre/DAV/TemporaryFileFilterTest.php @@ -6,7 +6,7 @@ use Sabre\HTTP; -class TemporaryFileFilterTest extends AbstractServer +class TemporaryFileFilterTest extends AbstractServerTestCase { public function setup(): void { diff --git a/tests/Sabre/DAV/Xml/XmlTest.php b/tests/Sabre/DAV/Xml/AbstractXmlTestCase.php similarity index 92% rename from tests/Sabre/DAV/Xml/XmlTest.php rename to tests/Sabre/DAV/Xml/AbstractXmlTestCase.php index c556767adf..d44fff59a5 100644 --- a/tests/Sabre/DAV/Xml/XmlTest.php +++ b/tests/Sabre/DAV/Xml/AbstractXmlTestCase.php @@ -4,10 +4,11 @@ namespace Sabre\DAV\Xml; +use PHPUnit\Framework\TestCase; use Sabre\Xml\Reader; use Sabre\Xml\Writer; -abstract class XmlTest extends \PHPUnit\Framework\TestCase +abstract class AbstractXmlTestCase extends TestCase { protected $elementMap = []; protected $namespaceMap = ['DAV:' => 'd']; diff --git a/tests/Sabre/DAV/Xml/Element/PropTest.php b/tests/Sabre/DAV/Xml/Element/PropTest.php index 91bd2a92cb..939addedae 100644 --- a/tests/Sabre/DAV/Xml/Element/PropTest.php +++ b/tests/Sabre/DAV/Xml/Element/PropTest.php @@ -4,11 +4,11 @@ namespace Sabre\DAV\Xml\Element; +use Sabre\DAV\Xml\AbstractXmlTestCase; use Sabre\DAV\Xml\Property\Complex; use Sabre\DAV\Xml\Property\Href; -use Sabre\DAV\Xml\XmlTest; -class PropTest extends XmlTest +class PropTest extends AbstractXmlTestCase { public function testDeserializeSimple() { diff --git a/tests/Sabre/DAV/Xml/Element/ResponseTest.php b/tests/Sabre/DAV/Xml/Element/ResponseTest.php index 0950acce61..9863475ccd 100644 --- a/tests/Sabre/DAV/Xml/Element/ResponseTest.php +++ b/tests/Sabre/DAV/Xml/Element/ResponseTest.php @@ -6,7 +6,7 @@ use Sabre\DAV; -class ResponseTest extends DAV\Xml\XmlTest +class ResponseTest extends DAV\Xml\AbstractXmlTestCase { public function testSimple() { diff --git a/tests/Sabre/DAV/Xml/Element/ShareeTest.php b/tests/Sabre/DAV/Xml/Element/ShareeTest.php index 22c21d5897..ff1ba307ef 100644 --- a/tests/Sabre/DAV/Xml/Element/ShareeTest.php +++ b/tests/Sabre/DAV/Xml/Element/ShareeTest.php @@ -5,9 +5,9 @@ namespace Sabre\DAV\Xml\Element; use Sabre\DAV\Sharing\Plugin; -use Sabre\DAV\Xml\XmlTest; +use Sabre\DAV\Xml\AbstractXmlTestCase; -class ShareeTest extends XmlTest +class ShareeTest extends AbstractXmlTestCase { public function testShareeUnknownPropertyInConstructor() { diff --git a/tests/Sabre/DAV/Xml/Property/HrefTest.php b/tests/Sabre/DAV/Xml/Property/HrefTest.php index b2c9ac8b75..dcc564b26b 100644 --- a/tests/Sabre/DAV/Xml/Property/HrefTest.php +++ b/tests/Sabre/DAV/Xml/Property/HrefTest.php @@ -5,9 +5,9 @@ namespace Sabre\DAV\Xml\Property; use Sabre\DAV\Browser\HtmlOutputHelper; -use Sabre\DAV\Xml\XmlTest; +use Sabre\DAV\Xml\AbstractXmlTestCase; -class HrefTest extends XmlTest +class HrefTest extends AbstractXmlTestCase { public function testConstruct() { diff --git a/tests/Sabre/DAV/Xml/Property/InviteTest.php b/tests/Sabre/DAV/Xml/Property/InviteTest.php index 0a18649bcb..9f43f7e6f2 100644 --- a/tests/Sabre/DAV/Xml/Property/InviteTest.php +++ b/tests/Sabre/DAV/Xml/Property/InviteTest.php @@ -5,10 +5,10 @@ namespace Sabre\DAV\Xml\Property; use Sabre\DAV\Sharing\Plugin; +use Sabre\DAV\Xml\AbstractXmlTestCase; use Sabre\DAV\Xml\Element\Sharee; -use Sabre\DAV\Xml\XmlTest; -class InviteTest extends XmlTest +class InviteTest extends AbstractXmlTestCase { public function testSerialize() { diff --git a/tests/Sabre/DAV/Xml/Property/LastModifiedTest.php b/tests/Sabre/DAV/Xml/Property/LastModifiedTest.php index 4fda0771a3..ffce1366ce 100644 --- a/tests/Sabre/DAV/Xml/Property/LastModifiedTest.php +++ b/tests/Sabre/DAV/Xml/Property/LastModifiedTest.php @@ -6,9 +6,9 @@ use DateTime; use DateTimeZone; -use Sabre\DAV\Xml\XmlTest; +use Sabre\DAV\Xml\AbstractXmlTestCase; -class LastModifiedTest extends XmlTest +class LastModifiedTest extends AbstractXmlTestCase { public function testSerializeDateTime() { diff --git a/tests/Sabre/DAV/Xml/Property/LocalHrefTest.php b/tests/Sabre/DAV/Xml/Property/LocalHrefTest.php index 42a4017b83..a03da08e0d 100644 --- a/tests/Sabre/DAV/Xml/Property/LocalHrefTest.php +++ b/tests/Sabre/DAV/Xml/Property/LocalHrefTest.php @@ -5,9 +5,9 @@ namespace Sabre\DAV\Xml\Property; use Sabre\DAV\Browser\HtmlOutputHelper; -use Sabre\DAV\Xml\XmlTest; +use Sabre\DAV\Xml\AbstractXmlTestCase; -class LocalHrefTest extends XmlTest +class LocalHrefTest extends AbstractXmlTestCase { public function testConstruct() { diff --git a/tests/Sabre/DAV/Xml/Property/LockDiscoveryTest.php b/tests/Sabre/DAV/Xml/Property/LockDiscoveryTest.php index 1cc279e153..a68877206b 100644 --- a/tests/Sabre/DAV/Xml/Property/LockDiscoveryTest.php +++ b/tests/Sabre/DAV/Xml/Property/LockDiscoveryTest.php @@ -5,9 +5,9 @@ namespace Sabre\DAV\Xml\Property; use Sabre\DAV\Locks\LockInfo; -use Sabre\DAV\Xml\XmlTest; +use Sabre\DAV\Xml\AbstractXmlTestCase; -class LockDiscoveryTest extends XmlTest +class LockDiscoveryTest extends AbstractXmlTestCase { public function testSerialize() { diff --git a/tests/Sabre/DAV/Xml/Property/ShareAccessTest.php b/tests/Sabre/DAV/Xml/Property/ShareAccessTest.php index 716f5ecbd0..1959bb12b5 100644 --- a/tests/Sabre/DAV/Xml/Property/ShareAccessTest.php +++ b/tests/Sabre/DAV/Xml/Property/ShareAccessTest.php @@ -5,9 +5,9 @@ namespace Sabre\DAV\Xml\Property; use Sabre\DAV\Sharing\Plugin; -use Sabre\DAV\Xml\XmlTest; +use Sabre\DAV\Xml\AbstractXmlTestCase; -class ShareAccessTest extends XmlTest +class ShareAccessTest extends AbstractXmlTestCase { public function testSerialize() { diff --git a/tests/Sabre/DAV/Xml/Property/SupportedMethodSetTest.php b/tests/Sabre/DAV/Xml/Property/SupportedMethodSetTest.php index 2efedd2e8c..3df5d3fbbf 100644 --- a/tests/Sabre/DAV/Xml/Property/SupportedMethodSetTest.php +++ b/tests/Sabre/DAV/Xml/Property/SupportedMethodSetTest.php @@ -4,9 +4,9 @@ namespace Sabre\DAV\Xml\Property; -use Sabre\DAV\Xml\XmlTest; +use Sabre\DAV\Xml\AbstractXmlTestCase; -class SupportedMethodSetTest extends XmlTest +class SupportedMethodSetTest extends AbstractXmlTestCase { public function testSimple() { diff --git a/tests/Sabre/DAV/Xml/Property/SupportedReportSetTest.php b/tests/Sabre/DAV/Xml/Property/SupportedReportSetTest.php index 6fd03e95f6..113ab4e7d8 100644 --- a/tests/Sabre/DAV/Xml/Property/SupportedReportSetTest.php +++ b/tests/Sabre/DAV/Xml/Property/SupportedReportSetTest.php @@ -7,7 +7,7 @@ use Sabre\DAV; use Sabre\HTTP; -class SupportedReportSetTest extends DAV\AbstractServer +class SupportedReportSetTest extends DAV\AbstractServerTestCase { public function sendPROPFIND($body) { diff --git a/tests/Sabre/DAV/Xml/Request/PropFindTest.php b/tests/Sabre/DAV/Xml/Request/PropFindTest.php index 48e212f554..bad1d0b198 100644 --- a/tests/Sabre/DAV/Xml/Request/PropFindTest.php +++ b/tests/Sabre/DAV/Xml/Request/PropFindTest.php @@ -4,9 +4,9 @@ namespace Sabre\DAV\Xml\Request; -use Sabre\DAV\Xml\XmlTest; +use Sabre\DAV\Xml\AbstractXmlTestCase; -class PropFindTest extends XmlTest +class PropFindTest extends AbstractXmlTestCase { public function testDeserializeProp() { diff --git a/tests/Sabre/DAV/Xml/Request/PropPatchTest.php b/tests/Sabre/DAV/Xml/Request/PropPatchTest.php index 674b76bd24..e6ffb801d5 100644 --- a/tests/Sabre/DAV/Xml/Request/PropPatchTest.php +++ b/tests/Sabre/DAV/Xml/Request/PropPatchTest.php @@ -4,10 +4,10 @@ namespace Sabre\DAV\Xml\Request; +use Sabre\DAV\Xml\AbstractXmlTestCase; use Sabre\DAV\Xml\Property\Href; -use Sabre\DAV\Xml\XmlTest; -class PropPatchTest extends XmlTest +class PropPatchTest extends AbstractXmlTestCase { public function testSerialize() { diff --git a/tests/Sabre/DAV/Xml/Request/ShareResourceTest.php b/tests/Sabre/DAV/Xml/Request/ShareResourceTest.php index f089048cab..aac66c9aac 100644 --- a/tests/Sabre/DAV/Xml/Request/ShareResourceTest.php +++ b/tests/Sabre/DAV/Xml/Request/ShareResourceTest.php @@ -5,10 +5,10 @@ namespace Sabre\DAV\Xml\Request; use Sabre\DAV\Sharing\Plugin; +use Sabre\DAV\Xml\AbstractXmlTestCase; use Sabre\DAV\Xml\Element\Sharee; -use Sabre\DAV\Xml\XmlTest; -class ShareResourceTest extends XmlTest +class ShareResourceTest extends AbstractXmlTestCase { public function testDeserialize() { diff --git a/tests/Sabre/DAV/Xml/Request/SyncCollectionTest.php b/tests/Sabre/DAV/Xml/Request/SyncCollectionTest.php index 7cc2d3806e..8cb811c4f2 100644 --- a/tests/Sabre/DAV/Xml/Request/SyncCollectionTest.php +++ b/tests/Sabre/DAV/Xml/Request/SyncCollectionTest.php @@ -4,9 +4,9 @@ namespace Sabre\DAV\Xml\Request; -use Sabre\DAV\Xml\XmlTest; +use Sabre\DAV\Xml\AbstractXmlTestCase; -class SyncCollectionTest extends XmlTest +class SyncCollectionTest extends AbstractXmlTestCase { public function testDeserializeProp() { diff --git a/tests/Sabre/DAVACL/AclPrincipalPropSetReportTest.php b/tests/Sabre/DAVACL/AclPrincipalPropSetReportTest.php index 03b621dc9e..a5184cf600 100644 --- a/tests/Sabre/DAVACL/AclPrincipalPropSetReportTest.php +++ b/tests/Sabre/DAVACL/AclPrincipalPropSetReportTest.php @@ -6,7 +6,7 @@ use Sabre\HTTP\Request; -class AclPrincipalPropSetReportTest extends \Sabre\DAVServerTest +class AclPrincipalPropSetReportTest extends \Sabre\AbstractDAVServerTestCase { public $setupACL = true; public $autoLogin = 'admin'; diff --git a/tests/Sabre/DAVACL/PrincipalBackend/AbstractPDOTest.php b/tests/Sabre/DAVACL/PrincipalBackend/AbstractPDOTestCase.php similarity index 88% rename from tests/Sabre/DAVACL/PrincipalBackend/AbstractPDOTest.php rename to tests/Sabre/DAVACL/PrincipalBackend/AbstractPDOTestCase.php index 476a608c40..ac5af45aab 100644 --- a/tests/Sabre/DAVACL/PrincipalBackend/AbstractPDOTest.php +++ b/tests/Sabre/DAVACL/PrincipalBackend/AbstractPDOTestCase.php @@ -4,9 +4,10 @@ namespace Sabre\DAVACL\PrincipalBackend; +use PHPUnit\Framework\TestCase; use Sabre\DAV; -abstract class AbstractPDOTest extends \PHPUnit\Framework\TestCase +abstract class AbstractPDOTestCase extends TestCase { use DAV\DbTestHelperTrait; @@ -23,17 +24,17 @@ public function setup(): void $pdo->query('INSERT INTO groupmembers (principal_id,member_id) VALUES (5,4)'); } - public function testConstruct() + public function testConstruct(): void { $pdo = $this->getPDO(); $backend = new PDO($pdo); - self::assertTrue($backend instanceof PDO); + self::assertInstanceOf(PDO::class, $backend); } /** * @depends testConstruct */ - public function testGetPrincipalsByPrefix() + public function testGetPrincipalsByPrefix(): void { $pdo = $this->getPDO(); $backend = new PDO($pdo); @@ -63,7 +64,7 @@ public function testGetPrincipalsByPrefix() /** * @depends testConstruct */ - public function testGetPrincipalByPath() + public function testGetPrincipalByPath(): void { $pdo = $this->getPDO(); $backend = new PDO($pdo); @@ -79,7 +80,7 @@ public function testGetPrincipalByPath() self::assertEquals(null, $backend->getPrincipalByPath('foo')); } - public function testGetGroupMemberSet() + public function testGetGroupMemberSet(): void { $pdo = $this->getPDO(); $backend = new PDO($pdo); @@ -88,7 +89,7 @@ public function testGetGroupMemberSet() self::assertEquals($expected, $backend->getGroupMemberSet('principals/group')); } - public function testGetGroupMembership() + public function testGetGroupMembership(): void { $pdo = $this->getPDO(); $backend = new PDO($pdo); @@ -97,7 +98,7 @@ public function testGetGroupMembership() self::assertEquals($expected, $backend->getGroupMembership('principals/user')); } - public function testSetGroupMemberSet() + public function testSetGroupMemberSet(): void { $pdo = $this->getPDO(); @@ -114,7 +115,7 @@ public function testSetGroupMemberSet() self::assertEquals(['principals/user'], $backend->getGroupMemberSet('principals/group')); } - public function testSearchPrincipals() + public function testSearchPrincipals(): void { $pdo = $this->getPDO(); @@ -133,7 +134,7 @@ public function testSearchPrincipals() self::assertEquals([], $result); } - public function testUpdatePrincipal() + public function testUpdatePrincipal(): void { $pdo = $this->getPDO(); $backend = new PDO($pdo); @@ -155,7 +156,7 @@ public function testUpdatePrincipal() ], $backend->getPrincipalByPath('principals/user')); } - public function testUpdatePrincipalUnknownField() + public function testUpdatePrincipalUnknownField(): void { $pdo = $this->getPDO(); $backend = new PDO($pdo); @@ -183,14 +184,14 @@ public function testUpdatePrincipalUnknownField() ], $backend->getPrincipalByPath('principals/user')); } - public function testFindByUriUnknownScheme() + public function testFindByUriUnknownScheme(): void { $pdo = $this->getPDO(); $backend = new PDO($pdo); self::assertNull($backend->findByUri('http://foo', 'principals')); } - public function testFindByUriWithMailtoAddress() + public function testFindByUriWithMailtoAddress(): void { $pdo = $this->getPDO(); $backend = new PDO($pdo); @@ -200,7 +201,7 @@ public function testFindByUriWithMailtoAddress() ); } - public function testFindByUriWithUri() + public function testFindByUriWithUri(): void { $pdo = $this->getPDO(); $backend = new PDO($pdo); @@ -210,7 +211,7 @@ public function testFindByUriWithUri() ); } - public function testFindByUriWithUnknownUri() + public function testFindByUriWithUnknownUri(): void { $pdo = $this->getPDO(); $backend = new PDO($pdo); diff --git a/tests/Sabre/DAVACL/PrincipalBackend/PDOMySQLTest.php b/tests/Sabre/DAVACL/PrincipalBackend/PDOMySQLTest.php index 54795cf4d8..f726a14ea8 100644 --- a/tests/Sabre/DAVACL/PrincipalBackend/PDOMySQLTest.php +++ b/tests/Sabre/DAVACL/PrincipalBackend/PDOMySQLTest.php @@ -4,7 +4,7 @@ namespace Sabre\DAVACL\PrincipalBackend; -class PDOMySQLTest extends AbstractPDOTest +class PDOMySQLTest extends AbstractPDOTestCase { public $driver = 'mysql'; } diff --git a/tests/Sabre/DAVACL/PrincipalBackend/PDOPgSqlTest.php b/tests/Sabre/DAVACL/PrincipalBackend/PDOPgSqlTest.php index 7abc816ff1..08e1d04012 100644 --- a/tests/Sabre/DAVACL/PrincipalBackend/PDOPgSqlTest.php +++ b/tests/Sabre/DAVACL/PrincipalBackend/PDOPgSqlTest.php @@ -4,7 +4,7 @@ namespace Sabre\DAVACL\PrincipalBackend; -class PDOPgSqlTest extends AbstractPDOTest +class PDOPgSqlTest extends AbstractPDOTestCase { public $driver = 'pgsql'; } diff --git a/tests/Sabre/DAVACL/PrincipalBackend/PDOSqliteTest.php b/tests/Sabre/DAVACL/PrincipalBackend/PDOSqliteTest.php index 549e0bd60e..48842ef750 100644 --- a/tests/Sabre/DAVACL/PrincipalBackend/PDOSqliteTest.php +++ b/tests/Sabre/DAVACL/PrincipalBackend/PDOSqliteTest.php @@ -4,7 +4,7 @@ namespace Sabre\DAVACL\PrincipalBackend; -class PDOSqliteTest extends AbstractPDOTest +class PDOSqliteTest extends AbstractPDOTestCase { public $driver = 'sqlite'; } diff --git a/tests/Sabre/DAVACL/PrincipalMatchTest.php b/tests/Sabre/DAVACL/PrincipalMatchTest.php index b4515863d7..8321eeee1f 100644 --- a/tests/Sabre/DAVACL/PrincipalMatchTest.php +++ b/tests/Sabre/DAVACL/PrincipalMatchTest.php @@ -6,7 +6,7 @@ use Sabre\HTTP\Request; -class PrincipalMatchTest extends \Sabre\DAVServerTest +class PrincipalMatchTest extends \Sabre\AbstractDAVServerTestCase { public $setupACL = true; public $autoLogin = 'user1'; diff --git a/tests/Sabre/DAVACL/Xml/Request/AclPrincipalPropSetReportTest.php b/tests/Sabre/DAVACL/Xml/Request/AclPrincipalPropSetReportTest.php index de24d9aba6..4909792fcf 100644 --- a/tests/Sabre/DAVACL/Xml/Request/AclPrincipalPropSetReportTest.php +++ b/tests/Sabre/DAVACL/Xml/Request/AclPrincipalPropSetReportTest.php @@ -4,7 +4,7 @@ namespace Sabre\DAVACL\Xml\Request; -class AclPrincipalPropSetReportTest extends \Sabre\DAV\Xml\XmlTest +class AclPrincipalPropSetReportTest extends \Sabre\DAV\Xml\AbstractXmlTestCase { protected $elementMap = [ '{DAV:}acl-principal-prop-set' => 'Sabre\DAVACL\Xml\Request\AclPrincipalPropSetReport', diff --git a/tests/Sabre/DAVACL/Xml/Request/PrincipalMatchReportTest.php b/tests/Sabre/DAVACL/Xml/Request/PrincipalMatchReportTest.php index 209b21259c..bc890f8d41 100644 --- a/tests/Sabre/DAVACL/Xml/Request/PrincipalMatchReportTest.php +++ b/tests/Sabre/DAVACL/Xml/Request/PrincipalMatchReportTest.php @@ -4,7 +4,9 @@ namespace Sabre\DAVACL\Xml\Request; -class PrincipalMatchReportTest extends \Sabre\DAV\Xml\XmlTest +use Sabre\DAV\Xml\AbstractXmlTestCase; + +class PrincipalMatchReportTest extends AbstractXmlTestCase { protected $elementMap = [ '{DAV:}principal-match' => 'Sabre\DAVACL\Xml\Request\PrincipalMatchReport', diff --git a/tests/phpunit.xml b/tests/phpunit.xml index 9186dfc307..8a3dc7dcbb 100644 --- a/tests/phpunit.xml +++ b/tests/phpunit.xml @@ -6,9 +6,6 @@ - - ../vendor/sabre/http/tests/HTTP - Sabre/DAV