2016-11-16 13:07:26 +03:00
|
|
|
<?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\Files\FileInfo;
|
|
|
|
use OC\Files\Storage\Home;
|
|
|
|
use OC\Files\Storage\Temporary;
|
|
|
|
use OCP\IConfig;
|
2019-02-22 15:07:26 +03:00
|
|
|
use OCP\IUser;
|
2016-11-16 13:07:26 +03:00
|
|
|
use Test\TestCase;
|
|
|
|
use Test\Traits\UserTrait;
|
|
|
|
|
|
|
|
class FileInfoTest extends TestCase {
|
|
|
|
use UserTrait;
|
|
|
|
|
|
|
|
private $config;
|
|
|
|
|
2019-11-27 17:27:18 +03:00
|
|
|
protected function setUp(): void {
|
2016-11-16 13:07:26 +03:00
|
|
|
parent::setUp();
|
|
|
|
$this->createUser('foo', 'foo');
|
|
|
|
$this->config = $this->getMockBuilder(IConfig::class)->getMock();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testIsMountedHomeStorage() {
|
2019-02-22 15:07:26 +03:00
|
|
|
$user = $this->createMock(IUser::class);
|
|
|
|
$user->method('getUID')
|
|
|
|
->willReturn('foo');
|
|
|
|
$user->method('getHome')
|
|
|
|
->willReturn('foo');
|
|
|
|
|
2016-11-16 13:07:26 +03:00
|
|
|
$fileInfo = new FileInfo(
|
|
|
|
'',
|
2019-02-22 15:07:26 +03:00
|
|
|
new Home(['user' => $user]),
|
2016-11-16 13:07:26 +03:00
|
|
|
'', [], null);
|
|
|
|
$this->assertFalse($fileInfo->isMounted());
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testIsMountedNonHomeStorage() {
|
|
|
|
$fileInfo = new FileInfo(
|
|
|
|
'',
|
|
|
|
new Temporary(),
|
|
|
|
'', [], null);
|
|
|
|
$this->assertTrue($fileInfo->isMounted());
|
|
|
|
}
|
|
|
|
}
|