]> git.mxchange.org Git - friendica-addons.git/commitdiff
Disable WebDav test because of impossible execution (yet)
authorPhilipp <admin@philipp.info>
Tue, 5 Oct 2021 08:31:35 +0000 (10:31 +0200)
committerPhilipp <admin@philipp.info>
Tue, 5 Oct 2021 08:31:35 +0000 (10:31 +0200)
webdav_storage/tests/WebDavTest.php [deleted file]
webdav_storage/tests/WebDavTest.php.bak [new file with mode: 0644]

diff --git a/webdav_storage/tests/WebDavTest.php b/webdav_storage/tests/WebDavTest.php
deleted file mode 100644 (file)
index 5c94ba3..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-<?php
-
-namespace Friendica\Addon\webdav_storage\tests;
-
-use Friendica\Addon\webdav_storage\src\WebDav;
-use Friendica\DI;
-use Friendica\Factory\HTTPClientFactory;
-use Friendica\Test\src\Model\Storage\StorageTest;
-use Friendica\Util\Logger\VoidLogger;
-
-/// @todo remove when constant is moved to a class constant
-/// Necessary for DB_UPDATE_VERSION constant in case of direct calls, where dbstructure isn't included during the calling process
-require_once __DIR__ . '/../../../static/dbstructure.config.php';
-
-class WebDavTest extends StorageTest
-{
-       public function dataMultiStatus()
-       {
-               return [
-                       'nextcloud' => [
-                               'xml' => <<<EOF
-<?xml version="1.0"?>
-<d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:oc="http://owncloud.org/ns"
-                          xmlns:nc="http://nextcloud.org/ns">
-       <d:response>
-               <d:href>/remote.php/dav/files/admin/Friendica_test/97/18/</d:href>
-               <d:propstat>
-                       <d:prop>
-                               <d:getlastmodified>Mon, 30 Aug 2021 12:58:54 GMT</d:getlastmodified>
-                               <d:resourcetype>
-                                       <d:collection/>
-                               </d:resourcetype>
-                               <d:quota-used-bytes>45017</d:quota-used-bytes>
-                               <d:quota-available-bytes>59180834349</d:quota-available-bytes>
-                               <d:getetag>&quot;612cd60ec9fd5&quot;</d:getetag>
-                       </d:prop>
-                       <d:status>HTTP/1.1 200 OK</d:status>
-               </d:propstat>
-       </d:response>
-       <d:response>
-               <d:href>
-                       /remote.php/dav/files/admin/Friendica_test/97/18/4d9d36f614dc005756bdfb9abbf1d8d24aa9ae842e5d6b5e7eb1dafbe767
-                                                                                                                         </d:href>
-               <d:propstat>
-                       <d:prop>
-                               <d:getlastmodified>Mon, 30 Aug 2021 12:58:54 GMT</d:getlastmodified>
-                               <d:getcontentlength>45017</d:getcontentlength>
-                               <d:resourcetype/>
-                               <d:getetag>&quot;4f7a144092532141d0e6b925e50a896e&quot;</d:getetag>
-                               <d:getcontenttype>application/octet-stream
-                               </d:getcontenttype>
-                       </d:prop>
-                       <d:status>HTTP/1.1 200 OK</d:status>
-               </d:propstat>
-               <d:propstat>
-                       <d:prop>
-                               <d:quota-used-bytes/>
-                               <d:quota-available-bytes/>
-                       </d:prop>
-                       <d:status>HTTP/1.1 404 Not Found
-                                                                          </d:status>
-               </d:propstat>
-       </d:response>
-</d:multistatus>
-EOF,
-                               'assertionCount' => 2,
-                       ],
-                       'onlyDir' => [
-                               'xml' => <<<EOF
-<d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:oc="http://owncloud.org/ns" xmlns:nc="http://nextcloud.org/ns">
-  <d:response>
-    <d:href>/remote.php/dav/files/admin/Friendica_test/34/cf/</d:href>
-    <d:propstat>
-      <d:prop>
-        <d:getlastmodified>Sun, 05 Sep 2021 17:56:05 GMT</d:getlastmodified>
-        <d:resourcetype>
-          <d:collection/>
-        </d:resourcetype>
-        <d:quota-used-bytes>0</d:quota-used-bytes>
-        <d:quota-available-bytes>59182800697</d:quota-available-bytes>
-        <d:getetag>"613504b55db4f"</d:getetag>
-      </d:prop>
-      <d:status>HTTP/1.1 200 OK</d:status>
-    </d:propstat>
-  </d:response>
-</d:multistatus>
-EOF,
-                               'assertionCount' => 1,
-                       ],
-               ];
-       }
-
-       /**
-        * @dataProvider dataMultiStatus
-        */
-       public function testMultistatus(string $xml, int $assertionCount)
-       {
-               $responseDoc = new \DOMDocument();
-               $responseDoc->loadXML($xml);
-
-               $xpath = new \DOMXPath($responseDoc);
-               $xpath->registerNamespace('d', 'DAV');
-
-               self::assertCount($assertionCount, $xpath->query('//d:multistatus/d:response'));
-       }
-
-       /**
-        * @inheritDoc
-        */
-       protected function getInstance()
-       {
-               /** @var HTTPClientFactory $factory */
-               $factory = DI::getDice()->create(HTTPClientFactory::class);
-
-               return new WebDav(getenv('WEBDAV_URL'), [
-                       getenv('WEBDAV_USERNAME'),
-                       getenv('WEBDAV_PASSWORD'),
-                       'basic',
-               ], $factory->createClient(), new VoidLogger());
-       }
-}
diff --git a/webdav_storage/tests/WebDavTest.php.bak b/webdav_storage/tests/WebDavTest.php.bak
new file mode 100644 (file)
index 0000000..5c94ba3
--- /dev/null
@@ -0,0 +1,121 @@
+<?php
+
+namespace Friendica\Addon\webdav_storage\tests;
+
+use Friendica\Addon\webdav_storage\src\WebDav;
+use Friendica\DI;
+use Friendica\Factory\HTTPClientFactory;
+use Friendica\Test\src\Model\Storage\StorageTest;
+use Friendica\Util\Logger\VoidLogger;
+
+/// @todo remove when constant is moved to a class constant
+/// Necessary for DB_UPDATE_VERSION constant in case of direct calls, where dbstructure isn't included during the calling process
+require_once __DIR__ . '/../../../static/dbstructure.config.php';
+
+class WebDavTest extends StorageTest
+{
+       public function dataMultiStatus()
+       {
+               return [
+                       'nextcloud' => [
+                               'xml' => <<<EOF
+<?xml version="1.0"?>
+<d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:oc="http://owncloud.org/ns"
+                          xmlns:nc="http://nextcloud.org/ns">
+       <d:response>
+               <d:href>/remote.php/dav/files/admin/Friendica_test/97/18/</d:href>
+               <d:propstat>
+                       <d:prop>
+                               <d:getlastmodified>Mon, 30 Aug 2021 12:58:54 GMT</d:getlastmodified>
+                               <d:resourcetype>
+                                       <d:collection/>
+                               </d:resourcetype>
+                               <d:quota-used-bytes>45017</d:quota-used-bytes>
+                               <d:quota-available-bytes>59180834349</d:quota-available-bytes>
+                               <d:getetag>&quot;612cd60ec9fd5&quot;</d:getetag>
+                       </d:prop>
+                       <d:status>HTTP/1.1 200 OK</d:status>
+               </d:propstat>
+       </d:response>
+       <d:response>
+               <d:href>
+                       /remote.php/dav/files/admin/Friendica_test/97/18/4d9d36f614dc005756bdfb9abbf1d8d24aa9ae842e5d6b5e7eb1dafbe767
+                                                                                                                         </d:href>
+               <d:propstat>
+                       <d:prop>
+                               <d:getlastmodified>Mon, 30 Aug 2021 12:58:54 GMT</d:getlastmodified>
+                               <d:getcontentlength>45017</d:getcontentlength>
+                               <d:resourcetype/>
+                               <d:getetag>&quot;4f7a144092532141d0e6b925e50a896e&quot;</d:getetag>
+                               <d:getcontenttype>application/octet-stream
+                               </d:getcontenttype>
+                       </d:prop>
+                       <d:status>HTTP/1.1 200 OK</d:status>
+               </d:propstat>
+               <d:propstat>
+                       <d:prop>
+                               <d:quota-used-bytes/>
+                               <d:quota-available-bytes/>
+                       </d:prop>
+                       <d:status>HTTP/1.1 404 Not Found
+                                                                          </d:status>
+               </d:propstat>
+       </d:response>
+</d:multistatus>
+EOF,
+                               'assertionCount' => 2,
+                       ],
+                       'onlyDir' => [
+                               'xml' => <<<EOF
+<d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:oc="http://owncloud.org/ns" xmlns:nc="http://nextcloud.org/ns">
+  <d:response>
+    <d:href>/remote.php/dav/files/admin/Friendica_test/34/cf/</d:href>
+    <d:propstat>
+      <d:prop>
+        <d:getlastmodified>Sun, 05 Sep 2021 17:56:05 GMT</d:getlastmodified>
+        <d:resourcetype>
+          <d:collection/>
+        </d:resourcetype>
+        <d:quota-used-bytes>0</d:quota-used-bytes>
+        <d:quota-available-bytes>59182800697</d:quota-available-bytes>
+        <d:getetag>"613504b55db4f"</d:getetag>
+      </d:prop>
+      <d:status>HTTP/1.1 200 OK</d:status>
+    </d:propstat>
+  </d:response>
+</d:multistatus>
+EOF,
+                               'assertionCount' => 1,
+                       ],
+               ];
+       }
+
+       /**
+        * @dataProvider dataMultiStatus
+        */
+       public function testMultistatus(string $xml, int $assertionCount)
+       {
+               $responseDoc = new \DOMDocument();
+               $responseDoc->loadXML($xml);
+
+               $xpath = new \DOMXPath($responseDoc);
+               $xpath->registerNamespace('d', 'DAV');
+
+               self::assertCount($assertionCount, $xpath->query('//d:multistatus/d:response'));
+       }
+
+       /**
+        * @inheritDoc
+        */
+       protected function getInstance()
+       {
+               /** @var HTTPClientFactory $factory */
+               $factory = DI::getDice()->create(HTTPClientFactory::class);
+
+               return new WebDav(getenv('WEBDAV_URL'), [
+                       getenv('WEBDAV_USERNAME'),
+                       getenv('WEBDAV_PASSWORD'),
+                       'basic',
+               ], $factory->createClient(), new VoidLogger());
+       }
+}