diff options
author | Robin Appelman <icewind@owncloud.com> | 2012-10-11 22:54:39 +0200 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2012-10-11 22:54:39 +0200 |
commit | fb2d2bc2011c371ff1e4334f84494f15a84a07a2 (patch) | |
tree | b5c20c842441ce4288038909daa5a158c8e74e80 /apps/files_external/tests | |
parent | 5c6e9518edde10e0c23d0d734d2cc6d161fc15c0 (diff) | |
parent | ee28e35ba93032a3d43601c030d3d44df9b092f0 (diff) | |
download | nextcloud-server-fb2d2bc2011c371ff1e4334f84494f15a84a07a2.tar.gz nextcloud-server-fb2d2bc2011c371ff1e4334f84494f15a84a07a2.zip |
merge master into filesystem
Diffstat (limited to 'apps/files_external/tests')
-rw-r--r-- | apps/files_external/tests/amazons3.php | 63 | ||||
-rw-r--r-- | apps/files_external/tests/config.php | 2 | ||||
-rw-r--r-- | apps/files_external/tests/dropbox.php | 25 | ||||
-rw-r--r-- | apps/files_external/tests/ftp.php | 25 | ||||
-rw-r--r-- | apps/files_external/tests/google.php | 62 | ||||
-rw-r--r-- | apps/files_external/tests/smb.php | 26 | ||||
-rw-r--r-- | apps/files_external/tests/swift.php | 28 | ||||
-rw-r--r-- | apps/files_external/tests/webdav.php | 26 |
8 files changed, 124 insertions, 133 deletions
diff --git a/apps/files_external/tests/amazons3.php b/apps/files_external/tests/amazons3.php index cf372aecbd7..9fb377af3ba 100644 --- a/apps/files_external/tests/amazons3.php +++ b/apps/files_external/tests/amazons3.php @@ -1,45 +1,44 @@ <?php /** -* ownCloud -* -* @author Michael Gapczynski -* @copyright 2012 Michael Gapczynski mtgap@owncloud.com -* -* This library is free software; you can redistribute it and/or -* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE -* License as published by the Free Software Foundation; either -* version 3 of the License, or any later version. -* -* This library is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU AFFERO GENERAL PUBLIC LICENSE for more details. -* -* You should have received a copy of the GNU Affero General Public -* License along with this library. If not, see <http://www.gnu.org/licenses/>. -*/ + * ownCloud + * + * @author Michael Gapczynski + * @copyright 2012 Michael Gapczynski mtgap@owncloud.com + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE + * License as published by the Free Software Foundation; either + * version 3 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU Affero General Public + * 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 AmazonS3 extends Storage{} - return; -} else { - class AmazonS3 extends Storage { +class AmazonS3 extends Storage { - private $config; - private $id; + private $config; + private $id; - public function setUp() { - $id = uniqid(); - $this->config = include('apps/files_external/tests/config.php'); - $this->config['amazons3']['bucket'] = $id; // Make sure we have a new empty bucket to work in - $this->instance = new \OC\Files\Storage\AmazonS3($this->config['amazons3']); + public function setUp() { + $id = uniqid(); + $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'); } + $this->config['amazons3']['bucket'] = $id; // Make sure we have a new empty bucket to work in + $this->instance = new \OC\Files\Storage\AmazonS3($this->config['amazons3']); + } - public function tearDown() { + public function tearDown() { + if ($this->instance) { $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/config.php b/apps/files_external/tests/config.php index 7779f618948..ff16b1c1d8a 100644 --- a/apps/files_external/tests/config.php +++ b/apps/files_external/tests/config.php @@ -26,7 +26,7 @@ return array( 'run'=>false, 'user'=>'test:tester', 'token'=>'testing', - 'host'=>'localhost:8080/auth', + 'host'=>'localhost.local:8080/auth', 'root'=>'/', ), 'smb'=>array( diff --git a/apps/files_external/tests/dropbox.php b/apps/files_external/tests/dropbox.php index e77e0767c91..c517ef4cbb7 100644 --- a/apps/files_external/tests/dropbox.php +++ b/apps/files_external/tests/dropbox.php @@ -8,22 +8,21 @@ namespace Test\Files\Storage; -$config=include('files_external/tests/config.php'); -if(!is_array($config) or !isset($config['dropbox']) or !$config['dropbox']['run']) { - abstract class Dropbox extends Storage{} - return; -}else{ - class Dropbox extends Storage { - private $config; +class Dropbox extends Storage { + private $config; - public function setUp() { - $id=uniqid(); - $this->config=include('files_external/tests/config.php'); - $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']); + public function setUp() { + $id = uniqid(); + $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'); } + $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']); + } - public function tearDown() { + public function tearDown() { + if ($this->instance) { $this->instance->unlink('/'); } } diff --git a/apps/files_external/tests/ftp.php b/apps/files_external/tests/ftp.php index 8a0821e25a5..3e6208e4a0d 100644 --- a/apps/files_external/tests/ftp.php +++ b/apps/files_external/tests/ftp.php @@ -8,22 +8,21 @@ 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 FTP extends Storage{} - return; -}else{ - class FTP extends Storage { - private $config; +class FTP extends Storage { + private $config; - public function setUp() { - $id=uniqid(); - $this->config=include('apps/files_external/tests/config.php'); - $this->config['ftp']['root'].='/'.$id;//make sure we have an new empty folder to work in - $this->instance=new \OC\Files\Storage\FTP($this->config['ftp']); + public function setUp() { + $id = uniqid(); + $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'); } + $this->config['ftp']['root'] .= '/' . $id; //make sure we have an new empty folder to work in + $this->instance = new \OC\Files\Storage\FTP($this->config['ftp']); + } - public function tearDown() { + public function tearDown() { + if ($this->instance) { \OCP\Files::rmdirr($this->instance->constructUrl('')); } } diff --git a/apps/files_external/tests/google.php b/apps/files_external/tests/google.php index fff6461c912..87b3ae4e4cc 100644 --- a/apps/files_external/tests/google.php +++ b/apps/files_external/tests/google.php @@ -1,44 +1,42 @@ <?php /** -* ownCloud -* -* @author Michael Gapczynski -* @copyright 2012 Michael Gapczynski mtgap@owncloud.com -* -* This library is free software; you can redistribute it and/or -* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE -* License as published by the Free Software Foundation; either -* version 3 of the License, or any later version. -* -* This library is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU AFFERO GENERAL PUBLIC LICENSE for more details. -* -* You should have received a copy of the GNU Affero General Public -* License along with this library. If not, see <http://www.gnu.org/licenses/>. -*/ + * ownCloud + * + * @author Michael Gapczynski + * @copyright 2012 Michael Gapczynski mtgap@owncloud.com + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE + * License as published by the Free Software Foundation; either + * version 3 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU Affero General Public + * 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 Google extends Storage{} - return; -}else{ - class Google extends Storage { +class Google extends Storage { + private $config; - private $config; - - public function setUp() { - $id=uniqid(); - $this->config=include('apps/files_external/tests/config.php'); - $this->config['google']['root'].='/'.$id;//make sure we have an new empty folder to work in - $this->instance=new \OC\Files\Storage\Google($this->config['google']); + public function setUp() { + $id = uniqid(); + $this->config = include('files_external/tests/config.php'); + if (!is_array($this->config) or !isset($this->config['google']) or !$this->config['google']['run']) { + $this->markTestSkipped('Google backend not configured'); } + $this->config['google']['root'] .= '/' . $id; //make sure we have an new empty folder to work in + $this->instance = new \OC\Files\Storage\Google($this->config['google']); + } - public function tearDown() { + public function tearDown() { + if ($this->instance) { $this->instance->rmdir('/'); } } diff --git a/apps/files_external/tests/smb.php b/apps/files_external/tests/smb.php index 24728dc2370..b4ac6db1187 100644 --- a/apps/files_external/tests/smb.php +++ b/apps/files_external/tests/smb.php @@ -8,24 +8,22 @@ namespace Test\Files\Storage; -$config=include('apps/files_external/tests/config.php'); +class SMB extends Storage { + private $config; -if(!is_array($config) or !isset($config['smb']) or !$config['smb']['run']) { - abstract class SMB extends Storage{} - return; -}else{ - class SMB extends Storage { - private $config; - - public function setUp() { - $id=uniqid(); - $this->config=include('apps/files_external/tests/config.php'); - $this->config['smb']['root'].=$id;//make sure we have an new empty folder to work in - $this->instance=new \OC\Files\Storage\SMB($this->config['smb']); + public function setUp() { + $id = uniqid(); + $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'); } + $this->config['smb']['root'] .= $id; //make sure we have an new empty folder to work in + $this->instance = new \OC\Files\Storage\SMB($this->config['smb']); + } - public function tearDown() { + public function tearDown() { + if ($this->instance) { \OCP\Files::rmdirr($this->instance->constructUrl('')); } } diff --git a/apps/files_external/tests/swift.php b/apps/files_external/tests/swift.php index 98a97f99b5b..4899d44acad 100644 --- a/apps/files_external/tests/swift.php +++ b/apps/files_external/tests/swift.php @@ -8,25 +8,23 @@ 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 SWIFT extends Storage{} - return; -}else{ - class SWIFT extends Storage { - private $config; +class SWIFT extends Storage { + private $config; - public function setUp() { - $id=uniqid(); - $this->config=include('apps/files_external/tests/config.php'); - $this->config['swift']['root'].='/'.$id;//make sure we have an new empty folder to work in - $this->instance=new \OC\Files\Storage\SWIFT($this->config['swift']); + public function setUp() { + $id = uniqid(); + $this->config = include('files_external/tests/config.php'); + if (!is_array($this->config) or !isset($this->config['swift']) or !$this->config['swift']['run']) { + $this->markTestSkipped('OpenStack SWIFT backend not configured'); } + $this->config['swift']['root'] .= '/' . $id; //make sure we have an new empty folder to work in + $this->instance = new \OC\Files\Storage\SWIFT($this->config['swift']); + } - public function tearDown() { - $this->instance->rmdir(''); + public function tearDown() { + if ($this->instance) { + $this->instance->rmdir(''); } - } } diff --git a/apps/files_external/tests/webdav.php b/apps/files_external/tests/webdav.php index cddd0d513ed..13e3be42948 100644 --- a/apps/files_external/tests/webdav.php +++ b/apps/files_external/tests/webdav.php @@ -8,22 +8,22 @@ 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 DAV extends Storage{} - return; -}else{ - class DAV extends Storage { - private $config; +class DAV extends Storage { - public function setUp() { - $id=uniqid(); - $this->config=include('apps/files_external/tests/config.php'); - $this->config['webdav']['root'].='/'.$id;//make sure we have an new empty folder to work in - $this->instance=new \OC\Files\Storage\DAV($this->config['webdav']); + private $config; + + public function setUp() { + $id = uniqid(); + $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'); } + $this->config['webdav']['root'] .= '/' . $id; //make sure we have an new empty folder to work in + $this->instance = new \OC\Files\Storage\DAV($this->config['webdav']); + } - public function tearDown() { + public function tearDown() { + if ($this->instance) { $this->instance->rmdir('/'); } } |