]> git.mxchange.org Git - friendica-addons.git/commitdiff
Add WebDavTest (theoretically ..)
authorPhilipp <admin@philipp.info>
Tue, 7 Sep 2021 18:38:57 +0000 (20:38 +0200)
committerPhilipp <admin@philipp.info>
Sat, 2 Oct 2021 21:46:47 +0000 (23:46 +0200)
webdav_storage/tests/WebDavTest.php

index b9deb255259422e2af26fc8590783ab5443c112d..cf4e69d27c288191f7a513c60cb04b732fd6c72a 100644 (file)
@@ -2,9 +2,13 @@
 
 namespace Friendica\Addon\webdav_storage\tests;
 
-use Friendica\Test\MockedTest;
+use Friendica\Addon\webdav_storage\src\WebDav;
+use Friendica\Core\Config\IConfig;
+use Friendica\DI;
+use Friendica\Model\Storage\IWritableStorage;
+use Friendica\Test\src\Model\Storage\StorageTest;
 
-class WebDavTest extends MockedTest
+class WebDavTest extends StorageTest
 {
        public function dataMultiStatus()
        {
@@ -95,4 +99,20 @@ EOF,
 
                self::assertCount($assertionCount, $xpath->query('//d:multistatus/d:response'));
        }
+
+       protected function getInstance()
+       {
+               $config = \Mockery::mock(IConfig::class);
+               $config->shouldReceive('get')->with('webdav', 'username')->andReturn(getenv('WEBDAV_USERNAME'));
+               $config->shouldReceive('get')->with('webdav', 'password', '')->andReturn(getenv('WEBDAV_PASSWORD'));
+               $config->shouldReceive('get')->with('webdav', 'url')->andReturn(getenv('WEBDAV_URL'));
+               $config->shouldReceive('get')->with('webdav', 'auth_type', 'basic')->andReturn('basic');
+
+               return new WebDav(DI::l10n(), $config, DI::httpClient(), DI::logger());
+       }
+
+       protected function assertOption(IWritableStorage $storage)
+       {
+               self::assertCount(1, ['1']);
+       }
 }