0
0
Fork 0
mirror of https://github.com/nextcloud/server.git synced 2025-01-16 08:09:00 +00:00
nextcloud_server/tests/lib/Files/Mount/MountTest.php
Christoph Wurst 49dd79eabb
refactor: Add void return type to PHPUnit test methods
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2024-09-15 22:32:31 +02:00

44 lines
1.5 KiB
PHP

<?php
/**
* SPDX-FileCopyrightText: 2020-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace Test\Files\Mount;
use OC\Files\Storage\StorageFactory;
use OC\Files\Storage\Wrapper\Wrapper;
class MountTest extends \Test\TestCase {
public function testFromStorageObject(): void {
$storage = $this->getMockBuilder('\OC\Files\Storage\Temporary')
->disableOriginalConstructor()
->getMock();
$mount = new \OC\Files\Mount\MountPoint($storage, '/foo');
$this->assertInstanceOf('\OC\Files\Storage\Temporary', $mount->getStorage());
}
public function testFromStorageClassname(): void {
$mount = new \OC\Files\Mount\MountPoint('\OC\Files\Storage\Temporary', '/foo');
$this->assertInstanceOf('\OC\Files\Storage\Temporary', $mount->getStorage());
}
public function testWrapper(): void {
$test = $this;
$wrapper = function ($mountPoint, $storage) use (&$test) {
$test->assertEquals('/foo/', $mountPoint);
$test->assertInstanceOf('\OC\Files\Storage\Storage', $storage);
return new Wrapper(['storage' => $storage]);
};
$loader = new StorageFactory();
$loader->addStorageWrapper('test_wrapper', $wrapper);
$storage = $this->getMockBuilder('\OC\Files\Storage\Temporary')
->disableOriginalConstructor()
->getMock();
$mount = new \OC\Files\Mount\MountPoint($storage, '/foo', [], $loader);
$this->assertInstanceOf('\OC\Files\Storage\Wrapper\Wrapper', $mount->getStorage());
}
}