diff options
author | Morris Jobke <hey@morrisjobke.de> | 2020-11-29 22:50:30 +0100 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2020-11-30 09:51:18 +0100 |
commit | 83a75c670bb52efbee498418398f03ab12301840 (patch) | |
tree | b537da42d73ca84c430922cc6b12c47aa838ad08 /tests/lib | |
parent | 9409968451be5e25e271ea282863cea7818bed98 (diff) | |
download | nextcloud-server-83a75c670bb52efbee498418398f03ab12301840.tar.gz nextcloud-server-83a75c670bb52efbee498418398f03ab12301840.zip |
Replace static call to Share::unshare with ShareManager->deleteShare in tests
And then cleanup all the code that is dead then...
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'tests/lib')
-rw-r--r-- | tests/lib/Files/ViewTest.php | 4 | ||||
-rw-r--r-- | tests/lib/Share/HelperTest.php | 73 |
2 files changed, 3 insertions, 74 deletions
diff --git a/tests/lib/Files/ViewTest.php b/tests/lib/Files/ViewTest.php index 139516ba374..f18af484f87 100644 --- a/tests/lib/Files/ViewTest.php +++ b/tests/lib/Files/ViewTest.php @@ -1674,6 +1674,8 @@ class ViewTest extends \Test\TestCase { ->setSharedBy($this->user) ->setShareType(IShare::TYPE_USER) ->setPermissions(\OCP\Constants::PERMISSION_READ) + ->setId(42) + ->setProviderId('foo') ->setNode($shareDir); $shareManager->createShare($share); @@ -1681,7 +1683,7 @@ class ViewTest extends \Test\TestCase { $this->assertFalse($view->rename('mount1', 'shareddir/sub'), 'Cannot move mount point into shared folder'); $this->assertFalse($view->rename('mount1', 'shareddir/sub/sub2'), 'Cannot move mount point into shared subfolder'); - $this->assertTrue(\OC\Share\Share::unshare('folder', $fileId, IShare::TYPE_USER, 'test2')); + $shareManager->deleteShare($share); $userObject->delete(); } diff --git a/tests/lib/Share/HelperTest.php b/tests/lib/Share/HelperTest.php index 44bd70e7e29..8d010400273 100644 --- a/tests/lib/Share/HelperTest.php +++ b/tests/lib/Share/HelperTest.php @@ -55,79 +55,6 @@ class HelperTest extends \Test\TestCase { $this->assertSame($expected, $result); } - public function dataTestSplitUserRemote() { - $userPrefix = ['user@name', 'username']; - $protocols = ['', 'http://', 'https://']; - $remotes = [ - 'localhost', - 'local.host', - 'dev.local.host', - 'dev.local.host/path', - 'dev.local.host/at@inpath', - '127.0.0.1', - '::1', - '::192.0.2.128', - '::192.0.2.128/at@inpath', - ]; - - $testCases = []; - foreach ($userPrefix as $user) { - foreach ($remotes as $remote) { - foreach ($protocols as $protocol) { - $baseUrl = $user . '@' . $protocol . $remote; - - $testCases[] = [$baseUrl, $user, $protocol . $remote]; - $testCases[] = [$baseUrl . '/', $user, $protocol . $remote]; - $testCases[] = [$baseUrl . '/index.php', $user, $protocol . $remote]; - $testCases[] = [$baseUrl . '/index.php/s/token', $user, $protocol . $remote]; - } - } - } - return $testCases; - } - - /** - * @dataProvider dataTestSplitUserRemote - * - * @param string $remote - * @param string $expectedUser - * @param string $expectedUrl - */ - public function testSplitUserRemote($remote, $expectedUser, $expectedUrl) { - list($remoteUser, $remoteUrl) = \OC\Share\Helper::splitUserRemote($remote); - $this->assertSame($expectedUser, $remoteUser); - $this->assertSame($expectedUrl, $remoteUrl); - } - - public function dataTestSplitUserRemoteError() { - return [ - // Invalid path - ['user@'], - - // Invalid user - ['@server'], - ['us/er@server'], - ['us:er@server'], - - // Invalid splitting - ['user'], - [''], - ['us/erserver'], - ['us:erserver'], - ]; - } - - /** - * @dataProvider dataTestSplitUserRemoteError - * - * @param string $id - */ - public function testSplitUserRemoteError($id) { - $this->expectException(\OC\HintException::class); - - \OC\Share\Helper::splitUserRemote($id); - } - /** * @dataProvider dataTestCompareServerAddresses * |