aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/Files/FileInfoTest.php
blob: fd2b506beb9cb274d3a716ea944847e3635a5697 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?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;
use OCP\IUser;
use Test\TestCase;
use Test\Traits\UserTrait;

class FileInfoTest extends TestCase {
	use UserTrait;

	private $config;

	protected 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());
	}
}