summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2012-09-22 14:51:15 +0200
committerRobin Appelman <icewind@owncloud.com>2012-09-22 14:51:15 +0200
commit96b798a59f236f4251ced87ecac9da55e82d1685 (patch)
tree54d6882d6432d22aa6d1ca8a029264010a4d8229
parent153cd802a9bbc0f5a5f67fe428af7ca78185011f (diff)
downloadnextcloud-server-96b798a59f236f4251ced87ecac9da55e82d1685.tar.gz
nextcloud-server-96b798a59f236f4251ced87ecac9da55e82d1685.zip
move storage backend test cases to their own namespace
-rw-r--r--apps/files_external/tests/amazons3.php8
-rw-r--r--apps/files_external/tests/ftp.php8
-rw-r--r--apps/files_external/tests/google.php6
-rw-r--r--apps/files_external/tests/smb.php8
-rw-r--r--apps/files_external/tests/swift.php6
-rw-r--r--apps/files_external/tests/webdav.php6
-rw-r--r--tests/lib/files/storage/commontest.php (renamed from tests/lib/filestorage/commontest.php)8
-rw-r--r--tests/lib/files/storage/local.php (renamed from tests/lib/filestorage/local.php)10
-rw-r--r--tests/lib/files/storage/storage.php (renamed from tests/lib/filestorage.php)25
9 files changed, 50 insertions, 35 deletions
diff --git a/apps/files_external/tests/amazons3.php b/apps/files_external/tests/amazons3.php
index ad1c453abb7..cf372aecbd7 100644
--- a/apps/files_external/tests/amazons3.php
+++ b/apps/files_external/tests/amazons3.php
@@ -20,12 +20,14 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
+namespace Test\Files\Storage;
+
$config = include('apps/files_external/tests/config.php');
if (!is_array($config) or !isset($config['amazons3']) or !$config['amazons3']['run']) {
- abstract class Test_Filestorage_AmazonS3 extends Test_FileStorage{}
+ abstract class AmazonS3 extends Storage{}
return;
} else {
- class Test_Filestorage_AmazonS3 extends Test_FileStorage {
+ class AmazonS3 extends Storage {
private $config;
private $id;
@@ -38,7 +40,7 @@ if (!is_array($config) or !isset($config['amazons3']) or !$config['amazons3']['r
}
public function tearDown() {
- $s3 = new AmazonS3(array('key' => $this->config['amazons3']['key'], 'secret' => $this->config['amazons3']['secret']));
+ $s3 = new \AmazonS3(array('key' => $this->config['amazons3']['key'], 'secret' => $this->config['amazons3']['secret']));
if ($s3->delete_all_objects($this->id)) {
$s3->delete_bucket($this->id);
}
diff --git a/apps/files_external/tests/ftp.php b/apps/files_external/tests/ftp.php
index 105f7b485bd..8a0821e25a5 100644
--- a/apps/files_external/tests/ftp.php
+++ b/apps/files_external/tests/ftp.php
@@ -6,12 +6,14 @@
* See the COPYING-README file.
*/
+namespace Test\Files\Storage;
+
$config=include('apps/files_external/tests/config.php');
if(!is_array($config) or !isset($config['ftp']) or !$config['ftp']['run']) {
- abstract class Test_Filestorage_FTP extends Test_FileStorage{}
+ abstract class FTP extends Storage{}
return;
}else{
- class Test_Filestorage_FTP extends Test_FileStorage {
+ class FTP extends Storage {
private $config;
public function setUp() {
@@ -22,7 +24,7 @@ if(!is_array($config) or !isset($config['ftp']) or !$config['ftp']['run']) {
}
public function tearDown() {
- OCP\Files::rmdirr($this->instance->constructUrl(''));
+ \OCP\Files::rmdirr($this->instance->constructUrl(''));
}
}
}
diff --git a/apps/files_external/tests/google.php b/apps/files_external/tests/google.php
index e96c2263e1c..fff6461c912 100644
--- a/apps/files_external/tests/google.php
+++ b/apps/files_external/tests/google.php
@@ -20,12 +20,14 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
+namespace Test\Files\Storage;
+
$config=include('apps/files_external/tests/config.php');
if(!is_array($config) or !isset($config['google']) or !$config['google']['run']) {
- abstract class Test_Filestorage_Google extends Test_FileStorage{}
+ abstract class Google extends Storage{}
return;
}else{
- class Test_Filestorage_Google extends Test_FileStorage {
+ class Google extends Storage {
private $config;
diff --git a/apps/files_external/tests/smb.php b/apps/files_external/tests/smb.php
index a0c5d834736..87b110a241c 100644
--- a/apps/files_external/tests/smb.php
+++ b/apps/files_external/tests/smb.php
@@ -8,11 +8,13 @@
$config=include('apps/files_external/tests/config.php');
+namespace Test\Files\Storage;
+
if(!is_array($config) or !isset($config['smb']) or !$config['smb']['run']) {
- abstract class Test_Filestorage_SMB extends Test_FileStorage{}
+ abstract class SMB extends Storage{}
return;
}else{
- class Test_Filestorage_SMB extends Test_FileStorage {
+ class SMB extends Storage {
private $config;
public function setUp() {
@@ -23,7 +25,7 @@ if(!is_array($config) or !isset($config['smb']) or !$config['smb']['run']) {
}
public function tearDown() {
- OCP\Files::rmdirr($this->instance->constructUrl(''));
+ \OCP\Files::rmdirr($this->instance->constructUrl(''));
}
}
}
diff --git a/apps/files_external/tests/swift.php b/apps/files_external/tests/swift.php
index 3e1485b0f3a..98a97f99b5b 100644
--- a/apps/files_external/tests/swift.php
+++ b/apps/files_external/tests/swift.php
@@ -6,12 +6,14 @@
* See the COPYING-README file.
*/
+namespace Test\Files\Storage;
+
$config=include('apps/files_external/tests/config.php');
if(!is_array($config) or !isset($config['swift']) or !$config['swift']['run']) {
- abstract class Test_Filestorage_SWIFT extends Test_FileStorage{}
+ abstract class SWIFT extends Storage{}
return;
}else{
- class Test_Filestorage_SWIFT extends Test_FileStorage {
+ class SWIFT extends Storage {
private $config;
public function setUp() {
diff --git a/apps/files_external/tests/webdav.php b/apps/files_external/tests/webdav.php
index 6b1121c9d0c..cddd0d513ed 100644
--- a/apps/files_external/tests/webdav.php
+++ b/apps/files_external/tests/webdav.php
@@ -6,12 +6,14 @@
* See the COPYING-README file.
*/
+namespace Test\Files\Storage;
+
$config=include('apps/files_external/tests/config.php');
if(!is_array($config) or !isset($config['webdav']) or !$config['webdav']['run']) {
- abstract class Test_Filestorage_DAV extends Test_FileStorage{}
+ abstract class DAV extends Storage{}
return;
}else{
- class Test_Filestorage_DAV extends Test_FileStorage {
+ class DAV extends Storage {
private $config;
public function setUp() {
diff --git a/tests/lib/filestorage/commontest.php b/tests/lib/files/storage/commontest.php
index 0e52e916789..2e3808e2d92 100644
--- a/tests/lib/filestorage/commontest.php
+++ b/tests/lib/files/storage/commontest.php
@@ -20,7 +20,9 @@
*
*/
-class Test_Filestorage_CommonTest extends Test_FileStorage {
+namespace Test\Files\Storage;
+
+class CommonTest extends Storage {
/**
* @var string tmpDir
*/
@@ -34,8 +36,8 @@ class Test_Filestorage_CommonTest extends Test_FileStorage {
}
public function tearDown() {
- OC_Helper::rmdirr($this->tmpDir);
+ \OC_Helper::rmdirr($this->tmpDir);
}
}
-?> \ No newline at end of file
+?>
diff --git a/tests/lib/filestorage/local.php b/tests/lib/files/storage/local.php
index 7bb27830baa..6672368e676 100644
--- a/tests/lib/filestorage/local.php
+++ b/tests/lib/files/storage/local.php
@@ -20,19 +20,19 @@
*
*/
-class Test_Filestorage_Local extends Test_FileStorage {
+namespace Test\Files\Storage;
+
+class Local extends Storage {
/**
* @var string tmpDir
*/
private $tmpDir;
public function setUp() {
- $this->tmpDir=OC_Helper::tmpFolder();
+ $this->tmpDir=\OC_Helper::tmpFolder();
$this->instance=new \OC\Files\Storage\Local(array('datadir'=>$this->tmpDir));
}
public function tearDown() {
- OC_Helper::rmdirr($this->tmpDir);
+ \OC_Helper::rmdirr($this->tmpDir);
}
}
-
-?> \ No newline at end of file
diff --git a/tests/lib/filestorage.php b/tests/lib/files/storage/storage.php
index bfb40bcd674..9c8581b259a 100644
--- a/tests/lib/filestorage.php
+++ b/tests/lib/files/storage/storage.php
@@ -20,7 +20,9 @@
*
*/
-abstract class Test_FileStorage extends UnitTestCase {
+namespace Test\Files\Storage;
+
+abstract class Storage extends \UnitTestCase {
/**
* @var \OC\Files\Storage\Storage instance
*/
@@ -83,7 +85,7 @@ abstract class Test_FileStorage extends UnitTestCase {
* test the various uses of file_get_contents and file_put_contents
*/
public function testGetPutContents() {
- $sourceFile=OC::$SERVERROOT.'/tests/data/lorem.txt';
+ $sourceFile=\OC::$SERVERROOT.'/tests/data/lorem.txt';
$sourceText=file_get_contents($sourceFile);
//fill a file with string data
@@ -103,21 +105,21 @@ abstract class Test_FileStorage extends UnitTestCase {
$this->assertEqual('httpd/unix-directory',$this->instance->getMimeType('/'));
$this->assertEqual(false,$this->instance->getMimeType('/non/existing/file'));
- $textFile=OC::$SERVERROOT.'/tests/data/lorem.txt';
+ $textFile=\OC::$SERVERROOT.'/tests/data/lorem.txt';
$this->instance->file_put_contents('/lorem.txt',file_get_contents($textFile,'r'));
$this->assertEqual('text/plain',$this->instance->getMimeType('/lorem.txt'));
- $pngFile=OC::$SERVERROOT.'/tests/data/logo-wide.png';
+ $pngFile=\OC::$SERVERROOT.'/tests/data/logo-wide.png';
$this->instance->file_put_contents('/logo-wide.png',file_get_contents($pngFile,'r'));
$this->assertEqual('image/png',$this->instance->getMimeType('/logo-wide.png'));
- $svgFile=OC::$SERVERROOT.'/tests/data/logo-wide.svg';
+ $svgFile=\OC::$SERVERROOT.'/tests/data/logo-wide.svg';
$this->instance->file_put_contents('/logo-wide.svg',file_get_contents($svgFile,'r'));
$this->assertEqual('image/svg+xml',$this->instance->getMimeType('/logo-wide.svg'));
}
public function testCopyAndMove() {
- $textFile=OC::$SERVERROOT.'/tests/data/lorem.txt';
+ $textFile=\OC::$SERVERROOT.'/tests/data/lorem.txt';
$this->instance->file_put_contents('/source.txt',file_get_contents($textFile));
$this->instance->copy('/source.txt','/target.txt');
$this->assertTrue($this->instance->file_exists('/target.txt'));
@@ -130,7 +132,7 @@ abstract class Test_FileStorage extends UnitTestCase {
}
public function testLocal() {
- $textFile=OC::$SERVERROOT.'/tests/data/lorem.txt';
+ $textFile=\OC::$SERVERROOT.'/tests/data/lorem.txt';
$this->instance->file_put_contents('/lorem.txt',file_get_contents($textFile));
$localFile=$this->instance->getLocalFile('/lorem.txt');
$this->assertTrue(file_exists($localFile));
@@ -151,7 +153,7 @@ abstract class Test_FileStorage extends UnitTestCase {
}
public function testStat() {
- $textFile=OC::$SERVERROOT.'/tests/data/lorem.txt';
+ $textFile=\OC::$SERVERROOT.'/tests/data/lorem.txt';
$ctimeStart=time();
$this->instance->file_put_contents('/lorem.txt',file_get_contents($textFile));
$this->assertTrue($this->instance->isReadable('/lorem.txt'));
@@ -198,7 +200,6 @@ abstract class Test_FileStorage extends UnitTestCase {
fclose($fh);
clearstatcache();
$mtimeEnd=time();
- $originalCTime=$cTime;
$mTime=$this->instance->filemtime('/lorem.txt');
$this->assertTrue(($mtimeStart-1)<=$mTime);
$this->assertTrue($mTime<=($mtimeEnd+1));
@@ -208,11 +209,11 @@ abstract class Test_FileStorage extends UnitTestCase {
}
public function testSearch() {
- $textFile=OC::$SERVERROOT.'/tests/data/lorem.txt';
+ $textFile=\OC::$SERVERROOT.'/tests/data/lorem.txt';
$this->instance->file_put_contents('/lorem.txt',file_get_contents($textFile,'r'));
- $pngFile=OC::$SERVERROOT.'/tests/data/logo-wide.png';
+ $pngFile=\OC::$SERVERROOT.'/tests/data/logo-wide.png';
$this->instance->file_put_contents('/logo-wide.png',file_get_contents($pngFile,'r'));
- $svgFile=OC::$SERVERROOT.'/tests/data/logo-wide.svg';
+ $svgFile=\OC::$SERVERROOT.'/tests/data/logo-wide.svg';
$this->instance->file_put_contents('/logo-wide.svg',file_get_contents($svgFile,'r'));
$result=$this->instance->search('logo');
$this->assertEqual(2,count($result));