diff options
Diffstat (limited to 'tests/lib/Files/Storage/HomeTest.php')
-rw-r--r-- | tests/lib/Files/Storage/HomeTest.php | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/tests/lib/Files/Storage/HomeTest.php b/tests/lib/Files/Storage/HomeTest.php index c3111e74259..84a9816cb0c 100644 --- a/tests/lib/Files/Storage/HomeTest.php +++ b/tests/lib/Files/Storage/HomeTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -7,20 +8,21 @@ namespace Test\Files\Storage; +use OC\Files\Storage\Home; use OC\User\User; +use OCP\Files; +use OCP\ITempManager; +use OCP\Server; class DummyUser extends User { - private $home; - - private $uid; - /** * @param string $uid * @param string $home */ - public function __construct($uid, $home) { - $this->uid = $uid; - $this->home = $home; + public function __construct( + private $uid, + private $home, + ) { } public function getHome() { @@ -48,39 +50,39 @@ class HomeTest extends Storage { private $userId; /** - * @var \OC\User\User $user + * @var User $user */ private $user; protected function setUp(): void { parent::setUp(); - $this->tmpDir = \OC::$server->getTempManager()->getTemporaryFolder(); + $this->tmpDir = Server::get(ITempManager::class)->getTemporaryFolder(); $this->userId = $this->getUniqueID('user_'); $this->user = new DummyUser($this->userId, $this->tmpDir); - $this->instance = new \OC\Files\Storage\Home(['user' => $this->user]); + $this->instance = new Home(['user' => $this->user]); } protected function tearDown(): void { - \OC_Helper::rmdirr($this->tmpDir); + Files::rmdirr($this->tmpDir); parent::tearDown(); } /** * Tests that the home id is in the format home::user1 */ - public function testId() { + public function testId(): void { $this->assertEquals('home::' . $this->userId, $this->instance->getId()); } /** * Tests that getCache() returns an instance of HomeCache */ - public function testGetCacheReturnsHomeCache() { + public function testGetCacheReturnsHomeCache(): void { $this->assertInstanceOf('\OC\Files\Cache\HomeCache', $this->instance->getCache()); } - public function testGetOwner() { + public function testGetOwner(): void { $this->assertEquals($this->userId, $this->instance->getOwner('')); } } |