server/tests/lib/Files/FileInfoTest.php
Roeland Jago Douma c007ca624f
Make phpunit8 compatible
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2019-11-27 13:34:41 +01:00

53 lines
1.1 KiB
PHP

<?php
/**
* Copyright (c) 2016 Robin Appelman <robin@icewind.nl>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
namespace Test\Files;
use OC\AllConfig;
use OC\Files\FileInfo;
use OC\Files\Storage\Home;
use OC\Files\Storage\Temporary;
use OC\User\User;
use OCP\IConfig;
use OCP\IUser;
use Test\TestCase;
use Test\Traits\UserTrait;
class FileInfoTest extends TestCase {
use UserTrait;
private $config;
public function setUp(): void {
parent::setUp();
$this->createUser('foo', 'foo');
$this->config = $this->getMockBuilder(IConfig::class)->getMock();
}
public function testIsMountedHomeStorage() {
$user = $this->createMock(IUser::class);
$user->method('getUID')
->willReturn('foo');
$user->method('getHome')
->willReturn('foo');
$fileInfo = new FileInfo(
'',
new Home(['user' => $user]),
'', [], null);
$this->assertFalse($fileInfo->isMounted());
}
public function testIsMountedNonHomeStorage() {
$fileInfo = new FileInfo(
'',
new Temporary(),
'', [], null);
$this->assertTrue($fileInfo->isMounted());
}
}