Add test for setting up fake fs
Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
parent
9157f807cc
commit
e77432783b
|
@ -90,7 +90,7 @@ interface IToken extends JsonSerializable {
|
||||||
/**
|
/**
|
||||||
* Set the authentication scope for this token
|
* Set the authentication scope for this token
|
||||||
*
|
*
|
||||||
* @param array|null $scope
|
* @param array $scope
|
||||||
*/
|
*/
|
||||||
public function setScope($scope);
|
public function setScope($scope);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright 2016, Robin Appelman <robin@icewind.nl>
|
||||||
|
*
|
||||||
|
* @author Robin Appelman <robin@icewind.nl>
|
||||||
|
*
|
||||||
|
* @license GNU AGPL version 3 or any later version
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Test\Lockdown\Filesystem;
|
||||||
|
|
||||||
|
use OC\Authentication\Token\DefaultToken;
|
||||||
|
use OC\Files\Filesystem;
|
||||||
|
use OC\Lockdown\Filesystem\NullStorage;
|
||||||
|
use Test\Traits\UserTrait;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @group DB
|
||||||
|
*/
|
||||||
|
class NoFSTest extends \Test\TestCase {
|
||||||
|
use UserTrait;
|
||||||
|
|
||||||
|
public function tearDown() {
|
||||||
|
$token = new DefaultToken();
|
||||||
|
$token->setScope([
|
||||||
|
'filesystem' => true
|
||||||
|
]);
|
||||||
|
\OC::$server->getLockdownManager()->setToken($token);
|
||||||
|
return parent::tearDown();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setUp() {
|
||||||
|
parent::setUp();
|
||||||
|
$token = new DefaultToken();
|
||||||
|
$token->setScope([
|
||||||
|
'filesystem' => false
|
||||||
|
]);
|
||||||
|
|
||||||
|
\OC::$server->getLockdownManager()->setToken($token);
|
||||||
|
$this->createUser('foo', 'var');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testSetupFS() {
|
||||||
|
\OC_Util::tearDownFS();
|
||||||
|
\OC_Util::setupFS('foo');
|
||||||
|
|
||||||
|
$this->assertInstanceOf(NullStorage::class, Filesystem::getStorage('/foo/files'));
|
||||||
|
}
|
||||||
|
}
|
|
@ -122,7 +122,7 @@ class NullStorageTest extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testFilemtime() {
|
public function testFilemtime() {
|
||||||
$this->assertFalse($this->storage->isReadable('foo'));
|
$this->assertFalse($this->storage->filemtime('foo'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testFile_get_contents() {
|
public function testFile_get_contents() {
|
||||||
|
|
Loading…
Reference in New Issue