aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_external
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2014-11-10 22:28:12 +0100
committerJoas Schilling <nickvergessen@gmx.de>2014-11-19 14:52:09 +0100
commit76ebd3a050cb3c84b958f071ec559e6bc9cbc847 (patch)
tree5d781de62a647778ac377e8a1173dea82427328d /apps/files_external
parentbb540722cd4e197bd608d9a87e4b10cf66dec5a9 (diff)
downloadnextcloud-server-76ebd3a050cb3c84b958f071ec559e6bc9cbc847.tar.gz
nextcloud-server-76ebd3a050cb3c84b958f071ec559e6bc9cbc847.zip
Make apps/ extend the \Test\TestCase and fix overwritten methods
Diffstat (limited to 'apps/files_external')
-rw-r--r--apps/files_external/tests/amazons3.php8
-rw-r--r--apps/files_external/tests/amazons3migration.php21
-rw-r--r--apps/files_external/tests/dropbox.php20
-rw-r--r--apps/files_external/tests/dynamicmountconfig.php4
-rw-r--r--apps/files_external/tests/etagpropagator.php4
-rw-r--r--apps/files_external/tests/ftp.php10
-rw-r--r--apps/files_external/tests/google.php4
-rw-r--r--apps/files_external/tests/mountconfig.php10
-rw-r--r--apps/files_external/tests/owncloud.php10
-rw-r--r--apps/files_external/tests/owncloudfunctions.php2
-rw-r--r--apps/files_external/tests/sftp.php10
-rw-r--r--apps/files_external/tests/smb.php10
-rw-r--r--apps/files_external/tests/smbfunctions.php10
-rw-r--r--apps/files_external/tests/swift.php8
-rw-r--r--apps/files_external/tests/webdav.php10
15 files changed, 97 insertions, 44 deletions
diff --git a/apps/files_external/tests/amazons3.php b/apps/files_external/tests/amazons3.php
index 8eaece6dad9..fbb8744bd8d 100644
--- a/apps/files_external/tests/amazons3.php
+++ b/apps/files_external/tests/amazons3.php
@@ -28,7 +28,9 @@ class AmazonS3 extends Storage {
private $config;
- public function setUp() {
+ protected function setUp() {
+ parent::setUp();
+
$this->config = include('files_external/tests/config.php');
if ( ! is_array($this->config) or ! isset($this->config['amazons3']) or ! $this->config['amazons3']['run']) {
$this->markTestSkipped('AmazonS3 backend not configured');
@@ -36,10 +38,12 @@ class AmazonS3 extends Storage {
$this->instance = new \OC\Files\Storage\AmazonS3($this->config['amazons3']);
}
- public function tearDown() {
+ protected function tearDown() {
if ($this->instance) {
$this->instance->rmdir('');
}
+
+ parent::tearDown();
}
public function testStat() {
diff --git a/apps/files_external/tests/amazons3migration.php b/apps/files_external/tests/amazons3migration.php
index 629cf5cfa3c..145213f5293 100644
--- a/apps/files_external/tests/amazons3migration.php
+++ b/apps/files_external/tests/amazons3migration.php
@@ -23,15 +23,26 @@
namespace Test\Files\Storage;
-class AmazonS3Migration extends \PHPUnit_Framework_TestCase {
+class AmazonS3Migration extends \Test\TestCase {
/**
* @var \OC\Files\Storage\Storage instance
*/
protected $instance;
- public function setUp () {
- $uuid = uniqid();
+ /** @var array */
+ protected $params;
+
+ /** @var string */
+ protected $oldId;
+
+ /** @var string */
+ protected $newId;
+
+ protected function setUp() {
+ parent::setUp();
+
+ $uuid = $this->getUniqueID();
$this->params['key'] = 'key'.$uuid;
$this->params['secret'] = 'secret'.$uuid;
@@ -41,9 +52,11 @@ class AmazonS3Migration extends \PHPUnit_Framework_TestCase {
$this->newId = 'amazon::' . $this->params['bucket'];
}
- public function tearDown () {
+ protected function tearDown() {
$this->deleteStorage($this->oldId);
$this->deleteStorage($this->newId);
+
+ parent::tearDown();
}
public function testUpdateLegacyOnlyId () {
diff --git a/apps/files_external/tests/dropbox.php b/apps/files_external/tests/dropbox.php
index 4b052282019..3f25d5a31e8 100644
--- a/apps/files_external/tests/dropbox.php
+++ b/apps/files_external/tests/dropbox.php
@@ -11,8 +11,10 @@ namespace Test\Files\Storage;
class Dropbox extends Storage {
private $config;
- public function setUp() {
- $id = uniqid();
+ protected function setUp() {
+ parent::setUp();
+
+ $id = $this->getUniqueID();
$this->config = include('files_external/tests/config.php');
if ( ! is_array($this->config) or ! isset($this->config['dropbox']) or ! $this->config['dropbox']['run']) {
$this->markTestSkipped('Dropbox backend not configured');
@@ -21,6 +23,14 @@ class Dropbox extends Storage {
$this->instance = new \OC\Files\Storage\Dropbox($this->config['dropbox']);
}
+ protected function tearDown() {
+ if ($this->instance) {
+ $this->instance->unlink('/');
+ }
+
+ parent::tearDown();
+ }
+
public function directoryProvider() {
// doesn't support leading/trailing spaces
return array(array('folder'));
@@ -36,10 +46,4 @@ class Dropbox extends Storage {
// false because not supported
$this->assertFalse($this->instance->touch('foo'));
}
-
- public function tearDown() {
- if ($this->instance) {
- $this->instance->unlink('/');
- }
- }
}
diff --git a/apps/files_external/tests/dynamicmountconfig.php b/apps/files_external/tests/dynamicmountconfig.php
index 650299075e6..eef2a896b3a 100644
--- a/apps/files_external/tests/dynamicmountconfig.php
+++ b/apps/files_external/tests/dynamicmountconfig.php
@@ -36,7 +36,7 @@ class Test_Mount_Config_Dummy_Backend {
/**
* Class Test_Dynamic_Mount_Config
*/
-class Test_Dynamic_Mount_Config extends \PHPUnit_Framework_TestCase {
+class Test_Dynamic_Mount_Config extends \Test\TestCase {
private $backup;
@@ -82,6 +82,7 @@ class Test_Dynamic_Mount_Config extends \PHPUnit_Framework_TestCase {
}
protected function setUp() {
+ parent::setUp();
$this->backup = OC_Mount_Config::setUp();
@@ -97,5 +98,6 @@ class Test_Dynamic_Mount_Config extends \PHPUnit_Framework_TestCase {
protected function tearDown()
{
OC_Mount_Config::setUp($this->backup);
+ parent::tearDown();
}
}
diff --git a/apps/files_external/tests/etagpropagator.php b/apps/files_external/tests/etagpropagator.php
index 7fa1863f962..84b687d18e4 100644
--- a/apps/files_external/tests/etagpropagator.php
+++ b/apps/files_external/tests/etagpropagator.php
@@ -11,9 +11,9 @@ namespace Tests\Files_External;
use OC\Files\Filesystem;
use OC\User\User;
-class EtagPropagator extends \PHPUnit_Framework_TestCase {
+class EtagPropagator extends \Test\TestCase {
protected function getUser() {
- return new User(uniqid(), null);
+ return new User($this->getUniqueID(), null);
}
/**
diff --git a/apps/files_external/tests/ftp.php b/apps/files_external/tests/ftp.php
index 3037793120a..842b7f43fa8 100644
--- a/apps/files_external/tests/ftp.php
+++ b/apps/files_external/tests/ftp.php
@@ -11,8 +11,10 @@ namespace Test\Files\Storage;
class FTP extends Storage {
private $config;
- public function setUp() {
- $id = uniqid();
+ protected function setUp() {
+ parent::setUp();
+
+ $id = $this->getUniqueID();
$this->config = include('files_external/tests/config.php');
if ( ! is_array($this->config) or ! isset($this->config['ftp']) or ! $this->config['ftp']['run']) {
$this->markTestSkipped('FTP backend not configured');
@@ -22,10 +24,12 @@ class FTP extends Storage {
$this->instance->mkdir('/');
}
- public function tearDown() {
+ protected function tearDown() {
if ($this->instance) {
\OCP\Files::rmdirr($this->instance->constructUrl(''));
}
+
+ parent::tearDown();
}
public function testConstructUrl(){
diff --git a/apps/files_external/tests/google.php b/apps/files_external/tests/google.php
index d5495d49c5e..79023fac9e1 100644
--- a/apps/files_external/tests/google.php
+++ b/apps/files_external/tests/google.php
@@ -28,6 +28,8 @@ class Google extends Storage {
private $config;
protected function setUp() {
+ parent::setUp();
+
$this->config = include('files_external/tests/config.php');
if (!is_array($this->config) || !isset($this->config['google'])
|| !$this->config['google']['run']
@@ -41,5 +43,7 @@ class Google extends Storage {
if ($this->instance) {
$this->instance->rmdir('/');
}
+
+ parent::tearDown();
}
}
diff --git a/apps/files_external/tests/mountconfig.php b/apps/files_external/tests/mountconfig.php
index c11e48b82f3..ab65e648643 100644
--- a/apps/files_external/tests/mountconfig.php
+++ b/apps/files_external/tests/mountconfig.php
@@ -65,7 +65,7 @@ class Test_Mount_Config_Hook_Test {
/**
* Class Test_Mount_Config
*/
-class Test_Mount_Config extends \PHPUnit_Framework_TestCase {
+class Test_Mount_Config extends \Test\TestCase {
private $dataDir;
private $userHome;
@@ -79,7 +79,9 @@ class Test_Mount_Config extends \PHPUnit_Framework_TestCase {
const TEST_GROUP2 = 'group2';
const TEST_GROUP2B = 'group2b';
- public function setUp() {
+ protected function setUp() {
+ parent::setUp();
+
\OC_User::createUser(self::TEST_USER1, self::TEST_USER1);
\OC_User::createUser(self::TEST_USER2, self::TEST_USER2);
@@ -116,7 +118,7 @@ class Test_Mount_Config extends \PHPUnit_Framework_TestCase {
Test_Mount_Config_Hook_Test::setupHooks();
}
- public function tearDown() {
+ protected function tearDown() {
Test_Mount_Config_Hook_Test::clear();
OC_Mount_Config::$skipTest = false;
@@ -134,6 +136,8 @@ class Test_Mount_Config extends \PHPUnit_Framework_TestCase {
'user_mounting_backends',
$this->oldAllowedBackends
);
+
+ parent::tearDown();
}
/**
diff --git a/apps/files_external/tests/owncloud.php b/apps/files_external/tests/owncloud.php
index 408a55864f2..ab9101cfe5f 100644
--- a/apps/files_external/tests/owncloud.php
+++ b/apps/files_external/tests/owncloud.php
@@ -12,8 +12,10 @@ class OwnCloud extends Storage {
private $config;
- public function setUp() {
- $id = uniqid();
+ protected function setUp() {
+ parent::setUp();
+
+ $id = $this->getUniqueID();
$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');
@@ -23,9 +25,11 @@ class OwnCloud extends Storage {
$this->instance->mkdir('/');
}
- public function tearDown() {
+ protected function tearDown() {
if ($this->instance) {
$this->instance->rmdir('/');
}
+
+ parent::tearDown();
}
}
diff --git a/apps/files_external/tests/owncloudfunctions.php b/apps/files_external/tests/owncloudfunctions.php
index 57608fff0cf..8232f30a5e2 100644
--- a/apps/files_external/tests/owncloudfunctions.php
+++ b/apps/files_external/tests/owncloudfunctions.php
@@ -8,7 +8,7 @@
namespace Test\Files\Storage;
-class OwnCloudFunctions extends \PHPUnit_Framework_TestCase {
+class OwnCloudFunctions extends \Test\TestCase {
function configUrlProvider() {
return array(
diff --git a/apps/files_external/tests/sftp.php b/apps/files_external/tests/sftp.php
index efea7f075ff..703b37d93f1 100644
--- a/apps/files_external/tests/sftp.php
+++ b/apps/files_external/tests/sftp.php
@@ -25,8 +25,10 @@ namespace Test\Files\Storage;
class SFTP extends Storage {
private $config;
- public function setUp() {
- $id = uniqid();
+ protected function setUp() {
+ parent::setUp();
+
+ $id = $this->getUniqueID();
$this->config = include('files_external/tests/config.php');
if ( ! is_array($this->config) or ! isset($this->config['sftp']) or ! $this->config['sftp']['run']) {
$this->markTestSkipped('SFTP backend not configured');
@@ -36,9 +38,11 @@ class SFTP extends Storage {
$this->instance->mkdir('/');
}
- public function tearDown() {
+ protected function tearDown() {
if ($this->instance) {
$this->instance->rmdir('/');
}
+
+ parent::tearDown();
}
}
diff --git a/apps/files_external/tests/smb.php b/apps/files_external/tests/smb.php
index 199e35af676..9e5ab2b331f 100644
--- a/apps/files_external/tests/smb.php
+++ b/apps/files_external/tests/smb.php
@@ -12,8 +12,10 @@ class SMB extends Storage {
private $config;
- public function setUp() {
- $id = uniqid();
+ protected function setUp() {
+ parent::setUp();
+
+ $id = $this->getUniqueID();
$this->config = include('files_external/tests/config.php');
if (!is_array($this->config) or !isset($this->config['smb']) or !$this->config['smb']['run']) {
$this->markTestSkipped('Samba backend not configured');
@@ -23,10 +25,12 @@ class SMB extends Storage {
$this->instance->mkdir('/');
}
- public function tearDown() {
+ protected function tearDown() {
if ($this->instance) {
\OCP\Files::rmdirr($this->instance->constructUrl(''));
}
+
+ parent::tearDown();
}
public function directoryProvider() {
diff --git a/apps/files_external/tests/smbfunctions.php b/apps/files_external/tests/smbfunctions.php
index 749906d0136..cf9f7cb20fe 100644
--- a/apps/files_external/tests/smbfunctions.php
+++ b/apps/files_external/tests/smbfunctions.php
@@ -8,10 +8,11 @@
namespace Test\Files\Storage;
-class SMBFunctions extends \PHPUnit_Framework_TestCase {
+class SMBFunctions extends \Test\TestCase {
+
+ protected function setUp() {
+ parent::setUp();
- public function setUp() {
- $id = uniqid();
// dummy config
$this->config = array(
'run'=>false,
@@ -25,9 +26,6 @@ class SMBFunctions extends \PHPUnit_Framework_TestCase {
$this->instance = new \OC\Files\Storage\SMB($this->config);
}
- public function tearDown() {
- }
-
public function testGetId() {
$this->assertEquals('smb::test@smbhost//sharename//rootdir/', $this->instance->getId());
}
diff --git a/apps/files_external/tests/swift.php b/apps/files_external/tests/swift.php
index 3918497ebfa..d2c884a8b4c 100644
--- a/apps/files_external/tests/swift.php
+++ b/apps/files_external/tests/swift.php
@@ -26,7 +26,9 @@ class Swift extends Storage {
private $config;
- public function setUp() {
+ protected function setUp() {
+ parent::setUp();
+
$this->config = include('files_external/tests/config.php');
if (!is_array($this->config) or !isset($this->config['swift'])
or !$this->config['swift']['run']) {
@@ -35,7 +37,7 @@ class Swift extends Storage {
$this->instance = new \OC\Files\Storage\Swift($this->config['swift']);
}
- public function tearDown() {
+ protected function tearDown() {
if ($this->instance) {
$connection = $this->instance->getConnection();
$container = $connection->getContainer($this->config['swift']['bucket']);
@@ -48,5 +50,7 @@ class Swift extends Storage {
$container->delete();
}
+
+ parent::tearDown();
}
}
diff --git a/apps/files_external/tests/webdav.php b/apps/files_external/tests/webdav.php
index 74e905ccc89..5f53568b91a 100644
--- a/apps/files_external/tests/webdav.php
+++ b/apps/files_external/tests/webdav.php
@@ -12,8 +12,10 @@ class DAV extends Storage {
private $config;
- public function setUp() {
- $id = uniqid();
+ protected function setUp() {
+ parent::setUp();
+
+ $id = $this->getUniqueID();
$this->config = include('files_external/tests/config.php');
if ( ! is_array($this->config) or ! isset($this->config['webdav']) or ! $this->config['webdav']['run']) {
$this->markTestSkipped('WebDAV backend not configured');
@@ -26,9 +28,11 @@ class DAV extends Storage {
$this->instance->mkdir('/');
}
- public function tearDown() {
+ protected function tearDown() {
if ($this->instance) {
$this->instance->rmdir('/');
}
+
+ parent::tearDown();
}
}