]> source.dussan.org Git - nextcloud-server.git/commitdiff
Make apps/ extend the \Test\TestCase and fix overwritten methods
authorJoas Schilling <nickvergessen@gmx.de>
Mon, 10 Nov 2014 21:28:12 +0000 (22:28 +0100)
committerJoas Schilling <nickvergessen@gmx.de>
Wed, 19 Nov 2014 13:52:09 +0000 (14:52 +0100)
40 files changed:
apps/files/tests/ajax_rename.php
apps/files_encryption/tests/migration.php
apps/files_external/tests/amazons3.php
apps/files_external/tests/amazons3migration.php
apps/files_external/tests/dropbox.php
apps/files_external/tests/dynamicmountconfig.php
apps/files_external/tests/etagpropagator.php
apps/files_external/tests/ftp.php
apps/files_external/tests/google.php
apps/files_external/tests/mountconfig.php
apps/files_external/tests/owncloud.php
apps/files_external/tests/owncloudfunctions.php
apps/files_external/tests/sftp.php
apps/files_external/tests/smb.php
apps/files_external/tests/smbfunctions.php
apps/files_external/tests/swift.php
apps/files_external/tests/webdav.php
apps/files_sharing/tests/api.php
apps/files_sharing/tests/backend.php
apps/files_sharing/tests/cache.php
apps/files_sharing/tests/externalstorage.php
apps/files_sharing/tests/permissions.php
apps/files_sharing/tests/proxy.php
apps/files_sharing/tests/share.php
apps/files_sharing/tests/sharedmount.php
apps/files_sharing/tests/sharedstorage.php
apps/files_sharing/tests/testcase.php
apps/files_sharing/tests/updater.php
apps/files_sharing/tests/watcher.php
apps/files_trashbin/tests/trashbin.php
apps/files_versions/tests/versions.php
apps/user_ldap/tests/access.php
apps/user_ldap/tests/connection.php
apps/user_ldap/tests/group_ldap.php
apps/user_ldap/tests/helper.php
apps/user_ldap/tests/user/manager.php
apps/user_ldap/tests/user/user.php
apps/user_ldap/tests/user_ldap.php
apps/user_ldap/tests/wizard.php
tests/lib/files/storage/storage.php

index 3bccaca123174758664ecb5be2d5fa6ee5b33b81..48aed05823b45b17a012540f46fa513a755e4a78 100644 (file)
@@ -21,7 +21,7 @@
  *
  */
 
-class Test_OC_Files_App_Rename extends \PHPUnit_Framework_TestCase {
+class Test_OC_Files_App_Rename extends \Test\TestCase {
        private static $user;
 
        /**
@@ -34,7 +34,6 @@ class Test_OC_Files_App_Rename extends \PHPUnit_Framework_TestCase {
         */
        private $files;
 
-       /** @var \OC\Files\Storage\Storage */
        private $originalStorage;
 
        protected function setUp() {
index 80f30d4e793c2ec857e9b3ea7a86a353b1cfd53f..8ca2e94c90ab8bf956b85db5e33edb54a59d2c64 100644 (file)
 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');
                }
index 8eaece6dad9d99c3746b4f4e3ce92bddd4a937c5..fbb8744bd8d4b3cada72e539eee92199dd0e415d 100644 (file)
@@ -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() {
index 629cf5cfa3c83ea2e8497c4d6fcbc11c279bafad..145213f5293f3c82de90a570433f0d4c3642eda8 100644 (file)
 
 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 () {
index 4b05228201952ec4d1faed84663553ff9c85c53b..3f25d5a31e838280eae0a361ecd6326130e9fa8b 100644 (file)
@@ -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('/');
-               }
-       }
 }
index 650299075e65f9c5db17121c7d2f59376b5eb36c..eef2a896b3a3c569124154b4e7f50d0a6a873700 100644 (file)
@@ -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();
        }
 }
index 7fa1863f9627ee95cab04a64ca45c4795258ecf3..84b687d18e4893ca76d72e2328372364bfcba697 100644 (file)
@@ -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);
        }
 
        /**
index 3037793120a296ea97047a7e2f5ad812b353d61e..842b7f43fa82b13a04afe72d280b51db5545e95d 100644 (file)
@@ -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(){
index d5495d49c5e4795c72eada3f5f48b06616b208b4..79023fac9e1037d9635f2c5a8bb020b3a674098a 100644 (file)
@@ -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();
        }
 }
index c11e48b82f34598a732c21e79a4304fd1546bfea..ab65e648643841b0d6060236ff2f46d04821ebbe 100644 (file)
@@ -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();
        }
 
        /**
index 408a55864f29cb0cfa80a27817a2d0e3ef9146af..ab9101cfe5ff86f2f85639efdeef6f1ba25359a8 100644 (file)
@@ -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();
        }
 }
index 57608fff0cf68ebdaec542d0b10982ba8a71f9c4..8232f30a5e233df7d97d0d818034b0464bb9a9af 100644 (file)
@@ -8,7 +8,7 @@
 
 namespace Test\Files\Storage;
 
-class OwnCloudFunctions extends \PHPUnit_Framework_TestCase {
+class OwnCloudFunctions extends \Test\TestCase {
 
        function configUrlProvider() {
                return array(
index efea7f075ff20d48d19d4b49a5e68448a023d423..703b37d93f10fac3c543acd7645e25c87dc1e5fa 100644 (file)
@@ -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();
        }
 }
index 199e35af6763a11b6fb51c5acad0b278849b3d05..9e5ab2b331fbdf0adb6ec34c34ad7da7e4b26a74 100644 (file)
@@ -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() {
index 749906d01364e37b734b728ce6ce792fc8e86568..cf9f7cb20fe2fba28698885bc62902946112773d 100644 (file)
@@ -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());
        }
index 3918497ebfaf6b1ec247daad7509daa812dbd0d7..d2c884a8b4c13913531790438de52b7b6e7fa24f 100644 (file)
@@ -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();
        }
 }
index 74e905ccc89eb5704d0651534402b9d13fcb2015..5f53568b91a7d8998c338843c25abd6312892bac 100644 (file)
@@ -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();
        }
 }
index 453133fee315c9fa0aac41639830d83210037b44..e550dcc27db096b64c4f9126969cfdbac38220c7 100644 (file)
@@ -32,7 +32,7 @@ class Test_Files_Sharing_Api extends TestCase {
 
        private static $tempStorage;
 
-       function setUp() {
+       protected function setUp() {
                parent::setUp();
 
                \OC::$server->getAppConfig()->setValue('core', 'shareapi_exclude_groups', 'no');
@@ -53,7 +53,7 @@ class Test_Files_Sharing_Api extends TestCase {
                $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);
index e113c9406782ae77b57a15fec63fe4a6ed2e69b1..5cf2a22c7921f78876a57bdccf1b750d34396b21 100644 (file)
@@ -34,7 +34,7 @@ class Test_Files_Sharing_Backend extends TestCase {
        public $subfolder;
        public $subsubfolder;
 
-       function setUp() {
+       protected function setUp() {
                parent::setUp();
 
                $this->folder = self::TEST_FOLDER_NAME;
@@ -53,7 +53,7 @@ class Test_Files_Sharing_Backend extends TestCase {
                $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);
 
index 0e96f5a4e09bf185159e835586b6aa79456ff7b3..b6a44f464f9f36682d20216bb4bac433383b83a5 100644 (file)
@@ -42,7 +42,7 @@ class Test_Files_Sharing_Cache extends TestCase {
        /** @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');
@@ -88,7 +88,7 @@ class Test_Files_Sharing_Cache extends TestCase {
                $this->sharedCache = $this->sharedStorage->getCache();
        }
 
-       function tearDown() {
+       protected function tearDown() {
                $this->sharedCache->clear();
 
                self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
index 0c741bb8199c85c630aab5544a895c01cdcebd00..cf82fcfc555046f0763c3d02b881f91d6f260d63 100644 (file)
@@ -23,7 +23,7 @@
 /**
  * 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(
index 639ebfb593667ab49bfdf31059def2a6e840746f..f72d724c6fe997c296c889ddf1d190b6aeba6356 100644 (file)
@@ -61,7 +61,7 @@ class Test_Files_Sharing_Permissions extends OCA\Files_sharing\Tests\TestCase {
         */
        private $ownerCache;
 
-       function setUp() {
+       protected function setUp() {
                parent::setUp();
 
                self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
@@ -99,7 +99,7 @@ class Test_Files_Sharing_Permissions extends OCA\Files_sharing\Tests\TestCase {
                $this->sharedCacheRestrictedShare = $this->sharedStorageRestrictedShare->getCache();
        }
 
-       function tearDown() {
+       protected function tearDown() {
                $this->sharedCache->clear();
 
                self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
index 68cd81f963a7b179f3b679eabc4dff7928140575..31acf9b27de2b4f7e4af7f198f3cb31107ad9218 100644 (file)
@@ -32,7 +32,7 @@ class Test_Files_Sharing_Proxy extends OCA\Files_sharing\Tests\TestCase {
 
        private static $tempStorage;
 
-       function setUp() {
+       protected function setUp() {
                parent::setUp();
 
                // load proxies
@@ -53,7 +53,7 @@ class Test_Files_Sharing_Proxy extends OCA\Files_sharing\Tests\TestCase {
                $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;
index 2b5978f8e5752f846c4c758c166f7045303ddd0a..4318d3c510e73b3d2f7f96824756c82c9fbc209a 100644 (file)
@@ -31,7 +31,7 @@ class Test_Files_Sharing extends OCA\Files_sharing\Tests\TestCase {
 
        private static $tempStorage;
 
-       function setUp() {
+       protected function setUp() {
                parent::setUp();
 
                $this->folder = self::TEST_FOLDER_NAME;
@@ -49,7 +49,7 @@ class Test_Files_Sharing extends OCA\Files_sharing\Tests\TestCase {
                $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);
 
index 6d155f174ba7bc9b394b5cd4d6851634fa6342df..dd66ca05d3855d7dd2cf774d96478fcb94ee7bfe 100644 (file)
@@ -25,7 +25,7 @@
  */
 class Test_Files_Sharing_Mount extends OCA\Files_sharing\Tests\TestCase {
 
-       function setUp() {
+       protected function setUp() {
                parent::setUp();
 
                $this->folder = '/folder_share_storage_test';
@@ -40,7 +40,7 @@ class Test_Files_Sharing_Mount extends OCA\Files_sharing\Tests\TestCase {
                $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);
 
index ab15e8fe3ba31ec00da304955a72ab37955af5a1..75373244508df2fd7bc7c470f27b3e313980cb9b 100644 (file)
@@ -27,7 +27,7 @@ use OCA\Files\Share;
  */
 class Test_Files_Sharing_Storage extends OCA\Files_sharing\Tests\TestCase {
 
-       function setUp() {
+       protected function setUp() {
                parent::setUp();
 
                $this->folder = '/folder_share_storage_test';
@@ -42,7 +42,7 @@ class Test_Files_Sharing_Storage extends OCA\Files_sharing\Tests\TestCase {
                $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);
 
index 034baa785da218e20ac3de9539ed4785f7959365..65fbfac7d1d6e4ca1af96170d8c0a1caf1771968 100644 (file)
@@ -30,7 +30,7 @@ use OCA\Files\Share;
  *
  * 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";
@@ -49,6 +49,7 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase {
        public $subfolder;
 
        public static function setUpBeforeClass() {
+               parent::setUpBeforeClass();
 
                // remember files_encryption state
                self::$stateFilesEncryption = \OC_App::isEnabled('files_encryption');
@@ -84,7 +85,8 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase {
 
        }
 
-       function setUp() {
+       protected function setUp() {
+               parent::setUp();
 
                $this->assertFalse(\OC_App::isEnabled('files_encryption'));
 
@@ -95,13 +97,14 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase {
                $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);
@@ -120,6 +123,8 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase {
                \OC_Util::tearDownFS();
                \OC_User::setUserId('');
                Filesystem::tearDown();
+
+               parent::tearDownAfterClass();
        }
 
        /**
index 861516dff7f15cf9120bf51c6e46020a3896c17e..bc8deaf19b0f62737431f3b84e50ed7602cdabf8 100644 (file)
@@ -33,7 +33,7 @@ class Test_Files_Sharing_Updater extends OCA\Files_sharing\Tests\TestCase {
                \OCA\Files_Sharing\Helper::registerHooks();
        }
 
-       function setUp() {
+       protected function setUp() {
                parent::setUp();
 
                $this->folder = self::TEST_FOLDER_NAME;
@@ -46,7 +46,7 @@ class Test_Files_Sharing_Updater extends OCA\Files_sharing\Tests\TestCase {
                $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);
 
index 67f55394ae842af432b4dd349aa08f2769c65bb7..254b30c647053d94086d20119d96570f2274783c 100644 (file)
@@ -42,7 +42,7 @@ class Test_Files_Sharing_Watcher extends OCA\Files_sharing\Tests\TestCase {
         */
        private $sharedCache;
 
-       function setUp() {
+       protected function setUp() {
                parent::setUp();
 
                self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
@@ -71,7 +71,7 @@ class Test_Files_Sharing_Watcher extends OCA\Files_sharing\Tests\TestCase {
                $this->sharedCache = $this->sharedStorage->getCache();
        }
 
-       function tearDown() {
+       protected function tearDown() {
                $this->sharedCache->clear();
 
                self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
index 6fdb53f72710205dc7fd2336be6aa2d5da6dc4ae..f572e22623e0bbd25e40d625668729cc001ae979 100644 (file)
@@ -25,7 +25,7 @@ use OCA\Files_Trashbin;
 /**
  * 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";
@@ -43,6 +43,8 @@ class Test_Trashbin extends \PHPUnit_Framework_TestCase {
        private $rootView;
 
        public static function setUpBeforeClass() {
+               parent::setUpBeforeClass();
+
                // reset backend
                \OC_User::clearBackends();
                \OC_User::useBackend('database');
@@ -85,18 +87,24 @@ class Test_Trashbin extends \PHPUnit_Framework_TestCase {
                \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();
        }
 
        /**
index adcbb686c614a0aa6ddab282b7cb06db3a74a1c1..436863b28dc67853257275dbf049d1996de4bc6d 100644 (file)
@@ -27,7 +27,7 @@ require_once __DIR__ . '/../lib/versions.php';
  * 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';
index 8ff39800808171978f950f93dd6398c82c930310..85849229152054b738659463947b6d52a9632452 100644 (file)
@@ -26,7 +26,7 @@ use \OCA\user_ldap\lib\Access;
 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;
index f51b0c830173361ff70da5e6a7f81a1bfc72e811..e3f29cec982c06661fa6c79b51cd6a460d01469b 100644 (file)
@@ -22,7 +22,7 @@
 
 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
index d1262e4f5b807e5a8765cae3ca0f1af2651cf573..0e01eb3ba6fe027877a8a14fa87fee8bba2e66d8 100644 (file)
 
 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;
index 07c24d644992acb91d30c76273c8fbcf54a6a838..a70a57051c8248349b0c543f6dd65311a1c053fb 100644 (file)
@@ -11,7 +11,7 @@ namespace OCA\user_ldap\tests;
 
 use OCA\user_ldap\lib\Helper;
 
-class Test_Helper extends \PHPUnit_Framework_TestCase {
+class Test_Helper extends \Test\TestCase {
 
        public function testTableTruncate() {
 
index 7d687867213629eefaf480a43c9d805b2ef481fc..b3e52084dba6377e361b7f29ed597eaae8f41334 100644 (file)
@@ -24,7 +24,7 @@ namespace OCA\user_ldap\tests;
 
 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');
index b66a92372667ff2eab0e8427a563304b78f63447..e110921d2d3cd61e52d4f20efb21b4a7d8094125 100644 (file)
@@ -24,7 +24,7 @@ namespace OCA\user_ldap\tests;
 
 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');
index c89edc33fa94c04e4eaef51d396796139a1cefa3..e91404d47f243a98f7fc6f8a6027ea0128aacd29 100644 (file)
@@ -27,11 +27,13 @@ use \OCA\user_ldap\lib\Access;
 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();
        }
index 1f420f9ee8a7c59f815b17e8a311f7307fd24260..7284e4665363df35b6bcc0d921cfe7311aa6ca92 100644 (file)
@@ -29,8 +29,9 @@ use \OCA\user_ldap\lib\Wizard;
 // 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',
index 960eb137ea011ee836cc8d21f7f425ccf41f75c1..30f403d60df0a42f0b07e5859fb0b2f0dd6c43c3 100644 (file)
@@ -22,7 +22,7 @@
 
 namespace Test\Files\Storage;
 
-abstract class Storage extends \PHPUnit_Framework_TestCase {
+abstract class Storage extends \Test\TestCase {
        /**
         * @var \OC\Files\Storage\Storage instance
         */