From d64bdc0fef896496f27c07208a9cfcc66c9ce476 Mon Sep 17 00:00:00 2001 From: Robin McCorkell Date: Mon, 31 Aug 2015 14:01:05 +0100 Subject: [PATCH] Unit test storages with an empty mount point --- .../service/globalstoragesservicetest.php | 28 +++++++++++++++++++ .../service/userglobalstoragesservicetest.php | 5 ++++ 2 files changed, 33 insertions(+) diff --git a/apps/files_external/tests/service/globalstoragesservicetest.php b/apps/files_external/tests/service/globalstoragesservicetest.php index 2bc480ca31..94c34c221f 100644 --- a/apps/files_external/tests/service/globalstoragesservicetest.php +++ b/apps/files_external/tests/service/globalstoragesservicetest.php @@ -914,4 +914,32 @@ class GlobalStoragesServiceTest extends StoragesServiceTest { $this->assertEquals('identifier:\Auth\Mechanism', $storage2->getAuthMechanism()->getIdentifier()); } + public function testReadEmptyMountPoint() { + $configFile = $this->dataDir . '/mount.json'; + + $json = [ + 'user' => [ + 'user1' => [ + '/$user/files/' => [ + 'backend' => 'identifier:\OCA\Files_External\Lib\Backend\SFTP', + 'authMechanism' => 'identifier:\Auth\Mechanism', + 'options' => [], + 'mountOptions' => [], + ], + ] + ] + ]; + + file_put_contents($configFile, json_encode($json)); + + $allStorages = $this->service->getAllStorages(); + + $this->assertCount(1, $allStorages); + + $storage1 = $allStorages[1]; + + $this->assertEquals('/', $storage1->getMountPoint()); + } + + } diff --git a/apps/files_external/tests/service/userglobalstoragesservicetest.php b/apps/files_external/tests/service/userglobalstoragesservicetest.php index 49a0245384..b9e2c08c93 100644 --- a/apps/files_external/tests/service/userglobalstoragesservicetest.php +++ b/apps/files_external/tests/service/userglobalstoragesservicetest.php @@ -212,4 +212,9 @@ class UserGlobalStoragesServiceTest extends GlobalStoragesServiceTest { $this->assertTrue(true); } + public function testReadEmptyMountPoint() { + // we don't test this here + $this->assertTrue(true); + } + }