add tests for FileInfo::isMounted

Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
Robin Appelman 2016-11-16 11:07:26 +01:00
parent e4d1cf0f6d
commit 4ac5fdcf11
No known key found for this signature in database
GPG Key ID: 425003AC385454C5
1 changed files with 46 additions and 0 deletions

View File

@ -0,0 +1,46 @@
<?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 Test\TestCase;
use Test\Traits\UserTrait;
class FileInfoTest extends TestCase {
use UserTrait;
private $config;
public function setUp() {
parent::setUp();
$this->createUser('foo', 'foo');
$this->config = $this->getMockBuilder(IConfig::class)->getMock();
}
public function testIsMountedHomeStorage() {
$fileInfo = new FileInfo(
'',
new Home(['user' => new User('foo', $this->userBackend, null, $this->config)]),
'', [], null);
$this->assertFalse($fileInfo->isMounted());
}
public function testIsMountedNonHomeStorage() {
$fileInfo = new FileInfo(
'',
new Temporary(),
'', [], null);
$this->assertTrue($fileInfo->isMounted());
}
}