server/apps/files_external/tests/owncloud.php
Vincent Petry b1f1357957 Added ownCloud backend for external storage
To make it possible to use the short ownCloud URL (without specifying
webdav.php or remote.php), a new backend is available for ownCloud.

The user must specify the host + context path in the "Url" field (which
is mapped to the "host" parameter) and the subdir to mount in the "Root"
field.

This is to prevent confusion because some users forget to append
webdav.php or remote.php to the WebDAV URL.

Fixes #4923
2013-10-09 17:30:22 +02:00

31 lines
875 B
PHP

<?php
/**
* Copyright (c) 2013 Vincent Petry <pvince81@owncloud.com>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
namespace Test\Files\Storage;
class OwnCloud extends Storage {
private $config;
public function setUp() {
$id = uniqid();
$this->config = include('files_external/tests/config.php');
if ( ! is_array($this->config) or ! isset($this->config['owncloud']) or ! $this->config['owncloud']['run']) {
$this->markTestSkipped('ownCloud backend not configured');
}
$this->config['owncloud']['root'] .= '/' . $id; //make sure we have an new empty folder to work in
$this->instance = new \OC\Files\Storage\OwnCloud($this->config['owncloud']);
$this->instance->mkdir('/');
}
public function tearDown() {
if ($this->instance) {
$this->instance->rmdir('/');
}
}
}