本文整理汇总了PHP中OC\Files\Filesystem::tearDown方法的典型用法代码示例。如果您正苦于以下问题:PHP Filesystem::tearDown方法的具体用法?PHP Filesystem::tearDown怎么用?PHP Filesystem::tearDown使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OC\Files\Filesystem
的用法示例。
在下文中一共展示了Filesystem::tearDown方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
protected function setUp()
{
parent::setUp();
if (!getenv('RUN_OBJECTSTORE_TESTS')) {
$this->markTestSkipped('objectstore tests are unreliable in some environments');
}
// reset backend
\OC_User::clearBackends();
\OC_User::useBackend('database');
// create users
$users = array('test');
foreach ($users as $userName) {
\OC_User::deleteUser($userName);
\OC_User::createUser($userName, $userName);
}
// main test user
\OC_Util::tearDownFS();
\OC_User::setUserId('');
\OC\Files\Filesystem::tearDown();
\OC_User::setUserId('test');
$config = \OC::$server->getConfig()->getSystemValue('objectstore');
$this->objectStorage = new ObjectStoreToTest($config['arguments']);
$config['objectstore'] = $this->objectStorage;
$this->instance = new ObjectStoreStorage($config);
}
示例2: setUp
public function setUp()
{
if (!getenv('RUN_OBJECTSTORE_TESTS')) {
$this->markTestSkipped('objectstore tests are unreliable on travis');
}
\OC_App::disable('files_sharing');
\OC_App::disable('files_versions');
// reset backend
\OC_User::clearBackends();
\OC_User::useBackend('database');
// create users
$users = array('test');
foreach ($users as $userName) {
\OC_User::deleteUser($userName);
\OC_User::createUser($userName, $userName);
}
// main test user
$userName = 'test';
\OC_Util::tearDownFS();
\OC_User::setUserId('');
\OC\Files\Filesystem::tearDown();
\OC_User::setUserId('test');
$testContainer = 'oc-test-container-' . substr(md5(rand()), 0, 7);
$params = array('username' => 'facebook100000330192569', 'password' => 'Dbdj1sXnRSHxIGc4', 'container' => $testContainer, 'autocreate' => true, 'region' => 'RegionOne', 'url' => 'http://8.21.28.222:5000/v2.0', 'tenantName' => 'facebook100000330192569', 'serviceName' => 'swift', 'user' => \OC_User::getManager()->get($userName));
$this->objectStorage = new ObjectStoreToTest($params);
$params['objectstore'] = $this->objectStorage;
$this->instance = new ObjectStoreStorage($params);
}
示例3: tearDown
protected function tearDown()
{
$result = \OC_User::deleteUser(self::$user);
$this->assertTrue($result);
\OC\Files\Filesystem::tearDown();
\OC\Files\Filesystem::mount($this->originalStorage, array(), '/');
parent::tearDown();
}
示例4: setUp
function setUp()
{
$this->username = OC_Util::generateRandomBytes(20);
OC_User::createUser($this->username, OC_Util::generateRandomBytes(20));
\OC_Util::tearDownFS();
\OC_User::setUserId('');
\OC\Files\Filesystem::tearDown();
\OC_Util::setupFS($this->username);
$this->user = \OC::$server->getUserManager()->get($this->username);
$this->certificateManager = new CertificateManager($this->user);
}
示例5: generateUser
/**
* Generates a test user and sets up their file system
* @return string the test users id
*/
public function generateUser()
{
$username = uniqid();
\OC_User::createUser($username, 'password');
\OC_Util::tearDownFS();
\OC_User::setUserId('');
\OC\Files\Filesystem::tearDown();
\OC_Util::setupFS($username);
$this->users[] = $username;
return $username;
}
示例6: setUp
protected function setUp()
{
parent::setUp();
$this->username = $this->getUniqueID('', 20);
OC_User::createUser($this->username, $this->getUniqueID('', 20));
\OC_Util::tearDownFS();
\OC_User::setUserId('');
\OC\Files\Filesystem::tearDown();
\OC_Util::setupFS($this->username);
$this->certificateManager = new CertificateManager($this->username, new \OC\Files\View());
}
示例7: tearDown
public function tearDown()
{
$this->user = null;
if ($this->storageMock) {
$this->storageMock->getCache()->clear();
$this->storageMock = null;
}
\OC\Files\Filesystem::tearDown();
\OC_User::setUserId('');
\OC_User::deleteUser($this->user);
\OC_Preferences::deleteUser($this->user);
}
示例8: tearDown
protected function tearDown()
{
\OC_Util::tearDownFS();
\OC_User::setUserId('');
Filesystem::tearDown();
\OC_User::deleteUser($this->user);
\OC_User::setIncognitoMode(false);
\OC::$server->getSession()->set('public_link_authenticated', '');
// Set old user
\OC_User::setUserId($this->oldUser);
\OC_Util::setupFS($this->oldUser);
}
示例9: tearDown
public function tearDown()
{
if ($this->cache) {
$this->cache->clear();
}
$result = \OC_User::deleteUser(self::$user);
$this->assertTrue($result);
Filesystem::tearDown();
// reset app files_encryption
if ($this->stateFilesEncryption) {
\OC_App::enable('files_encryption');
}
}
示例10: setUp
protected function setUp()
{
parent::setUp();
$this->username = $this->getUniqueID('', 20);
OC_User::createUser($this->username, $this->getUniqueID('', 20));
\OC_Util::tearDownFS();
\OC_User::setUserId('');
\OC\Files\Filesystem::tearDown();
\OC_Util::setupFS($this->username);
$config = $this->getMock('OCP\\IConfig');
$config->expects($this->any())->method('getSystemValue')->with('installed', false)->willReturn(true);
$this->certificateManager = new CertificateManager($this->username, new \OC\Files\View(), $config);
}
示例11: loginWithEncryption
protected function loginWithEncryption($user = '')
{
\OC_Util::tearDownFS();
\OC_User::setUserId('');
// needed for fully logout
\OC::$server->getUserSession()->setUser(null);
Filesystem::tearDown();
\OC_User::setUserId($user);
$this->postLogin();
\OC_Util::setupFS($user);
if (\OC_User::userExists($user)) {
\OC::$server->getUserFolder($user);
}
}
示例12: tearDown
protected function tearDown()
{
$this->user = null;
if ($this->storageMock) {
$this->storageMock->getCache()->clear();
$this->storageMock = null;
}
\OC\Files\Filesystem::tearDown();
\OC\Files\Filesystem::mount($this->storage, array(), '/');
\OC_User::setUserId('');
\OC_User::deleteUser($this->user);
\OC::$server->getConfig()->deleteAllUserValues($this->user);
parent::tearDown();
}
示例13: tearDown
protected function tearDown()
{
if ($this->cache) {
$this->cache->clear();
}
$result = \OC_User::deleteUser(self::$user);
$this->assertTrue($result);
Filesystem::tearDown();
Filesystem::mount($this->originalStorage, array(), '/');
// reset app files_encryption
if ($this->stateFilesEncryption) {
\OC_App::enable('files_encryption');
}
parent::tearDown();
}
示例14: setUp
public function setUp()
{
$app = new Application();
$container = $app->getContainer();
// reset backend
$um = $container->getServer()->getUserManager();
$this->userSession = $container->getServer()->getUserSession();
$um->clearBackends();
$um->registerBackend(new \OC_User_Database());
// create test user
$this->userName = 'test';
\OC_User::deleteUser($this->userName);
$um->createUser($this->userName, $this->userName);
\OC_Util::tearDownFS();
$this->userSession->setUser(null);
Filesystem::tearDown();
\OC_Util::setupFS($this->userName);
$this->userSession->setUser($um->get($this->userName));
$view = new \OC\Files\View('/' . $this->userName . '/files');
// setup files
$filesToCopy = array('documents' => array('document.pdf', 'document.docx', 'document.odt', 'document.txt'));
$count = 0;
foreach ($filesToCopy as $folder => $files) {
foreach ($files as $file) {
$imgData = file_get_contents(__DIR__ . '/data/' . $file);
$view->mkdir($folder);
$path = $folder . '/' . $file;
$view->file_put_contents($path, $imgData);
// set mtime to get fixed sorting with respect to recentFiles
$count++;
$view->touch($path, 1000 + $count);
}
}
list($storage, ) = $view->resolvePath('');
/** @var $storage Storage */
$this->storage = $storage;
$this->scanner = $storage->getScanner();
$this->scanner->scan('');
}
示例15: setUpBeforeClass
public static function setUpBeforeClass()
{
// reset backend
\OC_User::clearBackends();
\OC_User::useBackend('database');
// Filesystem related hooks
\OCA\Encryption\Helper::registerFilesystemHooks();
// clear and register hooks
\OC_FileProxy::clearProxies();
\OC_FileProxy::register(new OCA\Encryption\Proxy());
// disable file proxy by default
\OC_FileProxy::$enabled = false;
// setup filesystem
\OC_Util::tearDownFS();
\OC_User::setUserId('');
\OC\Files\Filesystem::tearDown();
\OC_Util::setupFS('admin');
\OC_User::setUserId('admin');
// login admin
$params['uid'] = 'admin';
$params['password'] = 'admin';
OCA\Encryption\Hooks::login($params);
}