*
*/
-class Test_OC_Files_App_Rename extends \PHPUnit_Framework_TestCase {
+class Test_OC_Files_App_Rename extends \Test\TestCase {
private static $user;
/**
*/
private $files;
- /** @var \OC\Files\Storage\Storage */
private $originalStorage;
protected function setUp() {
use OCA\Encryption;
use OCA\Files_Encryption\Migration;
-class Test_Migration extends PHPUnit_Framework_TestCase {
+class Test_Migration extends \Test\TestCase {
- public function tearDown() {
+ protected function tearDown() {
if (OC_DB::tableExists('encryption_test')) {
OC_DB::dropTable('encryption_test');
}
$this->assertTableNotExist('encryption_test');
+
+ parent::tearDown();
}
- public function setUp() {
+ protected function setUp() {
+ parent::setUp();
+
if (OC_DB::tableExists('encryption_test')) {
OC_DB::dropTable('encryption_test');
}
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');
$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() {
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;
$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 () {
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');
$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'));
// false because not supported
$this->assertFalse($this->instance->touch('foo'));
}
-
- public function tearDown() {
- if ($this->instance) {
- $this->instance->unlink('/');
- }
- }
}
/**
* Class Test_Dynamic_Mount_Config
*/
-class Test_Dynamic_Mount_Config extends \PHPUnit_Framework_TestCase {
+class Test_Dynamic_Mount_Config extends \Test\TestCase {
private $backup;
}
protected function setUp() {
+ parent::setUp();
$this->backup = OC_Mount_Config::setUp();
protected function tearDown()
{
OC_Mount_Config::setUp($this->backup);
+ parent::tearDown();
}
}
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);
}
/**
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');
$this->instance->mkdir('/');
}
- public function tearDown() {
+ protected function tearDown() {
if ($this->instance) {
\OCP\Files::rmdirr($this->instance->constructUrl(''));
}
+
+ parent::tearDown();
}
public function testConstructUrl(){
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']
if ($this->instance) {
$this->instance->rmdir('/');
}
+
+ parent::tearDown();
}
}
/**
* Class Test_Mount_Config
*/
-class Test_Mount_Config extends \PHPUnit_Framework_TestCase {
+class Test_Mount_Config extends \Test\TestCase {
private $dataDir;
private $userHome;
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);
Test_Mount_Config_Hook_Test::setupHooks();
}
- public function tearDown() {
+ protected function tearDown() {
Test_Mount_Config_Hook_Test::clear();
OC_Mount_Config::$skipTest = false;
'user_mounting_backends',
$this->oldAllowedBackends
);
+
+ parent::tearDown();
}
/**
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');
$this->instance->mkdir('/');
}
- public function tearDown() {
+ protected function tearDown() {
if ($this->instance) {
$this->instance->rmdir('/');
}
+
+ parent::tearDown();
}
}
namespace Test\Files\Storage;
-class OwnCloudFunctions extends \PHPUnit_Framework_TestCase {
+class OwnCloudFunctions extends \Test\TestCase {
function configUrlProvider() {
return array(
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');
$this->instance->mkdir('/');
}
- public function tearDown() {
+ protected function tearDown() {
if ($this->instance) {
$this->instance->rmdir('/');
}
+
+ parent::tearDown();
}
}
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');
$this->instance->mkdir('/');
}
- public function tearDown() {
+ protected function tearDown() {
if ($this->instance) {
\OCP\Files::rmdirr($this->instance->constructUrl(''));
}
+
+ parent::tearDown();
}
public function directoryProvider() {
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,
$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());
}
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']) {
$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']);
$container->delete();
}
+
+ parent::tearDown();
}
}
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');
$this->instance->mkdir('/');
}
- public function tearDown() {
+ protected function tearDown() {
if ($this->instance) {
$this->instance->rmdir('/');
}
+
+ parent::tearDown();
}
}
private static $tempStorage;
- function setUp() {
+ protected function setUp() {
parent::setUp();
\OC::$server->getAppConfig()->setValue('core', 'shareapi_exclude_groups', 'no');
$this->view->file_put_contents($this->folder . $this->subfolder . $this->filename, $this->data);
}
- function tearDown() {
+ protected function tearDown() {
if($this->view instanceof \OC\Files\View) {
$this->view->unlink($this->filename);
$this->view->deleteAll($this->folder);
public $subfolder;
public $subsubfolder;
- function setUp() {
+ protected function setUp() {
parent::setUp();
$this->folder = self::TEST_FOLDER_NAME;
$this->view->file_put_contents($this->folder . $this->subfolder . $this->subsubfolder . $this->filename, $this->data);
}
- function tearDown() {
+ protected function tearDown() {
$this->view->unlink($this->filename);
$this->view->deleteAll($this->folder);
/** @var \OC\Files\Storage\Storage */
protected $sharedStorage;
- function setUp() {
+ protected function setUp() {
parent::setUp();
\OC_User::setDisplayName(self::TEST_FILES_SHARING_API_USER1, 'User One');
$this->sharedCache = $this->sharedStorage->getCache();
}
- function tearDown() {
+ protected function tearDown() {
$this->sharedCache->clear();
self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
/**
* Tests for the external Storage class for remote shares.
*/
-class Test_Files_Sharing_External_Storage extends \PHPUnit_Framework_TestCase {
+class Test_Files_Sharing_External_Storage extends \Test\TestCase {
function optionsProvider() {
return array(
*/
private $ownerCache;
- function setUp() {
+ protected function setUp() {
parent::setUp();
self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
$this->sharedCacheRestrictedShare = $this->sharedStorageRestrictedShare->getCache();
}
- function tearDown() {
+ protected function tearDown() {
$this->sharedCache->clear();
self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
private static $tempStorage;
- function setUp() {
+ protected function setUp() {
parent::setUp();
// load proxies
$this->view->file_put_contents($this->folder . $this->subfolder . $this->filename, $this->data);
}
- function tearDown() {
+ protected function tearDown() {
$this->view->deleteAll($this->folder);
self::$tempStorage = null;
private static $tempStorage;
- function setUp() {
+ protected function setUp() {
parent::setUp();
$this->folder = self::TEST_FOLDER_NAME;
$this->view->file_put_contents($this->folder . $this->subfolder . $this->filename, $this->data);
}
- function tearDown() {
+ protected function tearDown() {
$this->view->unlink($this->filename);
$this->view->deleteAll($this->folder);
*/
class Test_Files_Sharing_Mount extends OCA\Files_sharing\Tests\TestCase {
- function setUp() {
+ protected function setUp() {
parent::setUp();
$this->folder = '/folder_share_storage_test';
$this->view->file_put_contents($this->folder . $this->filename, "file in subfolder");
}
- function tearDown() {
+ protected function tearDown() {
$this->view->unlink($this->folder);
$this->view->unlink($this->filename);
*/
class Test_Files_Sharing_Storage extends OCA\Files_sharing\Tests\TestCase {
- function setUp() {
+ protected function setUp() {
parent::setUp();
$this->folder = '/folder_share_storage_test';
$this->view->file_put_contents($this->folder . $this->filename, "file in subfolder");
}
- function tearDown() {
+ protected function tearDown() {
$this->view->unlink($this->folder);
$this->view->unlink($this->filename);
*
* Base class for sharing tests.
*/
-abstract class TestCase extends \PHPUnit_Framework_TestCase {
+abstract class TestCase extends \Test\TestCase {
const TEST_FILES_SHARING_API_USER1 = "test-share-user1";
const TEST_FILES_SHARING_API_USER2 = "test-share-user2";
public $subfolder;
public static function setUpBeforeClass() {
+ parent::setUpBeforeClass();
// remember files_encryption state
self::$stateFilesEncryption = \OC_App::isEnabled('files_encryption');
}
- function setUp() {
+ protected function setUp() {
+ parent::setUp();
$this->assertFalse(\OC_App::isEnabled('files_encryption'));
$this->view = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER1 . '/files');
}
- function tearDown() {
+ protected function tearDown() {
$query = \OCP\DB::prepare('DELETE FROM `*PREFIX*share`');
$query->execute();
+
+ parent::tearDown();
}
public static function tearDownAfterClass() {
-
// cleanup users
\OC_User::deleteUser(self::TEST_FILES_SHARING_API_USER1);
\OC_User::deleteUser(self::TEST_FILES_SHARING_API_USER2);
\OC_Util::tearDownFS();
\OC_User::setUserId('');
Filesystem::tearDown();
+
+ parent::tearDownAfterClass();
}
/**
\OCA\Files_Sharing\Helper::registerHooks();
}
- function setUp() {
+ protected function setUp() {
parent::setUp();
$this->folder = self::TEST_FOLDER_NAME;
$this->view->file_put_contents($this->folder . '/' . $this->filename, $this->data);
}
- function tearDown() {
+ protected function tearDown() {
$this->view->unlink($this->filename);
$this->view->deleteAll($this->folder);
*/
private $sharedCache;
- function setUp() {
+ protected function setUp() {
parent::setUp();
self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
$this->sharedCache = $this->sharedStorage->getCache();
}
- function tearDown() {
+ protected function tearDown() {
$this->sharedCache->clear();
self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
/**
* Class Test_Encryption_Crypt
*/
-class Test_Trashbin extends \PHPUnit_Framework_TestCase {
+class Test_Trashbin extends \Test\TestCase {
const TEST_TRASHBIN_USER1 = "test-trashbin-user1";
const TEST_TRASHBIN_USER2 = "test-trashbin-user2";
private $rootView;
public static function setUpBeforeClass() {
+ parent::setUpBeforeClass();
+
// reset backend
\OC_User::clearBackends();
\OC_User::useBackend('database');
\OC_Config::setValue('trashbin_auto_expire', self::$rememberAutoExpire);
\OC_Hook::clear();
+
+ parent::tearDownAfterClass();
}
- public function setUp() {
+ protected function setUp() {
+ parent::setUp();
+
$this->trashRoot1 = '/' . self::TEST_TRASHBIN_USER1 . '/files_trashbin';
$this->trashRoot2 = '/' . self::TEST_TRASHBIN_USER2 . '/files_trashbin';
$this->rootView = new \OC\Files\View();
self::loginHelper(self::TEST_TRASHBIN_USER1);
}
- public function tearDown() {
+ protected function tearDown() {
$this->rootView->deleteAll($this->trashRoot1);
$this->rootView->deleteAll($this->trashRoot2);
+
+ parent::tearDown();
}
/**
* Class Test_Files_versions
* this class provide basic files versions test
*/
-class Test_Files_Versioning extends \PHPUnit_Framework_TestCase {
+class Test_Files_Versioning extends \Test\TestCase {
const TEST_VERSIONS_USER = 'test-versions-user';
const TEST_VERSIONS_USER2 = 'test-versions-user2';
use \OCA\user_ldap\lib\Connection;
use \OCA\user_ldap\lib\ILDAPWrapper;
-class Test_Access extends \PHPUnit_Framework_TestCase {
+class Test_Access extends \Test\TestCase {
private function getConnecterAndLdapMock() {
static $conMethods;
static $accMethods;
namespace OCA\user_ldap\tests;
-class Test_Connection extends \PHPUnit_Framework_TestCase {
+class Test_Connection extends \Test\TestCase {
public function testOriginalAgentUnchangedOnClone() {
//background: upon login a bind is done with the user credentials
namespace OCA\user_ldap\tests;
-namespace OCA\user_ldap\tests;
-
use \OCA\user_ldap\GROUP_LDAP as GroupLDAP;
use \OCA\user_ldap\lib\Access;
use \OCA\user_ldap\lib\Connection;
use \OCA\user_ldap\lib\ILDAPWrapper;
-class Test_Group_Ldap extends \PHPUnit_Framework_TestCase {
+class Test_Group_Ldap extends \Test\TestCase {
private function getAccessMock() {
static $conMethods;
static $accMethods;
use OCA\user_ldap\lib\Helper;
-class Test_Helper extends \PHPUnit_Framework_TestCase {
+class Test_Helper extends \Test\TestCase {
public function testTableTruncate() {
use OCA\user_ldap\lib\user\Manager;
-class Test_User_Manager extends \PHPUnit_Framework_TestCase {
+class Test_User_Manager extends \Test\TestCase {
private function getTestInstances() {
$access = $this->getMock('\OCA\user_ldap\lib\user\IUserTools');
use OCA\user_ldap\lib\user\User;
-class Test_User_User extends \PHPUnit_Framework_TestCase {
+class Test_User_User extends \Test\TestCase {
private function getTestInstances() {
$access = $this->getMock('\OCA\user_ldap\lib\user\IUserTools');
use \OCA\user_ldap\lib\Connection;
use \OCA\user_ldap\lib\ILDAPWrapper;
-class Test_User_Ldap_Direct extends \PHPUnit_Framework_TestCase {
+class Test_User_Ldap_Direct extends \Test\TestCase {
protected $backend;
protected $access;
- public function setUp() {
+ protected function setUp() {
+ parent::setUp();
+
\OC_User::clearBackends();
\OC_Group::clearBackends();
}
// use \OCA\user_ldap\lib\Configuration;
// use \OCA\user_ldap\lib\ILDAPWrapper;
-class Test_Wizard extends \PHPUnit_Framework_TestCase {
- public function setUp() {
+class Test_Wizard extends \Test\TestCase {
+ protected function setUp() {
+ parent::setUp();
//we need to make sure the consts are defined, otherwise tests will fail
//on systems without php5_ldap
$ldapConsts = array('LDAP_OPT_PROTOCOL_VERSION',
namespace Test\Files\Storage;
-abstract class Storage extends \PHPUnit_Framework_TestCase {
+abstract class Storage extends \Test\TestCase {
/**
* @var \OC\Files\Storage\Storage instance
*/