Merge pull request #23985 from owncloud/ext-fix-namespaces
Fix namespaces for files_external
This commit is contained in:
commit
dba08f5fca
|
@ -26,17 +26,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
OC::$CLASSPATH['OC\Files\Storage\StreamWrapper'] = 'files_external/lib/streamwrapper.php';
|
||||
OC::$CLASSPATH['OC\Files\Storage\FTP'] = 'files_external/lib/ftp.php';
|
||||
OC::$CLASSPATH['OC\Files\Storage\OwnCloud'] = 'files_external/lib/owncloud.php';
|
||||
OC::$CLASSPATH['OC\Files\Storage\Google'] = 'files_external/lib/google.php';
|
||||
OC::$CLASSPATH['OC\Files\Storage\Swift'] = 'files_external/lib/swift.php';
|
||||
OC::$CLASSPATH['OC\Files\Storage\SMB'] = 'files_external/lib/smb.php';
|
||||
OC::$CLASSPATH['OC\Files\Storage\AmazonS3'] = 'files_external/lib/amazons3.php';
|
||||
OC::$CLASSPATH['OC\Files\Storage\Dropbox'] = 'files_external/lib/dropbox.php';
|
||||
OC::$CLASSPATH['OC\Files\Storage\SFTP'] = 'files_external/lib/sftp.php';
|
||||
OC::$CLASSPATH['OC_Mount_Config'] = 'files_external/lib/config.php';
|
||||
OC::$CLASSPATH['OCA\Files\External\Api'] = 'files_external/lib/api.php';
|
||||
|
||||
require_once __DIR__ . '/../3rdparty/autoload.php';
|
||||
|
||||
|
|
|
@ -61,6 +61,6 @@ $this->create('files_external_list_applicable', '/applicable')
|
|||
|
||||
\OCP\API::register('get',
|
||||
'/apps/files_external/api/v1/mounts',
|
||||
array('\OCA\Files\External\Api', 'getUserMounts'),
|
||||
array('\OCA\Files_External\Lib\Api', 'getUserMounts'),
|
||||
'files_external');
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
namespace OCA\Files\External;
|
||||
namespace OCA\Files_External\Lib;
|
||||
|
||||
class Api {
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ class AmazonS3 extends Backend {
|
|||
$this
|
||||
->setIdentifier('amazons3')
|
||||
->addIdentifierAlias('\OC\Files\Storage\AmazonS3') // legacy compat
|
||||
->setStorageClass('\OC\Files\Storage\AmazonS3')
|
||||
->setStorageClass('\OCA\Files_External\Lib\Storage\AmazonS3')
|
||||
->setText($l->t('Amazon S3'))
|
||||
->addParameters([
|
||||
(new DefinitionParameter('bucket', $l->t('Bucket'))),
|
||||
|
|
|
@ -38,7 +38,7 @@ class Dropbox extends Backend {
|
|||
$this
|
||||
->setIdentifier('dropbox')
|
||||
->addIdentifierAlias('\OC\Files\Storage\Dropbox') // legacy compat
|
||||
->setStorageClass('\OC\Files\Storage\Dropbox')
|
||||
->setStorageClass('\OCA\Files_External\Lib\Storage\Dropbox')
|
||||
->setText($l->t('Dropbox'))
|
||||
->addParameters([
|
||||
// all parameters handled in OAuth1 mechanism
|
||||
|
|
|
@ -38,7 +38,7 @@ class FTP extends Backend {
|
|||
$this
|
||||
->setIdentifier('ftp')
|
||||
->addIdentifierAlias('\OC\Files\Storage\FTP') // legacy compat
|
||||
->setStorageClass('\OC\Files\Storage\FTP')
|
||||
->setStorageClass('\OCA\Files_External\Lib\Storage\FTP')
|
||||
->setText($l->t('FTP'))
|
||||
->addParameters([
|
||||
(new DefinitionParameter('host', $l->t('Host'))),
|
||||
|
|
|
@ -38,7 +38,7 @@ class Google extends Backend {
|
|||
$this
|
||||
->setIdentifier('googledrive')
|
||||
->addIdentifierAlias('\OC\Files\Storage\Google') // legacy compat
|
||||
->setStorageClass('\OC\Files\Storage\Google')
|
||||
->setStorageClass('\OCA\Files_External\Lib\Storage\Google')
|
||||
->setText($l->t('Google Drive'))
|
||||
->addParameters([
|
||||
// all parameters handled in OAuth2 mechanism
|
||||
|
|
|
@ -35,7 +35,7 @@ class OwnCloud extends Backend {
|
|||
$this
|
||||
->setIdentifier('owncloud')
|
||||
->addIdentifierAlias('\OC\Files\Storage\OwnCloud') // legacy compat
|
||||
->setStorageClass('\OC\Files\Storage\OwnCloud')
|
||||
->setStorageClass('\OCA\Files_External\Lib\Storage\OwnCloud')
|
||||
->setText($l->t('ownCloud'))
|
||||
->addParameters([
|
||||
(new DefinitionParameter('host', $l->t('URL'))),
|
||||
|
|
|
@ -35,7 +35,7 @@ class SFTP extends Backend {
|
|||
$this
|
||||
->setIdentifier('sftp')
|
||||
->addIdentifierAlias('\OC\Files\Storage\SFTP') // legacy compat
|
||||
->setStorageClass('\OC\Files\Storage\SFTP')
|
||||
->setStorageClass('\OCA\Files_External\Lib\Storage\SFTP')
|
||||
->setText($l->t('SFTP'))
|
||||
->addParameters([
|
||||
(new DefinitionParameter('host', $l->t('Host'))),
|
||||
|
|
|
@ -34,7 +34,7 @@ class SFTP_Key extends Backend {
|
|||
public function __construct(IL10N $l, RSA $legacyAuth, SFTP $sftpBackend) {
|
||||
$this
|
||||
->setIdentifier('\OC\Files\Storage\SFTP_Key')
|
||||
->setStorageClass('\OC\Files\Storage\SFTP')
|
||||
->setStorageClass('\OCA\Files_External\Lib\Storage\SFTP')
|
||||
->setText($l->t('SFTP with secret key login'))
|
||||
->addParameters([
|
||||
(new DefinitionParameter('host', $l->t('Host'))),
|
||||
|
|
|
@ -40,7 +40,7 @@ class SMB extends Backend {
|
|||
$this
|
||||
->setIdentifier('smb')
|
||||
->addIdentifierAlias('\OC\Files\Storage\SMB') // legacy compat
|
||||
->setStorageClass('\OC\Files\Storage\SMB')
|
||||
->setStorageClass('\OCA\Files_External\Lib\Storage\SMB')
|
||||
->setText($l->t('SMB / CIFS'))
|
||||
->addParameters([
|
||||
(new DefinitionParameter('host', $l->t('Host'))),
|
||||
|
|
|
@ -42,7 +42,7 @@ class SMB_OC extends Backend {
|
|||
public function __construct(IL10N $l, SessionCredentials $legacyAuth, SMB $smbBackend) {
|
||||
$this
|
||||
->setIdentifier('\OC\Files\Storage\SMB_OC')
|
||||
->setStorageClass('\OC\Files\Storage\SMB')
|
||||
->setStorageClass('\OCA\Files_External\Lib\Storage\SMB')
|
||||
->setText($l->t('SMB / CIFS using OC login'))
|
||||
->addParameters([
|
||||
(new DefinitionParameter('host', $l->t('Host'))),
|
||||
|
|
|
@ -38,7 +38,7 @@ class Swift extends Backend {
|
|||
$this
|
||||
->setIdentifier('swift')
|
||||
->addIdentifierAlias('\OC\Files\Storage\Swift') // legacy compat
|
||||
->setStorageClass('\OC\Files\Storage\Swift')
|
||||
->setStorageClass('\OCA\Files_External\Lib\Storage\Swift')
|
||||
->setText($l->t('OpenStack Object Storage'))
|
||||
->addParameters([
|
||||
(new DefinitionParameter('service_name', $l->t('Service name')))
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
namespace OC\Files\Storage;
|
||||
namespace OCA\Files_External\Lib\Storage;
|
||||
|
||||
set_include_path(get_include_path() . PATH_SEPARATOR .
|
||||
\OC_App::getAppPath('files_external') . '/3rdparty/aws-sdk-php');
|
|
@ -27,7 +27,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
namespace OC\Files\Storage;
|
||||
namespace OCA\Files_External\Lib\Storage;
|
||||
|
||||
use GuzzleHttp\Exception\RequestException;
|
||||
use Icewind\Streams\IteratorDirectory;
|
||||
|
@ -59,7 +59,7 @@ class Dropbox extends \OC\Files\Storage\Common {
|
|||
// note: Dropbox_API connection is lazy
|
||||
$this->dropbox = new \Dropbox_API($this->oauth, 'auto');
|
||||
} else {
|
||||
throw new \Exception('Creating \OC\Files\Storage\Dropbox storage failed');
|
||||
throw new \Exception('Creating Dropbox storage failed');
|
||||
}
|
||||
}
|
||||
|
|
@ -28,11 +28,11 @@
|
|||
*
|
||||
*/
|
||||
|
||||
namespace OC\Files\Storage;
|
||||
namespace OCA\Files_External\Lib\Storage;
|
||||
|
||||
use Icewind\Streams\RetryWrapper;
|
||||
|
||||
class FTP extends \OC\Files\Storage\StreamWrapper{
|
||||
class FTP extends StreamWrapper{
|
||||
private $password;
|
||||
private $user;
|
||||
private $host;
|
||||
|
@ -59,7 +59,7 @@ class FTP extends \OC\Files\Storage\StreamWrapper{
|
|||
$this->root .= '/';
|
||||
}
|
||||
} else {
|
||||
throw new \Exception('Creating \OC\Files\Storage\FTP storage failed');
|
||||
throw new \Exception('Creating FTP storage failed');
|
||||
}
|
||||
|
||||
}
|
|
@ -31,7 +31,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
namespace OC\Files\Storage;
|
||||
namespace OCA\Files_External\Lib\Storage;
|
||||
|
||||
use GuzzleHttp\Exception\RequestException;
|
||||
use Icewind\Streams\IteratorDirectory;
|
||||
|
@ -79,7 +79,7 @@ class Google extends \OC\Files\Storage\Common {
|
|||
$token = json_decode($params['token'], true);
|
||||
$this->id = 'google::'.substr($params['client_id'], 0, 30).$token['created'];
|
||||
} else {
|
||||
throw new \Exception('Creating \OC\Files\Storage\Google storage failed');
|
||||
throw new \Exception('Creating Google storage failed');
|
||||
}
|
||||
}
|
||||
|
|
@ -21,7 +21,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
namespace OC\Files\Storage;
|
||||
namespace OCA\Files_External\Lib\Storage;
|
||||
|
||||
/**
|
||||
* ownCloud backend for external storage based on DAV backend.
|
|
@ -29,7 +29,7 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
*/
|
||||
namespace OC\Files\Storage;
|
||||
namespace OCA\Files_External\Lib\Storage;
|
||||
use Icewind\Streams\IteratorDirectory;
|
||||
|
||||
use Icewind\Streams\RetryWrapper;
|
|
@ -28,7 +28,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
namespace OC\Files\Storage;
|
||||
namespace OCA\Files_External\Lib\Storage;
|
||||
|
||||
use Icewind\SMB\Exception\ConnectException;
|
||||
use Icewind\SMB\Exception\Exception;
|
||||
|
@ -42,7 +42,7 @@ use OC\Cache\CappedMemoryCache;
|
|||
use OC\Files\Filesystem;
|
||||
use OCP\Files\StorageNotAvailableException;
|
||||
|
||||
class SMB extends Common {
|
||||
class SMB extends \OC\Files\Storage\Common {
|
||||
/**
|
||||
* @var \Icewind\SMB\Server
|
||||
*/
|
|
@ -24,9 +24,9 @@
|
|||
*
|
||||
*/
|
||||
|
||||
namespace OC\Files\Storage;
|
||||
namespace OCA\Files_External\Lib\Storage;
|
||||
|
||||
abstract class StreamWrapper extends Common {
|
||||
abstract class StreamWrapper extends \OC\Files\Storage\Common {
|
||||
|
||||
/**
|
||||
* @param string $path
|
|
@ -32,7 +32,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
namespace OC\Files\Storage;
|
||||
namespace OCA\Files_External\Lib\Storage;
|
||||
|
||||
use Guzzle\Http\Url;
|
||||
use Guzzle\Http\Exception\ClientErrorResponseException;
|
|
@ -24,14 +24,16 @@
|
|||
*/
|
||||
|
||||
|
||||
namespace Test\Files\Storage;
|
||||
namespace OCA\Files_External\Tests;
|
||||
|
||||
use OCA\Files_External\Lib\Storage\AmazonS3;
|
||||
|
||||
/**
|
||||
* Class AmazonS3Migration
|
||||
*
|
||||
* @group DB
|
||||
*
|
||||
* @package Test\Files\Storage
|
||||
* @package OCA\Files_External\Tests
|
||||
*/
|
||||
class AmazonS3Migration extends \Test\TestCase {
|
||||
|
||||
|
@ -77,7 +79,7 @@ class AmazonS3Migration extends \Test\TestCase {
|
|||
$fileId = $oldCache->put('foobar', array('size' => 0, 'mtime' => time(), 'mimetype' => 'httpd/directory'));
|
||||
|
||||
try {
|
||||
$this->instance = new \OC\Files\Storage\AmazonS3($this->params);
|
||||
$this->instance = new AmazonS3($this->params);
|
||||
} catch (\Exception $e) {
|
||||
//ignore
|
||||
}
|
||||
|
@ -103,7 +105,7 @@ class AmazonS3Migration extends \Test\TestCase {
|
|||
$fileId = $oldCache->put('/', array('size' => 0, 'mtime' => time(), 'mimetype' => 'httpd/directory'));
|
||||
|
||||
try {
|
||||
$this->instance = new \OC\Files\Storage\AmazonS3($this->params);
|
||||
$this->instance = new AmazonS3($this->params);
|
||||
} catch (\Exception $e) {
|
||||
//ignore
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ abstract class StoragesControllerTest extends \Test\TestCase {
|
|||
/**
|
||||
* @return \OCA\Files_External\Lib\Backend\Backend
|
||||
*/
|
||||
protected function getBackendMock($class = '\OCA\Files_External\Lib\Backend\SMB', $storageClass = '\OC\Files\Storage\SMB') {
|
||||
protected function getBackendMock($class = '\OCA\Files_External\Lib\Backend\SMB', $storageClass = '\OCA\Files_External\Lib\Storage\SMB') {
|
||||
$backend = $this->getMockBuilder('\OCA\Files_External\Lib\Backend\Backend')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
@ -104,7 +104,7 @@ abstract class StoragesControllerTest extends \Test\TestCase {
|
|||
|
||||
$response = $this->controller->create(
|
||||
'mount',
|
||||
'\OC\Files\Storage\SMB',
|
||||
'\OCA\Files_External\Lib\Storage\SMB',
|
||||
'\OCA\Files_External\Lib\Auth\NullMechanism',
|
||||
array(),
|
||||
[],
|
||||
|
@ -146,7 +146,7 @@ abstract class StoragesControllerTest extends \Test\TestCase {
|
|||
$response = $this->controller->update(
|
||||
1,
|
||||
'mount',
|
||||
'\OC\Files\Storage\SMB',
|
||||
'\OCA\Files_External\Lib\Storage\SMB',
|
||||
'\OCA\Files_External\Lib\Auth\NullMechanism',
|
||||
array(),
|
||||
[],
|
||||
|
@ -188,7 +188,7 @@ abstract class StoragesControllerTest extends \Test\TestCase {
|
|||
|
||||
$response = $this->controller->create(
|
||||
$mountPoint,
|
||||
'\OC\Files\Storage\SMB',
|
||||
'\OCA\Files_External\Lib\Storage\SMB',
|
||||
'\OCA\Files_External\Lib\Auth\NullMechanism',
|
||||
array(),
|
||||
[],
|
||||
|
@ -202,7 +202,7 @@ abstract class StoragesControllerTest extends \Test\TestCase {
|
|||
$response = $this->controller->update(
|
||||
1,
|
||||
$mountPoint,
|
||||
'\OC\Files\Storage\SMB',
|
||||
'\OCA\Files_External\Lib\Storage\SMB',
|
||||
'\OCA\Files_External\Lib\Auth\NullMechanism',
|
||||
array(),
|
||||
[],
|
||||
|
@ -279,7 +279,7 @@ abstract class StoragesControllerTest extends \Test\TestCase {
|
|||
$response = $this->controller->update(
|
||||
255,
|
||||
'mount',
|
||||
'\OC\Files\Storage\SMB',
|
||||
'\OCA\Files_External\Lib\Storage\SMB',
|
||||
'\OCA\Files_External\Lib\Auth\NullMechanism',
|
||||
array(),
|
||||
[],
|
||||
|
@ -375,7 +375,7 @@ abstract class StoragesControllerTest extends \Test\TestCase {
|
|||
|
||||
$response = $this->controller->create(
|
||||
'mount',
|
||||
'\OC\Files\Storage\SMB',
|
||||
'\OCA\Files_External\Lib\Storage\SMB',
|
||||
'\OCA\Files_External\Lib\Auth\NullMechanism',
|
||||
array(),
|
||||
[],
|
||||
|
|
|
@ -78,7 +78,7 @@ class UserStoragesControllerTest extends StoragesControllerTest {
|
|||
|
||||
$response = $this->controller->create(
|
||||
'mount',
|
||||
'\OC\Files\Storage\SMB',
|
||||
'\OCA\Files_External\Lib\Storage\SMB',
|
||||
'\Auth\Mechanism',
|
||||
array(),
|
||||
[],
|
||||
|
@ -92,7 +92,7 @@ class UserStoragesControllerTest extends StoragesControllerTest {
|
|||
$response = $this->controller->update(
|
||||
1,
|
||||
'mount',
|
||||
'\OC\Files\Storage\SMB',
|
||||
'\OCA\Files_External\Lib\Storage\SMB',
|
||||
'\Auth\Mechanism',
|
||||
array(),
|
||||
[],
|
||||
|
|
|
@ -23,14 +23,14 @@
|
|||
*
|
||||
*/
|
||||
|
||||
namespace Test\Files\Storage;
|
||||
namespace OCA\Files_External\Tests;
|
||||
|
||||
/**
|
||||
* Class OwnCloudFunctions
|
||||
*
|
||||
* @group DB
|
||||
*
|
||||
* @package Test\Files\Storage
|
||||
* @package OCA\Files_External\Tests
|
||||
*/
|
||||
class OwnCloudFunctions extends \Test\TestCase {
|
||||
|
||||
|
@ -109,7 +109,7 @@ class OwnCloudFunctions extends \Test\TestCase {
|
|||
public function testConfig($config, $expectedUri) {
|
||||
$config['user'] = 'someuser';
|
||||
$config['password'] = 'somepassword';
|
||||
$instance = new \OC\Files\Storage\OwnCloud($config);
|
||||
$instance = new \OCA\Files_External\Lib\Storage\OwnCloud($config);
|
||||
$this->assertEquals($expectedUri, $instance->createBaseUri());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -121,9 +121,9 @@ abstract class StoragesServiceTest extends \Test\TestCase {
|
|||
$this->backendService->method('getAuthMechanisms')
|
||||
->will($this->returnValue($authMechanisms));
|
||||
|
||||
$sftpBackend = $this->getBackendMock('\OCA\Files_External\Lib\Backend\SFTP', '\OC\Files\Storage\SFTP');
|
||||
$sftpBackend = $this->getBackendMock('\OCA\Files_External\Lib\Backend\SFTP', '\OCA\Files_External\Lib\Storage\SFTP');
|
||||
$backends = [
|
||||
'identifier:\OCA\Files_External\Lib\Backend\SMB' => $this->getBackendMock('\OCA\Files_External\Lib\Backend\SMB', '\OC\Files\Storage\SMB'),
|
||||
'identifier:\OCA\Files_External\Lib\Backend\SMB' => $this->getBackendMock('\OCA\Files_External\Lib\Backend\SMB', '\OCA\Files_External\Lib\Storage\SMB'),
|
||||
'identifier:\OCA\Files_External\Lib\Backend\SFTP' => $sftpBackend,
|
||||
'identifier:sftp_alias' => $sftpBackend,
|
||||
];
|
||||
|
@ -171,7 +171,7 @@ abstract class StoragesServiceTest extends \Test\TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
protected function getBackendMock($class = '\OCA\Files_External\Lib\Backend\SMB', $storageClass = '\OC\Files\Storage\SMB') {
|
||||
protected function getBackendMock($class = '\OCA\Files_External\Lib\Backend\SMB', $storageClass = '\OCA\Files_External\Lib\Storage\SMB') {
|
||||
$backend = $this->getMockBuilder('\OCA\Files_External\Lib\Backend\Backend')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
|
|
@ -24,16 +24,18 @@
|
|||
*
|
||||
*/
|
||||
|
||||
namespace Test\Files\Storage;
|
||||
namespace OCA\Files_External\Tests\Storage;
|
||||
|
||||
use \OCA\Files_External\Lib\Storage\AmazonS3;
|
||||
|
||||
/**
|
||||
* Class AmazonS3
|
||||
* Class AmazonS3Test
|
||||
*
|
||||
* @group DB
|
||||
*
|
||||
* @package Test\Files\Storage
|
||||
* @package OCA\Files_External\Tests\Storage
|
||||
*/
|
||||
class AmazonS3 extends Storage {
|
||||
class AmazonS3Test extends \Test\Files\Storage\Storage {
|
||||
|
||||
private $config;
|
||||
|
||||
|
@ -44,7 +46,7 @@ class AmazonS3 extends Storage {
|
|||
if ( ! is_array($this->config) or ! $this->config['run']) {
|
||||
$this->markTestSkipped('AmazonS3 backend not configured');
|
||||
}
|
||||
$this->instance = new \OC\Files\Storage\AmazonS3($this->config);
|
||||
$this->instance = new AmazonS3($this->config);
|
||||
}
|
||||
|
||||
protected function tearDown() {
|
|
@ -24,16 +24,18 @@
|
|||
*
|
||||
*/
|
||||
|
||||
namespace Test\Files\Storage;
|
||||
namespace OCA\Files_External\Tests\Storage;
|
||||
|
||||
use \OCA\Files_External\Lib\Storage\Dropbox;
|
||||
|
||||
/**
|
||||
* Class Dropbox
|
||||
* Class DropboxTest
|
||||
*
|
||||
* @group DB
|
||||
*
|
||||
* @package Test\Files\Storage
|
||||
* @package OCA\Files_External\Tests\Storage
|
||||
*/
|
||||
class Dropbox extends Storage {
|
||||
class DropboxTest extends \Test\Files\Storage\Storage {
|
||||
private $config;
|
||||
|
||||
protected function setUp() {
|
||||
|
@ -45,7 +47,7 @@ class Dropbox extends Storage {
|
|||
$this->markTestSkipped('Dropbox backend not configured');
|
||||
}
|
||||
$this->config['dropbox']['root'] .= '/' . $id; //make sure we have an new empty folder to work in
|
||||
$this->instance = new \OC\Files\Storage\Dropbox($this->config['dropbox']);
|
||||
$this->instance = new Dropbox($this->config['dropbox']);
|
||||
}
|
||||
|
||||
protected function tearDown() {
|
|
@ -24,16 +24,18 @@
|
|||
*
|
||||
*/
|
||||
|
||||
namespace Test\Files\Storage;
|
||||
namespace OCA\Files_External\Tests\Storage;
|
||||
|
||||
use \OCA\Files_External\Lib\Storage\FTP;
|
||||
|
||||
/**
|
||||
* Class FTP
|
||||
* Class FTPTest
|
||||
*
|
||||
* @group DB
|
||||
*
|
||||
* @package Test\Files\Storage
|
||||
* @package OCA\Files_External\Tests\Storage
|
||||
*/
|
||||
class FTP extends Storage {
|
||||
class FTPTest extends \Test\Files\Storage\Storage {
|
||||
private $config;
|
||||
|
||||
protected function setUp() {
|
||||
|
@ -45,7 +47,7 @@ class FTP extends Storage {
|
|||
$this->markTestSkipped('FTP backend not configured');
|
||||
}
|
||||
$this->config['root'] .= '/' . $id; //make sure we have an new empty folder to work in
|
||||
$this->instance = new \OC\Files\Storage\FTP($this->config);
|
||||
$this->instance = new FTP($this->config);
|
||||
$this->instance->mkdir('/');
|
||||
}
|
||||
|
||||
|
@ -63,31 +65,31 @@ class FTP extends Storage {
|
|||
'password' => 'ftp',
|
||||
'root' => '/',
|
||||
'secure' => false );
|
||||
$instance = new \OC\Files\Storage\FTP($config);
|
||||
$instance = new FTP($config);
|
||||
$this->assertEquals('ftp://ftp:ftp@localhost/', $instance->constructUrl(''));
|
||||
|
||||
$config['secure'] = true;
|
||||
$instance = new \OC\Files\Storage\FTP($config);
|
||||
$instance = new FTP($config);
|
||||
$this->assertEquals('ftps://ftp:ftp@localhost/', $instance->constructUrl(''));
|
||||
|
||||
$config['secure'] = 'false';
|
||||
$instance = new \OC\Files\Storage\FTP($config);
|
||||
$instance = new FTP($config);
|
||||
$this->assertEquals('ftp://ftp:ftp@localhost/', $instance->constructUrl(''));
|
||||
|
||||
$config['secure'] = 'true';
|
||||
$instance = new \OC\Files\Storage\FTP($config);
|
||||
$instance = new FTP($config);
|
||||
$this->assertEquals('ftps://ftp:ftp@localhost/', $instance->constructUrl(''));
|
||||
|
||||
$config['root'] = '';
|
||||
$instance = new \OC\Files\Storage\FTP($config);
|
||||
$instance = new FTP($config);
|
||||
$this->assertEquals('ftps://ftp:ftp@localhost/somefile.txt', $instance->constructUrl('somefile.txt'));
|
||||
|
||||
$config['root'] = '/abc';
|
||||
$instance = new \OC\Files\Storage\FTP($config);
|
||||
$instance = new FTP($config);
|
||||
$this->assertEquals('ftps://ftp:ftp@localhost/abc/somefile.txt', $instance->constructUrl('somefile.txt'));
|
||||
|
||||
$config['root'] = '/abc/';
|
||||
$instance = new \OC\Files\Storage\FTP($config);
|
||||
$instance = new FTP($config);
|
||||
$this->assertEquals('ftps://ftp:ftp@localhost/abc/somefile.txt', $instance->constructUrl('somefile.txt'));
|
||||
}
|
||||
}
|
|
@ -25,18 +25,18 @@
|
|||
*
|
||||
*/
|
||||
|
||||
namespace Test\Files\Storage;
|
||||
namespace OCA\Files_External\Tests\Storage;
|
||||
|
||||
require_once 'files_external/lib/google.php';
|
||||
use \OCA\Files_External\Lib\Storage\Google;
|
||||
|
||||
/**
|
||||
* Class Google
|
||||
* Class GoogleTest
|
||||
*
|
||||
* @group DB
|
||||
*
|
||||
* @package Test\Files\Storage
|
||||
* @package OCA\Files_External\Tests\Storage
|
||||
*/
|
||||
class Google extends Storage {
|
||||
class GoogleTest extends \Test\Files\Storage\Storage {
|
||||
|
||||
private $config;
|
||||
|
||||
|
@ -49,7 +49,7 @@ class Google extends Storage {
|
|||
) {
|
||||
$this->markTestSkipped('Google Drive backend not configured');
|
||||
}
|
||||
$this->instance = new \OC\Files\Storage\Google($this->config['google']);
|
||||
$this->instance = new Google($this->config['google']);
|
||||
}
|
||||
|
||||
protected function tearDown() {
|
|
@ -22,16 +22,18 @@
|
|||
*
|
||||
*/
|
||||
|
||||
namespace Test\Files\Storage;
|
||||
namespace OCA\Files_External\Tests\Storage;
|
||||
|
||||
use \OCA\Files_External\Lib\Storage\OwnCloud;
|
||||
|
||||
/**
|
||||
* Class OwnCloud
|
||||
* Class OwnCloudTest
|
||||
*
|
||||
* @group DB
|
||||
*
|
||||
* @package Test\Files\Storage
|
||||
* @package OCA\Files_External\Tests\Storage
|
||||
*/
|
||||
class OwnCloud extends Storage {
|
||||
class OwnCloudTest extends \Test\Files\Storage\Storage {
|
||||
|
||||
private $config;
|
||||
|
||||
|
@ -44,7 +46,7 @@ class OwnCloud extends Storage {
|
|||
$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 = new OwnCloud($this->config['owncloud']);
|
||||
$this->instance->mkdir('/');
|
||||
}
|
||||
|
|
@ -22,16 +22,18 @@
|
|||
*
|
||||
*/
|
||||
|
||||
namespace Test\Files\Storage;
|
||||
namespace OCA\Files_External\Tests\Storage;
|
||||
|
||||
use \OCA\Files_External\Lib\Storage\SFTP_Key;
|
||||
|
||||
/**
|
||||
* Class SFTP_Key
|
||||
* Class SFTP_KeyTest
|
||||
*
|
||||
* @group DB
|
||||
*
|
||||
* @package Test\Files\Storage
|
||||
* @package OCA\Files_External\Tests\Storage
|
||||
*/
|
||||
class SFTP_Key extends Storage {
|
||||
class SFTP_KeyTest extends \Test\Files\Storage\Storage {
|
||||
private $config;
|
||||
|
||||
protected function setUp() {
|
||||
|
@ -44,7 +46,7 @@ class SFTP_Key extends Storage {
|
|||
}
|
||||
// Make sure we have an new empty folder to work in
|
||||
$this->config['sftp_key']['root'] .= '/' . $id;
|
||||
$this->instance = new \OC\Files\Storage\SFTP_Key($this->config['sftp_key']);
|
||||
$this->instance = new SFTP_Key($this->config['sftp_key']);
|
||||
$this->instance->mkdir('/');
|
||||
}
|
||||
|
|
@ -24,18 +24,20 @@
|
|||
*
|
||||
*/
|
||||
|
||||
namespace Test\Files\Storage;
|
||||
namespace OCA\Files_External\Tests\Storage;
|
||||
|
||||
use \OCA\Files_External\Lib\Storage\SFTP;
|
||||
|
||||
/**
|
||||
* Class SFTP
|
||||
* Class SFTPTest
|
||||
*
|
||||
* @group DB
|
||||
*
|
||||
* @package Test\Files\Storage
|
||||
* @package OCA\Files_External\Tests\Storage
|
||||
*/
|
||||
class SFTP extends Storage {
|
||||
class SFTPTest extends \Test\Files\Storage\Storage {
|
||||
/**
|
||||
* @var \OC\Files\Storage\SFTP instance
|
||||
* @var SFTP instance
|
||||
*/
|
||||
protected $instance;
|
||||
|
||||
|
@ -50,7 +52,7 @@ class SFTP extends Storage {
|
|||
$this->markTestSkipped('SFTP backend not configured');
|
||||
}
|
||||
$this->config['root'] .= '/' . $id; //make sure we have an new empty folder to work in
|
||||
$this->instance = new \OC\Files\Storage\SFTP($this->config);
|
||||
$this->instance = new SFTP($this->config);
|
||||
$this->instance->mkdir('/');
|
||||
}
|
||||
|
||||
|
@ -66,7 +68,7 @@ class SFTP extends Storage {
|
|||
* @dataProvider configProvider
|
||||
*/
|
||||
public function testStorageId($config, $expectedStorageId) {
|
||||
$instance = new \OC\Files\Storage\SFTP($config);
|
||||
$instance = new SFTP($config);
|
||||
$this->assertEquals($expectedStorageId, $instance->getId());
|
||||
}
|
||||
|
|
@ -23,16 +23,18 @@
|
|||
*
|
||||
*/
|
||||
|
||||
namespace Test\Files\Storage;
|
||||
namespace OCA\Files_External\Tests\Storage;
|
||||
|
||||
use \OCA\Files_External\Lib\Storage\SMB;
|
||||
|
||||
/**
|
||||
* Class SMB
|
||||
* Class SMBTest
|
||||
*
|
||||
* @group DB
|
||||
*
|
||||
* @package Test\Files\Storage
|
||||
* @package OCA\Files_External\Tests\Storage
|
||||
*/
|
||||
class SMB extends Storage {
|
||||
class SMBTest extends \Test\Files\Storage\Storage {
|
||||
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
@ -46,7 +48,7 @@ class SMB extends Storage {
|
|||
$config['root'] .= '/';
|
||||
}
|
||||
$config['root'] .= $id; //make sure we have an new empty folder to work in
|
||||
$this->instance = new \OC\Files\Storage\SMB($config);
|
||||
$this->instance = new SMB($config);
|
||||
$this->instance->mkdir('/');
|
||||
}
|
||||
|
||||
|
@ -71,7 +73,7 @@ class SMB extends Storage {
|
|||
}
|
||||
|
||||
public function testStorageId() {
|
||||
$this->instance = new \OC\Files\Storage\SMB([
|
||||
$this->instance = new SMB([
|
||||
'host' => 'testhost',
|
||||
'user' => 'testuser',
|
||||
'password' => 'somepass',
|
|
@ -24,16 +24,18 @@
|
|||
*
|
||||
*/
|
||||
|
||||
namespace Test\Files\Storage;
|
||||
namespace OCA\Files_External\Tests\Storage;
|
||||
|
||||
use \OCA\Files_External\Lib\Storage\Swift;
|
||||
|
||||
/**
|
||||
* Class Swift
|
||||
* Class SwiftTest
|
||||
*
|
||||
* @group DB
|
||||
*
|
||||
* @package Test\Files\Storage
|
||||
* @package OCA\Files_External\Tests\Storage
|
||||
*/
|
||||
class Swift extends Storage {
|
||||
class SwiftTest extends \Test\Files\Storage\Storage {
|
||||
|
||||
private $config;
|
||||
|
||||
|
@ -44,7 +46,7 @@ class Swift extends Storage {
|
|||
if (!is_array($this->config) or !$this->config['run']) {
|
||||
$this->markTestSkipped('OpenStack Object Storage backend not configured');
|
||||
}
|
||||
$this->instance = new \OC\Files\Storage\Swift($this->config);
|
||||
$this->instance = new Swift($this->config);
|
||||
}
|
||||
|
||||
protected function tearDown() {
|
|
@ -23,16 +23,18 @@
|
|||
*
|
||||
*/
|
||||
|
||||
namespace Test\Files\Storage;
|
||||
namespace OCA\Files_External\Tests\Storage;
|
||||
|
||||
use \OC\Files\Storage\DAV;
|
||||
|
||||
/**
|
||||
* Class DAV
|
||||
* Class WebDAVTest
|
||||
*
|
||||
* @group DB
|
||||
*
|
||||
* @package Test\Files\Storage
|
||||
* @package OCA\Files_External\Tests\Storage
|
||||
*/
|
||||
class DAV extends Storage {
|
||||
class WebDAVTest extends \Test\Files\Storage\Storage {
|
||||
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
@ -46,7 +48,7 @@ class DAV extends Storage {
|
|||
$this->waitDelay = $config['wait'];
|
||||
}
|
||||
$config['root'] .= '/' . $id; //make sure we have an new empty folder to work in
|
||||
$this->instance = new \OC\Files\Storage\DAV($config);
|
||||
$this->instance = new DAV($config);
|
||||
$this->instance->mkdir('/');
|
||||
}
|
||||
|
|
@ -178,7 +178,7 @@ EOF
|
|||
return;
|
||||
fi
|
||||
|
||||
FILES_EXTERNAL_BACKEND_PATH=../apps/files_external/tests/backends
|
||||
FILES_EXTERNAL_BACKEND_PATH=../apps/files_external/tests/storage
|
||||
FILES_EXTERNAL_BACKEND_ENV_PATH=../apps/files_external/tests/env
|
||||
|
||||
for startFile in `ls -1 $FILES_EXTERNAL_BACKEND_ENV_PATH | grep start`; do
|
||||
|
@ -198,16 +198,17 @@ EOF
|
|||
# getting backend to test from filename
|
||||
# it's the part between the dots startSomething.TestToRun.sh
|
||||
testToRun=`echo $startFile | cut -d '-' -f 2`
|
||||
testToRun="${testToRun}test.php"
|
||||
|
||||
# run the specific test
|
||||
if [ -z "$NOCOVERAGE" ]; then
|
||||
rm -rf "coverage-external-html-$1-$name"
|
||||
mkdir "coverage-external-html-$1-$name"
|
||||
"$PHPUNIT" --configuration phpunit-autotest-external.xml --log-junit "autotest-external-results-$1-$name.xml" --coverage-clover "autotest-external-clover-$1-$name.xml" --coverage-html "coverage-external-html-$1-$name" "$FILES_EXTERNAL_BACKEND_PATH/$testToRun.php"
|
||||
"$PHPUNIT" --configuration phpunit-autotest-external.xml --log-junit "autotest-external-results-$1-$name.xml" --coverage-clover "autotest-external-clover-$1-$name.xml" --coverage-html "coverage-external-html-$1-$name" "$FILES_EXTERNAL_BACKEND_PATH/$testToRun"
|
||||
RESULT=$?
|
||||
else
|
||||
echo "No coverage"
|
||||
"$PHPUNIT" --configuration phpunit-autotest-external.xml --log-junit "autotest-external-results-$1-$name.xml" "$FILES_EXTERNAL_BACKEND_PATH/$testToRun.php"
|
||||
"$PHPUNIT" --configuration phpunit-autotest-external.xml --log-junit "autotest-external-results-$1-$name.xml" "$FILES_EXTERNAL_BACKEND_PATH/$testToRun"
|
||||
RESULT=$?
|
||||
fi
|
||||
else
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<testsuite name='ownCloud files external'>
|
||||
<directory suffix=".php">../apps/files_external/tests</directory>
|
||||
<!-- exclude backends as they are called separately -->
|
||||
<exclude>../apps/files_external/tests/backends/</exclude>
|
||||
<exclude>../apps/files_external/tests/storage/</exclude>
|
||||
</testsuite>
|
||||
<!-- filters for code coverage -->
|
||||
<filter>
|
||||
|
|
Loading…
Reference in New Issue