diff --git a/apps/files/tests/ajax_rename.php b/apps/files/tests/ajax_rename.php
index 3bccaca123174758664ecb5be2d5fa6ee5b33b81..48aed05823b45b17a012540f46fa513a755e4a78 100644
--- a/apps/files/tests/ajax_rename.php
+++ b/apps/files/tests/ajax_rename.php
@@ -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() {
diff --git a/apps/files/tests/helper.php b/apps/files/tests/helper.php
index 17be1770c338aa77319940ba61b59a6980d623cc..da902f4f78a6d506e70678c3dbfe80f09208774b 100644
--- a/apps/files/tests/helper.php
+++ b/apps/files/tests/helper.php
@@ -11,7 +11,7 @@ use OCA\Files;
 /**
  * Class Test_Files_Helper
  */
-class Test_Files_Helper extends \PHPUnit_Framework_TestCase {
+class Test_Files_Helper extends \Test\TestCase {
 
 	private function makeFileInfo($name, $size, $mtime, $isDir = false) {
 		return new \OC\Files\FileInfo(
@@ -90,7 +90,7 @@ class Test_Files_Helper extends \PHPUnit_Framework_TestCase {
 		$this->assertEquals(
 			$expectedOrder,
 			$fileNames
-		);	
+		);
 	}
 
 }
diff --git a/apps/files_encryption/tests/migration.php b/apps/files_encryption/tests/migration.php
index 80f30d4e793c2ec857e9b3ea7a86a353b1cfd53f..8ca2e94c90ab8bf956b85db5e33edb54a59d2c64 100644
--- a/apps/files_encryption/tests/migration.php
+++ b/apps/files_encryption/tests/migration.php
@@ -23,16 +23,20 @@
 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');
 		}
diff --git a/apps/files_external/tests/amazons3.php b/apps/files_external/tests/amazons3.php
index 8eaece6dad9d99c3746b4f4e3ce92bddd4a937c5..fbb8744bd8d4b3cada72e539eee92199dd0e415d 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 629cf5cfa3c83ea2e8497c4d6fcbc11c279bafad..145213f5293f3c82de90a570433f0d4c3642eda8 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 4b05228201952ec4d1faed84663553ff9c85c53b..3f25d5a31e838280eae0a361ecd6326130e9fa8b 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 650299075e65f9c5db17121c7d2f59376b5eb36c..eef2a896b3a3c569124154b4e7f50d0a6a873700 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 7fa1863f9627ee95cab04a64ca45c4795258ecf3..84b687d18e4893ca76d72e2328372364bfcba697 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 3037793120a296ea97047a7e2f5ad812b353d61e..842b7f43fa82b13a04afe72d280b51db5545e95d 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 d5495d49c5e4795c72eada3f5f48b06616b208b4..79023fac9e1037d9635f2c5a8bb020b3a674098a 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 c11e48b82f34598a732c21e79a4304fd1546bfea..ab65e648643841b0d6060236ff2f46d04821ebbe 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 408a55864f29cb0cfa80a27817a2d0e3ef9146af..ab9101cfe5ff86f2f85639efdeef6f1ba25359a8 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 57608fff0cf68ebdaec542d0b10982ba8a71f9c4..8232f30a5e233df7d97d0d818034b0464bb9a9af 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 efea7f075ff20d48d19d4b49a5e68448a023d423..703b37d93f10fac3c543acd7645e25c87dc1e5fa 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 199e35af6763a11b6fb51c5acad0b278849b3d05..9e5ab2b331fbdf0adb6ec34c34ad7da7e4b26a74 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 749906d01364e37b734b728ce6ce792fc8e86568..cf9f7cb20fe2fba28698885bc62902946112773d 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 3918497ebfaf6b1ec247daad7509daa812dbd0d7..d2c884a8b4c13913531790438de52b7b6e7fa24f 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 74e905ccc89eb5704d0651534402b9d13fcb2015..5f53568b91a7d8998c338843c25abd6312892bac 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();
 	}
 }
diff --git a/apps/files_sharing/tests/api.php b/apps/files_sharing/tests/api.php
index 453133fee315c9fa0aac41639830d83210037b44..e550dcc27db096b64c4f9126969cfdbac38220c7 100644
--- a/apps/files_sharing/tests/api.php
+++ b/apps/files_sharing/tests/api.php
@@ -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);
diff --git a/apps/files_sharing/tests/backend.php b/apps/files_sharing/tests/backend.php
index e113c9406782ae77b57a15fec63fe4a6ed2e69b1..5cf2a22c7921f78876a57bdccf1b750d34396b21 100644
--- a/apps/files_sharing/tests/backend.php
+++ b/apps/files_sharing/tests/backend.php
@@ -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);
 
diff --git a/apps/files_sharing/tests/cache.php b/apps/files_sharing/tests/cache.php
index 0e96f5a4e09bf185159e835586b6aa79456ff7b3..b6a44f464f9f36682d20216bb4bac433383b83a5 100644
--- a/apps/files_sharing/tests/cache.php
+++ b/apps/files_sharing/tests/cache.php
@@ -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);
diff --git a/apps/files_sharing/tests/externalstorage.php b/apps/files_sharing/tests/externalstorage.php
index 0c741bb8199c85c630aab5544a895c01cdcebd00..cf82fcfc555046f0763c3d02b881f91d6f260d63 100644
--- a/apps/files_sharing/tests/externalstorage.php
+++ b/apps/files_sharing/tests/externalstorage.php
@@ -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(
diff --git a/apps/files_sharing/tests/permissions.php b/apps/files_sharing/tests/permissions.php
index 639ebfb593667ab49bfdf31059def2a6e840746f..f72d724c6fe997c296c889ddf1d190b6aeba6356 100644
--- a/apps/files_sharing/tests/permissions.php
+++ b/apps/files_sharing/tests/permissions.php
@@ -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);
diff --git a/apps/files_sharing/tests/proxy.php b/apps/files_sharing/tests/proxy.php
index 68cd81f963a7b179f3b679eabc4dff7928140575..31acf9b27de2b4f7e4af7f198f3cb31107ad9218 100644
--- a/apps/files_sharing/tests/proxy.php
+++ b/apps/files_sharing/tests/proxy.php
@@ -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;
diff --git a/apps/files_sharing/tests/share.php b/apps/files_sharing/tests/share.php
index 2b5978f8e5752f846c4c758c166f7045303ddd0a..4318d3c510e73b3d2f7f96824756c82c9fbc209a 100644
--- a/apps/files_sharing/tests/share.php
+++ b/apps/files_sharing/tests/share.php
@@ -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);
 
diff --git a/apps/files_sharing/tests/sharedmount.php b/apps/files_sharing/tests/sharedmount.php
index 6d155f174ba7bc9b394b5cd4d6851634fa6342df..dd66ca05d3855d7dd2cf774d96478fcb94ee7bfe 100644
--- a/apps/files_sharing/tests/sharedmount.php
+++ b/apps/files_sharing/tests/sharedmount.php
@@ -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);
 
diff --git a/apps/files_sharing/tests/sharedstorage.php b/apps/files_sharing/tests/sharedstorage.php
index ab15e8fe3ba31ec00da304955a72ab37955af5a1..75373244508df2fd7bc7c470f27b3e313980cb9b 100644
--- a/apps/files_sharing/tests/sharedstorage.php
+++ b/apps/files_sharing/tests/sharedstorage.php
@@ -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);
 
diff --git a/apps/files_sharing/tests/testcase.php b/apps/files_sharing/tests/testcase.php
index 034baa785da218e20ac3de9539ed4785f7959365..65fbfac7d1d6e4ca1af96170d8c0a1caf1771968 100644
--- a/apps/files_sharing/tests/testcase.php
+++ b/apps/files_sharing/tests/testcase.php
@@ -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();
 	}
 
 	/**
diff --git a/apps/files_sharing/tests/updater.php b/apps/files_sharing/tests/updater.php
index 861516dff7f15cf9120bf51c6e46020a3896c17e..bc8deaf19b0f62737431f3b84e50ed7602cdabf8 100644
--- a/apps/files_sharing/tests/updater.php
+++ b/apps/files_sharing/tests/updater.php
@@ -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);
 
diff --git a/apps/files_sharing/tests/watcher.php b/apps/files_sharing/tests/watcher.php
index 67f55394ae842af432b4dd349aa08f2769c65bb7..254b30c647053d94086d20119d96570f2274783c 100644
--- a/apps/files_sharing/tests/watcher.php
+++ b/apps/files_sharing/tests/watcher.php
@@ -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);
diff --git a/apps/files_trashbin/tests/trashbin.php b/apps/files_trashbin/tests/trashbin.php
index 6fdb53f72710205dc7fd2336be6aa2d5da6dc4ae..f572e22623e0bbd25e40d625668729cc001ae979 100644
--- a/apps/files_trashbin/tests/trashbin.php
+++ b/apps/files_trashbin/tests/trashbin.php
@@ -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();
 	}
 
 	/**
diff --git a/apps/files_versions/tests/versions.php b/apps/files_versions/tests/versions.php
index a3b8595a34b058b70164f38d839785fcef5686e0..436863b28dc67853257275dbf049d1996de4bc6d 100644
--- a/apps/files_versions/tests/versions.php
+++ b/apps/files_versions/tests/versions.php
@@ -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';
@@ -39,6 +39,7 @@ class Test_Files_Versioning extends \PHPUnit_Framework_TestCase {
 	private $rootView;
 
 	public static function setUpBeforeClass() {
+		parent::setUpBeforeClass();
 
 		// clear share hooks
 		\OC_Hook::clear('OCP\\Share');
@@ -55,9 +56,13 @@ class Test_Files_Versioning extends \PHPUnit_Framework_TestCase {
 		// cleanup test user
 		\OC_User::deleteUser(self::TEST_VERSIONS_USER);
 		\OC_User::deleteUser(self::TEST_VERSIONS_USER2);
+
+		parent::tearDownAfterClass();
 	}
 
-	function setUp() {
+	protected function setUp() {
+		parent::setUp();
+
 		self::loginHelper(self::TEST_VERSIONS_USER);
 		$this->rootView = new \OC\Files\View();
 		if (!$this->rootView->file_exists(self::USERS_VERSIONS_ROOT)) {
@@ -65,8 +70,10 @@ class Test_Files_Versioning extends \PHPUnit_Framework_TestCase {
 		}
 	}
 
-	function tearDown() {
+	protected function tearDown() {
 		$this->rootView->deleteAll(self::USERS_VERSIONS_ROOT);
+
+		parent::tearDown();
 	}
 
 	/**
@@ -74,7 +81,7 @@ class Test_Files_Versioning extends \PHPUnit_Framework_TestCase {
 	 * test expire logic
 	 * @dataProvider versionsProvider
 	 */
-	function testGetExpireList($versions, $sizeOfAllDeletedFiles) {
+	public function testGetExpireList($versions, $sizeOfAllDeletedFiles) {
 
 		// last interval end at 2592000
 		$startTime = 5000000;
@@ -216,7 +223,7 @@ class Test_Files_Versioning extends \PHPUnit_Framework_TestCase {
 		);
 	}
 
-	function testRename() {
+	public function testRename() {
 
 		\OC\Files\Filesystem::file_put_contents("test.txt", "test file");
 
@@ -247,7 +254,7 @@ class Test_Files_Versioning extends \PHPUnit_Framework_TestCase {
 		\OC\Files\Filesystem::unlink('test2.txt');
 	}
 
-	function testRenameInSharedFolder() {
+	public function testRenameInSharedFolder() {
 
 		\OC\Files\Filesystem::mkdir('folder1');
 		\OC\Files\Filesystem::mkdir('folder1/folder2');
@@ -291,7 +298,7 @@ class Test_Files_Versioning extends \PHPUnit_Framework_TestCase {
 		\OC\Files\Filesystem::unlink('/folder1/folder2/test.txt');
 	}
 
-	function testRenameSharedFile() {
+	public function testRenameSharedFile() {
 
 		\OC\Files\Filesystem::file_put_contents("test.txt", "test file");
 
@@ -334,7 +341,7 @@ class Test_Files_Versioning extends \PHPUnit_Framework_TestCase {
 		\OC\Files\Filesystem::unlink('/test.txt');
 	}
 
-	function testCopy() {
+	public function testCopy() {
 
 		\OC\Files\Filesystem::file_put_contents("test.txt", "test file");
 
diff --git a/apps/user_ldap/tests/access.php b/apps/user_ldap/tests/access.php
index 8ff39800808171978f950f93dd6398c82c930310..85849229152054b738659463947b6d52a9632452 100644
--- a/apps/user_ldap/tests/access.php
+++ b/apps/user_ldap/tests/access.php
@@ -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;
diff --git a/apps/user_ldap/tests/connection.php b/apps/user_ldap/tests/connection.php
index f51b0c830173361ff70da5e6a7f81a1bfc72e811..e3f29cec982c06661fa6c79b51cd6a460d01469b 100644
--- a/apps/user_ldap/tests/connection.php
+++ b/apps/user_ldap/tests/connection.php
@@ -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
diff --git a/apps/user_ldap/tests/group_ldap.php b/apps/user_ldap/tests/group_ldap.php
index d1262e4f5b807e5a8765cae3ca0f1af2651cf573..0e01eb3ba6fe027877a8a14fa87fee8bba2e66d8 100644
--- a/apps/user_ldap/tests/group_ldap.php
+++ b/apps/user_ldap/tests/group_ldap.php
@@ -22,14 +22,12 @@
 
 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;
diff --git a/apps/user_ldap/tests/helper.php b/apps/user_ldap/tests/helper.php
index 07c24d644992acb91d30c76273c8fbcf54a6a838..a70a57051c8248349b0c543f6dd65311a1c053fb 100644
--- a/apps/user_ldap/tests/helper.php
+++ b/apps/user_ldap/tests/helper.php
@@ -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() {
 
diff --git a/apps/user_ldap/tests/user/manager.php b/apps/user_ldap/tests/user/manager.php
index 7d687867213629eefaf480a43c9d805b2ef481fc..b3e52084dba6377e361b7f29ed597eaae8f41334 100644
--- a/apps/user_ldap/tests/user/manager.php
+++ b/apps/user_ldap/tests/user/manager.php
@@ -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');
diff --git a/apps/user_ldap/tests/user/user.php b/apps/user_ldap/tests/user/user.php
index b66a92372667ff2eab0e8427a563304b78f63447..e110921d2d3cd61e52d4f20efb21b4a7d8094125 100644
--- a/apps/user_ldap/tests/user/user.php
+++ b/apps/user_ldap/tests/user/user.php
@@ -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');
diff --git a/apps/user_ldap/tests/user_ldap.php b/apps/user_ldap/tests/user_ldap.php
index c89edc33fa94c04e4eaef51d396796139a1cefa3..e91404d47f243a98f7fc6f8a6027ea0128aacd29 100644
--- a/apps/user_ldap/tests/user_ldap.php
+++ b/apps/user_ldap/tests/user_ldap.php
@@ -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();
 	}
diff --git a/apps/user_ldap/tests/wizard.php b/apps/user_ldap/tests/wizard.php
index 1f420f9ee8a7c59f815b17e8a311f7307fd24260..7284e4665363df35b6bcc0d921cfe7311aa6ca92 100644
--- a/apps/user_ldap/tests/wizard.php
+++ b/apps/user_ldap/tests/wizard.php
@@ -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',
diff --git a/lib/private/files/storage/mappedlocal.php b/lib/private/files/storage/mappedlocal.php
index 0a21d2938b7343b72f6aa969375053e1efb0387f..c232c0298b1a2cedf47a012fa1a0762e1fa013ab 100644
--- a/lib/private/files/storage/mappedlocal.php
+++ b/lib/private/files/storage/mappedlocal.php
@@ -24,9 +24,6 @@ class MappedLocal extends \OC\Files\Storage\Common {
 	}
 
 	public function __destruct() {
-		if (defined('PHPUNIT_RUN')) {
-			$this->mapper->removePath($this->datadir, true, true);
-		}
 	}
 
 	public function getId() {
diff --git a/tests/lib/activitymanager.php b/tests/lib/activitymanager.php
index f21b82c52c368ed1a6a7d62f7373cdce609fd829..85f8320de09bb23aeab1fb89387afea1cd1b366b 100644
--- a/tests/lib/activitymanager.php
+++ b/tests/lib/activitymanager.php
@@ -8,12 +8,14 @@
  *
 */
 
-class Test_ActivityManager extends PHPUnit_Framework_TestCase {
+class Test_ActivityManager extends \Test\TestCase {
 
 	/** @var \OC\ActivityManager */
 	private $activityManager;
 
-	public function setUp() {
+	protected function setUp() {
+		parent::setUp();
+
 		$this->activityManager = new \OC\ActivityManager();
 		$this->activityManager->registerExtension(function() {
 			return new NoOpExtension();
diff --git a/tests/lib/api.php b/tests/lib/api.php
index 0f7d08543ea51a8121d7bbc47e1fa1ce6850e1e5..bf9748a60400b0016f98fe63d9b71944dd6df5b2 100644
--- a/tests/lib/api.php
+++ b/tests/lib/api.php
@@ -6,7 +6,7 @@
  * See the COPYING-README file.
  */
 
-class Test_API extends PHPUnit_Framework_TestCase {
+class Test_API extends \Test\TestCase {
 
 	// Helps build a response variable
 
diff --git a/tests/lib/app.php b/tests/lib/app.php
index 6ae548759ed27e70030d3cf890b25a9e87ab43bb..23c1a340e03c8995eefeb7d6067342070a9c1211 100644
--- a/tests/lib/app.php
+++ b/tests/lib/app.php
@@ -7,7 +7,7 @@
  * See the COPYING-README file.
  */
 
-class Test_App extends PHPUnit_Framework_TestCase {
+class Test_App extends \Test\TestCase {
 
 	private $oldAppConfigService;
 
diff --git a/tests/lib/appconfig.php b/tests/lib/appconfig.php
index 9257ae45b0ebe307e891392b436dbbb288a4d163..188721ff92d559b004ce788a4e8844d8ec2f7223 100644
--- a/tests/lib/appconfig.php
+++ b/tests/lib/appconfig.php
@@ -7,8 +7,10 @@
  * See the COPYING-README file.
  */
 
-class Test_Appconfig extends PHPUnit_Framework_TestCase {
+class Test_Appconfig extends \Test\TestCase {
 	public static function setUpBeforeClass() {
+		parent::setUpBeforeClass();
+
 		$query = \OC_DB::prepare('INSERT INTO `*PREFIX*appconfig` VALUES (?, ?, ?)');
 
 		$query->execute(array('testapp', 'enabled', 'true'));
@@ -33,6 +35,8 @@ class Test_Appconfig extends PHPUnit_Framework_TestCase {
 		$query->execute(array('someapp'));
 		$query->execute(array('123456'));
 		$query->execute(array('anotherapp'));
+
+		parent::tearDownAfterClass();
 	}
 
 	public function testGetApps() {
diff --git a/tests/lib/appframework/AppTest.php b/tests/lib/appframework/AppTest.php
index 92fa483834114d6d873c18cdfab8470ad2535c6f..bd565e9765eedc8164798293e476980f7da90c53 100644
--- a/tests/lib/appframework/AppTest.php
+++ b/tests/lib/appframework/AppTest.php
@@ -25,7 +25,7 @@
 namespace OC\AppFramework;
 
 
-class AppTest extends \PHPUnit_Framework_TestCase {
+class AppTest extends \Test\TestCase {
 
 	private $container;
 	private $api;
@@ -38,6 +38,8 @@ class AppTest extends \PHPUnit_Framework_TestCase {
 	private $controllerMethod;
 
 	protected function setUp() {
+		parent::setUp();
+
 		$this->container = new \OC\AppFramework\DependencyInjection\DIContainer('test', array());
 		$this->controller = $this->getMockBuilder(
 			'OCP\AppFramework\Controller')
diff --git a/tests/lib/appframework/controller/ApiControllerTest.php b/tests/lib/appframework/controller/ApiControllerTest.php
index b772f540ce85c6f74a6b5c52a96ae2c83f28441a..3055fbe0da80955f50ede3c19c4e78a2e8c5ce90 100644
--- a/tests/lib/appframework/controller/ApiControllerTest.php
+++ b/tests/lib/appframework/controller/ApiControllerTest.php
@@ -31,7 +31,7 @@ use OCP\AppFramework\Http\TemplateResponse;
 class ChildApiController extends ApiController {};
 
 
-class ApiControllerTest extends \PHPUnit_Framework_TestCase {
+class ApiControllerTest extends \Test\TestCase {
 
 
     public function testCors() {
diff --git a/tests/lib/appframework/controller/ControllerTest.php b/tests/lib/appframework/controller/ControllerTest.php
index 0de94ff5b70e8b7cc49bf53ab0e0e254f4dd8e74..d186651dc2301bcac914fb951f117fca1aa52a19 100644
--- a/tests/lib/appframework/controller/ControllerTest.php
+++ b/tests/lib/appframework/controller/ControllerTest.php
@@ -54,7 +54,7 @@ class ChildController extends Controller {
 	}
 };
 
-class ControllerTest extends \PHPUnit_Framework_TestCase {
+class ControllerTest extends \Test\TestCase {
 
 	/**
 	 * @var Controller
@@ -63,6 +63,8 @@ class ControllerTest extends \PHPUnit_Framework_TestCase {
 	private $app;
 
 	protected function setUp(){
+		parent::setUp();
+
 		$request = new Request(
 			array(
 				'get' => array('name' => 'John Q. Public', 'nickname' => 'Joey'),
diff --git a/tests/lib/appframework/db/EntityTest.php b/tests/lib/appframework/db/EntityTest.php
index d98cb549422dcf1b1b617c619609a036e1ef3907..161e11d8030dd887cb51c05c4deacf883fa0b9bf 100644
--- a/tests/lib/appframework/db/EntityTest.php
+++ b/tests/lib/appframework/db/EntityTest.php
@@ -49,11 +49,12 @@ class TestEntity extends Entity {
 };
 
 
-class EntityTest extends \PHPUnit_Framework_TestCase {
+class EntityTest extends \Test\TestCase {
 
 	private $entity;
 
 	protected function setUp(){
+		parent::setUp();
 		$this->entity = new TestEntity();
 	}
 
diff --git a/tests/lib/appframework/db/mappertest.php b/tests/lib/appframework/db/mappertest.php
index fd1acd0367ebc9426fb8fcd7d27678b3811c187a..6ad8cd86bffc344afb7f381d182880947bdf7da2 100644
--- a/tests/lib/appframework/db/mappertest.php
+++ b/tests/lib/appframework/db/mappertest.php
@@ -57,7 +57,7 @@ class MapperTest extends MapperTestUtility {
 	 */
 	private $mapper;
 
-	public function setUp(){
+	protected function setUp(){
 		parent::setUp();
 		$this->mapper = new ExampleMapper($this->db);
 	}
diff --git a/tests/lib/appframework/db/mappertestutility.php b/tests/lib/appframework/db/mappertestutility.php
index 0430eef2c21cb0322e3858861f1fbee5c20100f2..ad7a67a96b139a519809b6341c681d6c3fe0cc81 100644
--- a/tests/lib/appframework/db/mappertestutility.php
+++ b/tests/lib/appframework/db/mappertestutility.php
@@ -28,9 +28,7 @@ namespace Test\AppFramework\Db;
 /**
  * Simple utility class for testing mappers
  */
-abstract class MapperTestUtility extends \PHPUnit_Framework_TestCase {
-
-
+abstract class MapperTestUtility extends \Test\TestCase {
 	protected $db;
 	private $query;
 	private $pdoResult;
@@ -45,6 +43,8 @@ abstract class MapperTestUtility extends \PHPUnit_Framework_TestCase {
 	 * db. After this the db can be accessed by using $this->db
 	 */
 	protected function setUp(){
+		parent::setUp();
+
 		$this->db = $this->getMockBuilder(
 			'\OCP\IDb')
 			->disableOriginalConstructor()
diff --git a/tests/lib/appframework/dependencyinjection/DIContainerTest.php b/tests/lib/appframework/dependencyinjection/DIContainerTest.php
index acc5c2e66d82900d6b61d62b3668f13d50534d92..08e72aff9848e8c9da60c19ff6db13e62e60e0b1 100644
--- a/tests/lib/appframework/dependencyinjection/DIContainerTest.php
+++ b/tests/lib/appframework/dependencyinjection/DIContainerTest.php
@@ -29,12 +29,13 @@ namespace OC\AppFramework\DependencyInjection;
 use \OC\AppFramework\Http\Request;
 
 
-class DIContainerTest extends \PHPUnit_Framework_TestCase {
+class DIContainerTest extends \Test\TestCase {
 
 	private $container;
 	private $api;
 
 	protected function setUp(){
+		parent::setUp();
 		$this->container = new DIContainer('name');
 		$this->api = $this->getMock('OC\AppFramework\Core\API', array(), array('hi'));
 	}
diff --git a/tests/lib/appframework/http/DataResponseTest.php b/tests/lib/appframework/http/DataResponseTest.php
index 961327c978c2b06ed92e7b1177257c47aa155018..e91d3cefea9f721a5ccada4c13d1ebb187e1c7ae 100644
--- a/tests/lib/appframework/http/DataResponseTest.php
+++ b/tests/lib/appframework/http/DataResponseTest.php
@@ -29,7 +29,7 @@ use OCP\AppFramework\Http\DataResponse;
 use OCP\AppFramework\Http;
 
 
-class DataResponseTest extends \PHPUnit_Framework_TestCase {
+class DataResponseTest extends \Test\TestCase {
 
 	/**
 	 * @var DataResponse
@@ -37,6 +37,7 @@ class DataResponseTest extends \PHPUnit_Framework_TestCase {
 	private $response;
 
 	protected function setUp() {
+		parent::setUp();
 		$this->response = new DataResponse();
 	}
 
diff --git a/tests/lib/appframework/http/DispatcherTest.php b/tests/lib/appframework/http/DispatcherTest.php
index f082ddc8b3a068efd06b09c9c91fc98717e518fe..f92e7161e6bc9670b9d13363d29dafeed28e83c7 100644
--- a/tests/lib/appframework/http/DispatcherTest.php
+++ b/tests/lib/appframework/http/DispatcherTest.php
@@ -62,9 +62,7 @@ class TestController extends Controller {
 }
 
 
-class DispatcherTest extends \PHPUnit_Framework_TestCase {
-
-
+class DispatcherTest extends \Test\TestCase {
 	private $middlewareDispatcher;
 	private $dispatcher;
 	private $controllerMethod;
@@ -75,6 +73,7 @@ class DispatcherTest extends \PHPUnit_Framework_TestCase {
 	private $reflector;
 
 	protected function setUp() {
+		parent::setUp();
 		$this->controllerMethod = 'test';
 
 		$app = $this->getMockBuilder(
diff --git a/tests/lib/appframework/http/DownloadResponseTest.php b/tests/lib/appframework/http/DownloadResponseTest.php
index ab381e5c29807299149a9b903afa868b22fcda5d..5e5db2c55ec8b36fae450708e7a36fcd37fe1990 100644
--- a/tests/lib/appframework/http/DownloadResponseTest.php
+++ b/tests/lib/appframework/http/DownloadResponseTest.php
@@ -30,7 +30,7 @@ class ChildDownloadResponse extends DownloadResponse {
 };
 
 
-class DownloadResponseTest extends \PHPUnit_Framework_TestCase {
+class DownloadResponseTest extends \Test\TestCase {
 
 	/**
 	 * @var ChildDownloadResponse
@@ -38,6 +38,7 @@ class DownloadResponseTest extends \PHPUnit_Framework_TestCase {
 	protected $response;
 
 	protected function setUp(){
+		parent::setUp();
 		$this->response = new ChildDownloadResponse('file', 'content');
 	}
 
diff --git a/tests/lib/appframework/http/HttpTest.php b/tests/lib/appframework/http/HttpTest.php
index a7a189c98e5e15dc72a52bc510d389c4bfcf21c9..e9be3e73904226f6af0edab1d23c014f7290034f 100644
--- a/tests/lib/appframework/http/HttpTest.php
+++ b/tests/lib/appframework/http/HttpTest.php
@@ -27,7 +27,7 @@ namespace OC\AppFramework\Http;
 use OC\AppFramework\Http;
 
 
-class HttpTest extends \PHPUnit_Framework_TestCase {
+class HttpTest extends \Test\TestCase {
 
 	private $server;
 
@@ -37,6 +37,8 @@ class HttpTest extends \PHPUnit_Framework_TestCase {
 	private $http;
 
 	protected function setUp(){
+		parent::setUp();
+
 		$this->server = array();
 		$this->http = new Http($this->server);
 	}
diff --git a/tests/lib/appframework/http/JSONResponseTest.php b/tests/lib/appframework/http/JSONResponseTest.php
index 06cd3410a6910be6cef5c2c5b3142ccadc010d4e..cdd8d269b41a159d5b26c906d34dd207a28e8a0e 100644
--- a/tests/lib/appframework/http/JSONResponseTest.php
+++ b/tests/lib/appframework/http/JSONResponseTest.php
@@ -30,7 +30,7 @@ namespace OC\AppFramework\Http;
 use OCP\AppFramework\Http\JSONResponse;
 use OCP\AppFramework\Http;
 
-class JSONResponseTest extends \PHPUnit_Framework_TestCase {
+class JSONResponseTest extends \Test\TestCase {
 
 	/**
 	 * @var JSONResponse
@@ -38,6 +38,7 @@ class JSONResponseTest extends \PHPUnit_Framework_TestCase {
 	private $json;
 
 	protected function setUp() {
+		parent::setUp();
 		$this->json = new JSONResponse();
 	}
 
diff --git a/tests/lib/appframework/http/RedirectResponseTest.php b/tests/lib/appframework/http/RedirectResponseTest.php
index e5d452f7f916e5d7daa513570f5bcc51668de921..17db0c0be6cca61c3510d4c9e199b0c7d325b833 100644
--- a/tests/lib/appframework/http/RedirectResponseTest.php
+++ b/tests/lib/appframework/http/RedirectResponseTest.php
@@ -27,7 +27,7 @@ namespace OCP\AppFramework\Http;
 use OCP\AppFramework\Http;
 
 
-class RedirectResponseTest extends \PHPUnit_Framework_TestCase {
+class RedirectResponseTest extends \Test\TestCase {
 
 	/**
 	 * @var RedirectResponse
@@ -35,6 +35,7 @@ class RedirectResponseTest extends \PHPUnit_Framework_TestCase {
 	protected $response;
 
 	protected function setUp(){
+		parent::setUp();
 		$this->response = new RedirectResponse('/url');
 	}
 
diff --git a/tests/lib/appframework/http/RequestTest.php b/tests/lib/appframework/http/RequestTest.php
index 58828d17bb2ab7c00d6dd7f738b89d59216bc619..caa22c84415ee26342569f4ce216e4993c019b39 100644
--- a/tests/lib/appframework/http/RequestTest.php
+++ b/tests/lib/appframework/http/RequestTest.php
@@ -10,9 +10,11 @@ namespace OC\AppFramework\Http;
 
 global $data;
 
-class RequestTest extends \PHPUnit_Framework_TestCase {
+class RequestTest extends \Test\TestCase {
+
+	protected function setUp() {
+		parent::setUp();
 
-	public function setUp() {
 		require_once __DIR__ . '/requeststream.php';
 		if (in_array('fakeinput', stream_get_wrappers())) {
 			stream_wrapper_unregister('fakeinput');
@@ -21,8 +23,9 @@ class RequestTest extends \PHPUnit_Framework_TestCase {
 		$this->stream = 'fakeinput://data';
 	}
 
-	public function tearDown() {
+	protected function tearDown() {
 		stream_wrapper_unregister('fakeinput');
+		parent::tearDown();
 	}
 
 	public function testRequestAccessors() {
diff --git a/tests/lib/appframework/http/ResponseTest.php b/tests/lib/appframework/http/ResponseTest.php
index b1dddd9ebc7a6dc4a46dd4c3c6557bbcbabc1c93..04e19fdaf71f82e782238f4487cbc0b0f42c4cce 100644
--- a/tests/lib/appframework/http/ResponseTest.php
+++ b/tests/lib/appframework/http/ResponseTest.php
@@ -29,7 +29,7 @@ use OCP\AppFramework\Http\Response;
 use OCP\AppFramework\Http;
 
 
-class ResponseTest extends \PHPUnit_Framework_TestCase {
+class ResponseTest extends \Test\TestCase {
 
 	/**
 	 * @var \OCP\AppFramework\Http\Response
@@ -37,6 +37,7 @@ class ResponseTest extends \PHPUnit_Framework_TestCase {
 	private $childResponse;
 
 	protected function setUp(){
+		parent::setUp();
 		$this->childResponse = new Response();
 	}
 
diff --git a/tests/lib/appframework/http/TemplateResponseTest.php b/tests/lib/appframework/http/TemplateResponseTest.php
index afdcf322b85a81817a0cd69973212dbbd213f4c6..2ec57f8979ac837d23b27cda1fc0451dc6efa122 100644
--- a/tests/lib/appframework/http/TemplateResponseTest.php
+++ b/tests/lib/appframework/http/TemplateResponseTest.php
@@ -28,7 +28,7 @@ use OCP\AppFramework\Http\TemplateResponse;
 use OCP\AppFramework\Http;
 
 
-class TemplateResponseTest extends \PHPUnit_Framework_TestCase {
+class TemplateResponseTest extends \Test\TestCase {
 
 	/**
 	 * @var \OCP\AppFramework\Http\TemplateResponse
@@ -41,6 +41,8 @@ class TemplateResponseTest extends \PHPUnit_Framework_TestCase {
 	private $api;
 
 	protected function setUp() {
+		parent::setUp();
+
 		$this->api = $this->getMock('OC\AppFramework\Core\API',
 								array('getAppName'), array('test'));
 		$this->api->expects($this->any())
diff --git a/tests/lib/appframework/middleware/MiddlewareDispatcherTest.php b/tests/lib/appframework/middleware/MiddlewareDispatcherTest.php
index b1e221aab99d8a6e6bfd55332c7ed145616612a3..be8765afd39f90dad2f2fde4277124e4b69fd181 100644
--- a/tests/lib/appframework/middleware/MiddlewareDispatcherTest.php
+++ b/tests/lib/appframework/middleware/MiddlewareDispatcherTest.php
@@ -100,7 +100,7 @@ class TestMiddleware extends Middleware {
 }
 
 
-class MiddlewareDispatcherTest extends \PHPUnit_Framework_TestCase {
+class MiddlewareDispatcherTest extends \Test\TestCase {
 
 	public $exception;
 	public $response;
@@ -113,8 +113,9 @@ class MiddlewareDispatcherTest extends \PHPUnit_Framework_TestCase {
 	 */
 	private $dispatcher;
 
+	protected function setUp() {
+		parent::setUp();
 
-	public function setUp() {
 		$this->dispatcher = new MiddlewareDispatcher();
 		$this->controller = $this->getControllerMock();
 		$this->method = 'method';
diff --git a/tests/lib/appframework/middleware/MiddlewareTest.php b/tests/lib/appframework/middleware/MiddlewareTest.php
index 9d952f615734afbc0cb586bbc1fac22ed06c0ef4..b41ec33eb15125895c3e1ae7eb116ddcffb6159d 100644
--- a/tests/lib/appframework/middleware/MiddlewareTest.php
+++ b/tests/lib/appframework/middleware/MiddlewareTest.php
@@ -31,7 +31,7 @@ use OCP\AppFramework\Middleware;
 class ChildMiddleware extends Middleware {};
 
 
-class MiddlewareTest extends \PHPUnit_Framework_TestCase {
+class MiddlewareTest extends \Test\TestCase {
 
 	/**
 	 * @var Middleware
@@ -42,6 +42,8 @@ class MiddlewareTest extends \PHPUnit_Framework_TestCase {
 	private $api;
 
 	protected function setUp(){
+		parent::setUp();
+
 		$this->middleware = new ChildMiddleware();
 
 		$this->api = $this->getMockBuilder(
diff --git a/tests/lib/appframework/middleware/security/CORSMiddlewareTest.php b/tests/lib/appframework/middleware/security/CORSMiddlewareTest.php
index 79cd3b278af54610e1c6327c31e2a93167298954..b4bbcce5ad7e45011f7344048d67da7856aeb86a 100644
--- a/tests/lib/appframework/middleware/security/CORSMiddlewareTest.php
+++ b/tests/lib/appframework/middleware/security/CORSMiddlewareTest.php
@@ -18,11 +18,12 @@ use OC\AppFramework\Utility\ControllerMethodReflector;
 use OCP\AppFramework\Http\Response;
 
 
-class CORSMiddlewareTest extends \PHPUnit_Framework_TestCase {
+class CORSMiddlewareTest extends \Test\TestCase {
 
 	private $reflector;
 
 	protected function setUp() {
+		parent::setUp();
 		$this->reflector = new ControllerMethodReflector();
 	}
 
diff --git a/tests/lib/appframework/middleware/security/SecurityMiddlewareTest.php b/tests/lib/appframework/middleware/security/SecurityMiddlewareTest.php
index cc7704f4d1a2744d80caac190636ea61718771a2..a8925403a95c90520fd588d06ced16bbd20f9dbb 100644
--- a/tests/lib/appframework/middleware/security/SecurityMiddlewareTest.php
+++ b/tests/lib/appframework/middleware/security/SecurityMiddlewareTest.php
@@ -31,7 +31,7 @@ use OCP\AppFramework\Http\RedirectResponse;
 use OCP\AppFramework\Http\JSONResponse;
 
 
-class SecurityMiddlewareTest extends \PHPUnit_Framework_TestCase {
+class SecurityMiddlewareTest extends \Test\TestCase {
 
 	private $middleware;
 	private $controller;
@@ -43,7 +43,9 @@ class SecurityMiddlewareTest extends \PHPUnit_Framework_TestCase {
 	private $navigationManager;
 	private $urlGenerator;
 
-	public function setUp() {
+	protected function setUp() {
+		parent::setUp();
+
 		$this->controller = $this->getMockBuilder('OCP\AppFramework\Controller')
 			->disableOriginalConstructor()
 				->getMock();
diff --git a/tests/lib/appframework/middleware/sessionmiddlewaretest.php b/tests/lib/appframework/middleware/sessionmiddlewaretest.php
index 13e558bf21ae49f8618a9aadb9229bcce9268a09..344b555ec3c1f6af0ac81a3c6069d3504327a8a1 100644
--- a/tests/lib/appframework/middleware/sessionmiddlewaretest.php
+++ b/tests/lib/appframework/middleware/sessionmiddlewaretest.php
@@ -18,7 +18,7 @@ use OC\AppFramework\Utility\ControllerMethodReflector;
 use OCP\AppFramework\Http\Response;
 
 
-class SessionMiddlewareTest extends \PHPUnit_Framework_TestCase {
+class SessionMiddlewareTest extends \Test\TestCase {
 
 	/**
 	 * @var ControllerMethodReflector
@@ -31,6 +31,8 @@ class SessionMiddlewareTest extends \PHPUnit_Framework_TestCase {
 	private $request;
 
 	protected function setUp() {
+		parent::setUp();
+
 		$this->request = new Request();
 		$this->reflector = new ControllerMethodReflector();
 	}
diff --git a/tests/lib/appframework/routing/RoutingTest.php b/tests/lib/appframework/routing/RoutingTest.php
index a1d9a51a3c8b2e1fd3d94c5367856171aa5fc5f6..276307680afaacd202c75e73b2833f51adeb1a82 100644
--- a/tests/lib/appframework/routing/RoutingTest.php
+++ b/tests/lib/appframework/routing/RoutingTest.php
@@ -6,7 +6,7 @@ use OC\AppFramework\DependencyInjection\DIContainer;
 use OC\AppFramework\routing\RouteConfig;
 
 
-class RoutingTest extends \PHPUnit_Framework_TestCase
+class RoutingTest extends \Test\TestCase
 {
 
 	public function testSimpleRoute()
diff --git a/tests/lib/appframework/utility/ControllerMethodReflectorTest.php b/tests/lib/appframework/utility/ControllerMethodReflectorTest.php
index 8939a203edbc289a1d1a8fb80e9b8c5a9ce21ae9..cd6bd57da4cf7fe0b2f566c1976d18a5b7b275eb 100644
--- a/tests/lib/appframework/utility/ControllerMethodReflectorTest.php
+++ b/tests/lib/appframework/utility/ControllerMethodReflectorTest.php
@@ -25,7 +25,7 @@
 namespace OC\AppFramework\Utility;
 
 
-class ControllerMethodReflectorTest extends \PHPUnit_Framework_TestCase {
+class ControllerMethodReflectorTest extends \Test\TestCase {
 
 
 	/**
diff --git a/tests/lib/archive.php b/tests/lib/archive.php
index be5cc897a67b1134f824700080abd21b3edb9b7a..690b4378b88a10dfe9cbe79eb2d07418db2c6fea 100644
--- a/tests/lib/archive.php
+++ b/tests/lib/archive.php
@@ -6,7 +6,7 @@
  * See the COPYING-README file.
  */
 
-abstract class Test_Archive extends PHPUnit_Framework_TestCase {
+abstract class Test_Archive extends \Test\TestCase {
 	/**
 	 * @var OC_Archive
 	 */
diff --git a/tests/lib/archive/tar.php b/tests/lib/archive/tar.php
index 99f7fb30e2bca8b84ed6fe1c0151433874b359ab..43157e2054dd608fa9382c17a8fe5c55f906eea8 100644
--- a/tests/lib/archive/tar.php
+++ b/tests/lib/archive/tar.php
@@ -7,11 +7,12 @@
  */
 
 class Test_Archive_TAR extends Test_Archive {
-	public function setUp() {
+	protected function setUp() {
+		parent::setUp();
+
 		if (OC_Util::runningOnWindows()) {
 			$this->markTestSkipped('[Windows] tar archives are not supported on Windows');
 		}
-		parent::setUp();
 	}
 
 	protected function getExisting() {
diff --git a/tests/lib/archive/zip.php b/tests/lib/archive/zip.php
index 90958baf38024a66125aefe8e997766f5cdf7d66..09ea5d7d27c66e57016b0c4f91cace6cfeb2eed3 100644
--- a/tests/lib/archive/zip.php
+++ b/tests/lib/archive/zip.php
@@ -6,8 +6,15 @@
  * See the COPYING-README file.
  */
 
-if (!OC_Util::runningOnWindows()) {
 class Test_Archive_ZIP extends Test_Archive {
+	protected function setUp() {
+		parent::setUp();
+
+		if (OC_Util::runningOnWindows()) {
+			$this->markTestSkipped('[Windows] ');
+		}
+	}
+
 	protected function getExisting() {
 		$dir = OC::$SERVERROOT . '/tests/data';
 		return new OC_Archive_ZIP($dir . '/data.zip');
@@ -17,4 +24,3 @@ class Test_Archive_ZIP extends Test_Archive {
 		return new OC_Archive_ZIP(OCP\Files::tmpFile('.zip'));
 	}
 }
-}
diff --git a/tests/lib/autoloader.php b/tests/lib/autoloader.php
index 46172647249f4558c841d4d761dced80624caa32..bf63094a9ef5199cb1149cb74e12f1c670de63b9 100644
--- a/tests/lib/autoloader.php
+++ b/tests/lib/autoloader.php
@@ -8,13 +8,14 @@
 
 namespace Test;
 
-class AutoLoader extends \PHPUnit_Framework_TestCase {
+class AutoLoader extends TestCase {
 	/**
 	 * @var \OC\Autoloader $loader
 	 */
 	private $loader;
 
-	public function setUp() {
+	protected function setUp() {
+		parent::setUp();
 		$this->loader = new \OC\AutoLoader();
 	}
 
diff --git a/tests/lib/avatar.php b/tests/lib/avatar.php
index 0334639afa861174282f6b2235a16e0ba18ae6d2..421be155d17bc10e218c3fa58bb9873aabf5244d 100644
--- a/tests/lib/avatar.php
+++ b/tests/lib/avatar.php
@@ -6,12 +6,14 @@
  * later.
  * See the COPYING-README file.
  */
-class Test_Avatar extends PHPUnit_Framework_TestCase {
+class Test_Avatar extends \Test\TestCase {
 
 	private $user;
 
-	public function setUp() {
-		$this->user = uniqid();
+	protected function setUp() {
+		parent::setUp();
+
+		$this->user = $this->getUniqueID();
 		$storage = new \OC\Files\Storage\Temporary(array());
 		\OC\Files\Filesystem::mount($storage, array(), '/' . $this->user . '/');
 	}
diff --git a/tests/lib/backgroundjob/job.php b/tests/lib/backgroundjob/job.php
index 10a8f46462e8dbac8aea2767d56c952a71bdb30d..fec9b0a792d3cf198d0fb72ccfcca802687d8d1f 100644
--- a/tests/lib/backgroundjob/job.php
+++ b/tests/lib/backgroundjob/job.php
@@ -8,10 +8,11 @@
 
 namespace Test\BackgroundJob;
 
-class Job extends \PHPUnit_Framework_TestCase {
+class Job extends \Test\TestCase {
 	private $run = false;
 
-	public function setUp() {
+	protected function setUp() {
+		parent::setUp();
 		$this->run = false;
 	}
 
diff --git a/tests/lib/backgroundjob/joblist.php b/tests/lib/backgroundjob/joblist.php
index c3318f80cb2671b73464aa926eae5de15c86e90b..13bee12479e14faf2cf9eaf96533eeeb9968cdf3 100644
--- a/tests/lib/backgroundjob/joblist.php
+++ b/tests/lib/backgroundjob/joblist.php
@@ -8,7 +8,7 @@
 
 namespace Test\BackgroundJob;
 
-class JobList extends \PHPUnit_Framework_TestCase {
+class JobList extends \Test\TestCase {
 	/**
 	 * @var \OC\BackgroundJob\JobList
 	 */
@@ -19,7 +19,9 @@ class JobList extends \PHPUnit_Framework_TestCase {
 	 */
 	protected $config;
 
-	public function setUp() {
+	protected function setUp() {
+		parent::setUp();
+
 		$conn = \OC::$server->getDatabaseConnection();
 		$this->config = $this->getMock('\OCP\IConfig');
 		$this->instance = new \OC\BackgroundJob\JobList($conn, $this->config);
diff --git a/tests/lib/backgroundjob/queuedjob.php b/tests/lib/backgroundjob/queuedjob.php
index 19c1b28a50723a4f9776bfc452cd69cf5a0dae26..8d3cd6f907b7668b083b90f206cb995406ad8260 100644
--- a/tests/lib/backgroundjob/queuedjob.php
+++ b/tests/lib/backgroundjob/queuedjob.php
@@ -23,7 +23,7 @@ class TestQueuedJob extends \OC\BackgroundJob\QueuedJob {
 	}
 }
 
-class QueuedJob extends \PHPUnit_Framework_TestCase {
+class QueuedJob extends \Test\TestCase {
 	/**
 	 * @var DummyJobList $jobList
 	 */
@@ -39,7 +39,9 @@ class QueuedJob extends \PHPUnit_Framework_TestCase {
 		$this->jobRun = true;
 	}
 
-	public function setup() {
+	protected function setup() {
+		parent::setUp();
+
 		$this->jobList = new DummyJobList();
 		$this->job = new TestQueuedJob($this);
 		$this->jobList->add($this->job);
diff --git a/tests/lib/backgroundjob/timedjob.php b/tests/lib/backgroundjob/timedjob.php
index 646a2607ef33bd73eb8cb6013bf782ce9c64b63a..7d9bfe979af85d0f1b7a2c385061aa464dd6fe5a 100644
--- a/tests/lib/backgroundjob/timedjob.php
+++ b/tests/lib/backgroundjob/timedjob.php
@@ -24,7 +24,7 @@ class TestTimedJob extends \OC\BackgroundJob\TimedJob {
 	}
 }
 
-class TimedJob extends \PHPUnit_Framework_TestCase {
+class TimedJob extends \Test\TestCase {
 	/**
 	 * @var DummyJobList $jobList
 	 */
@@ -40,7 +40,9 @@ class TimedJob extends \PHPUnit_Framework_TestCase {
 		$this->jobRun = true;
 	}
 
-	public function setup() {
+	protected function setup() {
+		parent::setUp();
+
 		$this->jobList = new DummyJobList();
 		$this->job = new TestTimedJob($this);
 		$this->jobList->add($this->job);
diff --git a/tests/lib/cache.php b/tests/lib/cache.php
index 8fefa25f65d97f55468cd3835b33dd5031d30f3c..894d8c576627528aefd78bcc3e9184e91a47c9a8 100644
--- a/tests/lib/cache.php
+++ b/tests/lib/cache.php
@@ -6,16 +6,18 @@
  * See the COPYING-README file.
  */
 
-abstract class Test_Cache extends PHPUnit_Framework_TestCase {
+abstract class Test_Cache extends \Test\TestCase {
 	/**
 	 * @var \OC\Cache cache;
 	 */
 	protected $instance;
 
-	public function tearDown() {
+	protected function tearDown() {
 		if($this->instance) {
 			$this->instance->clear();
 		}
+
+		parent::tearDown();
 	}
 
 	function testSimple() {
diff --git a/tests/lib/cache/file.php b/tests/lib/cache/file.php
index 8cc45c85405d7b11da2cda6470b26f1258a7f8ee..d51322036c8789566790c94d0e5dc9e983b67a59 100644
--- a/tests/lib/cache/file.php
+++ b/tests/lib/cache/file.php
@@ -33,8 +33,10 @@ class FileCache extends \Test_Cache {
 	function skip() {
 		//$this->skipUnless(OC_User::isLoggedIn());
 	}
-	
-	public function setUp() {
+
+	protected function setUp() {
+		parent::setUp();
+
 		//clear all proxies and hooks so we can do clean testing
 		\OC_FileProxy::clearProxies();
 		\OC_Hook::clear('OC_Filesystem');
@@ -70,7 +72,7 @@ class FileCache extends \Test_Cache {
 		$this->instance=new \OC\Cache\File();
 	}
 
-	public function tearDown() {
+	protected function tearDown() {
 		\OC_User::setUserId($this->user);
 		\OC_Config::setValue('cachedirectory', $this->datadir);
 
diff --git a/tests/lib/cache/usercache.php b/tests/lib/cache/usercache.php
index 8a23a805ebeea852c76e4824990934e40965f91d..3822a714d5a5135082f71bc392ca5e0c463c884d 100644
--- a/tests/lib/cache/usercache.php
+++ b/tests/lib/cache/usercache.php
@@ -30,7 +30,9 @@ class UserCache extends \Test_Cache {
 	/** @var \OC\Files\Storage\Storage */
 	private $storage;
 
-	public function setUp() {
+	protected function setUp() {
+		parent::setUp();
+
 		//clear all proxies and hooks so we can do clean testing
 		\OC_FileProxy::clearProxies();
 		\OC_Hook::clear('OC_Filesystem');
@@ -66,7 +68,7 @@ class UserCache extends \Test_Cache {
 		$this->instance=new \OC\Cache\UserCache();
 	}
 
-	public function tearDown() {
+	protected function tearDown() {
 		\OC_User::setUserId($this->user);
 		\OC_Config::setValue('cachedirectory', $this->datadir);
 
diff --git a/tests/lib/config.php b/tests/lib/config.php
index 180f6b1649b04e72f6c800266e40e49ec1f1d2f8..9dff3aab84f9bfc335deb2a2d3443532509d9003 100644
--- a/tests/lib/config.php
+++ b/tests/lib/config.php
@@ -6,7 +6,7 @@
  * See the COPYING-README file.
  */
 
-class Test_Config extends PHPUnit_Framework_TestCase {
+class Test_Config extends \Test\TestCase {
 	const TESTCONTENT = '<?php $CONFIG=array("foo"=>"bar", "beers" => array("Appenzeller", "Guinness", "Kölsch"), "alcohol_free" => false);';
 
 	/** @var array */
@@ -18,15 +18,18 @@ class Test_Config extends PHPUnit_Framework_TestCase {
 	/** @var string */
 	private $randomTmpDir;
 
-	function setUp() {
+	protected function setUp() {
+		parent::setUp();
+
 		$this->randomTmpDir = \OC_Helper::tmpFolder();
 		$this->configFile = $this->randomTmpDir.'testconfig.php';
 		file_put_contents($this->configFile, self::TESTCONTENT);
 		$this->config = new OC\Config($this->randomTmpDir, 'testconfig.php');
 	}
 
-	public function tearDown() {
+	protected function tearDown() {
 		unlink($this->configFile);
+		parent::tearDown();
 	}
 
 	public function testGetKeys() {
diff --git a/tests/lib/connector/sabre/directory.php b/tests/lib/connector/sabre/directory.php
index 453d8e8d42a72bdf6209a0879d55b9d57373d9c0..d8dca35cd71d997eeb557d50811a01a6d0570383 100644
--- a/tests/lib/connector/sabre/directory.php
+++ b/tests/lib/connector/sabre/directory.php
@@ -6,12 +6,14 @@
  * later.
  * See the COPYING-README file.
  */
-class Test_OC_Connector_Sabre_Directory extends PHPUnit_Framework_TestCase {
+class Test_OC_Connector_Sabre_Directory extends \Test\TestCase {
 
 	private $view;
 	private $info;
 
-	public function setUp() {
+	protected function setUp() {
+		parent::setUp();
+
 		$this->view = $this->getMock('OC\Files\View', array(), array(), '', false);
 		$this->info = $this->getMock('OC\Files\FileInfo', array(), array(), '', false);
 	}
diff --git a/tests/lib/connector/sabre/file.php b/tests/lib/connector/sabre/file.php
index 0993a27f3728eb5578191d5f17edea2983db50e4..cfc6e29ae745ef76e5fddf26462ce779df49c9c4 100644
--- a/tests/lib/connector/sabre/file.php
+++ b/tests/lib/connector/sabre/file.php
@@ -6,7 +6,7 @@
  * See the COPYING-README file.
  */
 
-class Test_OC_Connector_Sabre_File extends PHPUnit_Framework_TestCase {
+class Test_OC_Connector_Sabre_File extends \Test\TestCase {
 
 	/**
 	 * @expectedException \Sabre\DAV\Exception
diff --git a/tests/lib/connector/sabre/node.php b/tests/lib/connector/sabre/node.php
index 0f30345724882a54f2034f54330aae1ae8c95f76..9a2bf41bd192dc69951c9cb4cfeeac25668a5fb8 100644
--- a/tests/lib/connector/sabre/node.php
+++ b/tests/lib/connector/sabre/node.php
@@ -12,7 +12,7 @@ namespace Test\Connector\Sabre;
 use OC\Files\FileInfo;
 use OC\Files\View;
 
-class Node extends \PHPUnit_Framework_TestCase {
+class Node extends \Test\TestCase {
 	public function davPermissionsProvider() {
 		return array(
 			array(\OCP\PERMISSION_ALL, 'file', false, false, 'RDNVW'),
diff --git a/tests/lib/connector/sabre/objecttree.php b/tests/lib/connector/sabre/objecttree.php
index fc9f802066f10df56cfa696119877ec5fc7563f3..d1de46d2ee78b459dab093679ba810c0e5ec9f48 100644
--- a/tests/lib/connector/sabre/objecttree.php
+++ b/tests/lib/connector/sabre/objecttree.php
@@ -13,7 +13,7 @@ use OC\Files\FileInfo;
 use OC_Connector_Sabre_Directory;
 use PHPUnit_Framework_TestCase;
 
-class TestDoubleFileView extends \OC\Files\View{
+class TestDoubleFileView extends \OC\Files\View {
 
 	public function __construct($updatables, $deletables, $canRename = true) {
 		$this->updatables = $updatables;
@@ -42,7 +42,7 @@ class TestDoubleFileView extends \OC\Files\View{
 	}
 }
 
-class ObjectTree extends PHPUnit_Framework_TestCase {
+class ObjectTree extends \Test\TestCase {
 
 	/**
 	 * @dataProvider moveFailedProvider
diff --git a/tests/lib/connector/sabre/quotaplugin.php b/tests/lib/connector/sabre/quotaplugin.php
index 3b144cf56b5213a4285bf03a305772a22b58a9f6..f08637854ce46e89ce55b7e285c8e5ff9671597a 100644
--- a/tests/lib/connector/sabre/quotaplugin.php
+++ b/tests/lib/connector/sabre/quotaplugin.php
@@ -6,7 +6,7 @@
  * later.
  * See the COPYING-README file.
  */
-class Test_OC_Connector_Sabre_QuotaPlugin extends PHPUnit_Framework_TestCase {
+class Test_OC_Connector_Sabre_QuotaPlugin extends \Test\TestCase {
 
 	/**
 	 * @var \Sabre\DAV\Server
diff --git a/tests/lib/contacts/localadressbook.php b/tests/lib/contacts/localadressbook.php
index bb69910820f4f4e855a9851d0dd13ccc287eb11d..5fa260ffc3b2df6efc428933d5483727d505aafa 100644
--- a/tests/lib/contacts/localadressbook.php
+++ b/tests/lib/contacts/localadressbook.php
@@ -11,7 +11,7 @@ use OC\Contacts\LocalAddressBook;
  * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-class Test_LocalAddressBook extends PHPUnit_Framework_TestCase
+class Test_LocalAddressBook extends \Test\TestCase
 {
 
 	public function testSearchFN() {
diff --git a/tests/lib/db.php b/tests/lib/db.php
index fb673b8092b88e874b7148c1235fe7aefd0ec2ff..a401aded62a0e33bc7e83d011eead4ced4e82f8a 100644
--- a/tests/lib/db.php
+++ b/tests/lib/db.php
@@ -6,7 +6,7 @@
  * See the COPYING-README file.
  */
 
-class Test_DB extends PHPUnit_Framework_TestCase {
+class Test_DB extends \Test\TestCase {
 	protected $backupGlobals = FALSE;
 
 	protected static $schema_file = 'static://test_db_scheme';
@@ -32,7 +32,9 @@ class Test_DB extends PHPUnit_Framework_TestCase {
 	 */
 	private $table4;
 
-	public function setUp() {
+	protected function setUp() {
+		parent::setUp();
+
 		$dbfile = OC::$SERVERROOT.'/tests/data/db_structure.xml';
 
 		$r = '_'.OC_Util::generateRandomBytes(4).'_';
@@ -48,9 +50,11 @@ class Test_DB extends PHPUnit_Framework_TestCase {
 		$this->table4 = $this->test_prefix.'decimal';
 	}
 
-	public function tearDown() {
+	protected function tearDown() {
 		OC_DB::removeDBStructure(self::$schema_file);
 		unlink(self::$schema_file);
+
+		parent::tearDown();
 	}
 
 	public function testQuotes() {
diff --git a/tests/lib/db/mdb2schemamanager.php b/tests/lib/db/mdb2schemamanager.php
index 527b2cba6484390f5a3e8cd03d9db7877e78bca1..3e6abab70b4c5a9609b97c8ba4a462575eed7717 100644
--- a/tests/lib/db/mdb2schemamanager.php
+++ b/tests/lib/db/mdb2schemamanager.php
@@ -12,15 +12,17 @@ namespace Test\DB;
 use Doctrine\DBAL\Platforms\OraclePlatform;
 use Doctrine\DBAL\Platforms\SQLServerPlatform;
 
-class MDB2SchemaManager extends \PHPUnit_Framework_TestCase {
+class MDB2SchemaManager extends \Test\TestCase {
 
-	public function tearDown() {
+	protected function tearDown() {
 		// do not drop the table for Oracle as it will create a bogus transaction
 		// that will break the following test suites requiring transactions
 		if (\OC::$server->getConfig()->getSystemValue('dbtype', 'sqlite') === 'oci') {
 			return;
 		}
 		\OC_DB::dropTable('table');
+
+		parent::tearDown();
 	}
 
 	public function testAutoIncrement() {
diff --git a/tests/lib/db/mdb2schemareader.php b/tests/lib/db/mdb2schemareader.php
index f08996cbeafd7eaff64f01d78ba43b566288d4ac..b2ff55e16326c0e490c66dd383c260d26c190451 100644
--- a/tests/lib/db/mdb2schemareader.php
+++ b/tests/lib/db/mdb2schemareader.php
@@ -11,7 +11,7 @@ namespace Test\DB;
 
 use Doctrine\DBAL\Platforms\MySqlPlatform;
 
-class MDB2SchemaReader extends \PHPUnit_Framework_TestCase {
+class MDB2SchemaReader extends \Test\TestCase {
 	/**
 	 * @var \OC\DB\MDB2SchemaReader $reader
 	 */
diff --git a/tests/lib/db/migrator.php b/tests/lib/db/migrator.php
index 09742a53eb4688ab438217673e4e234101836ae6..7acd3382fe290ea7d2664815270d1a0796094300 100644
--- a/tests/lib/db/migrator.php
+++ b/tests/lib/db/migrator.php
@@ -15,7 +15,7 @@ use Doctrine\DBAL\Platforms\SQLServerPlatform;
 use \Doctrine\DBAL\Schema\Schema;
 use \Doctrine\DBAL\Schema\SchemaConfig;
 
-class Migrator extends \PHPUnit_Framework_TestCase {
+class Migrator extends \Test\TestCase {
 	/**
 	 * @var \Doctrine\DBAL\Connection $connection
 	 */
@@ -28,7 +28,9 @@ class Migrator extends \PHPUnit_Framework_TestCase {
 
 	private $tableName;
 
-	public function setUp() {
+	protected function setUp() {
+		parent::setUp();
+
 		$this->connection = \OC_DB::getConnection();
 		if ($this->connection->getDatabasePlatform() instanceof OraclePlatform) {
 			$this->markTestSkipped('DB migration tests are not supported on OCI');
@@ -40,8 +42,9 @@ class Migrator extends \PHPUnit_Framework_TestCase {
 		$this->tableName = 'test_' . uniqid();
 	}
 
-	public function tearDown() {
+	protected function tearDown() {
 		$this->connection->exec('DROP TABLE ' . $this->tableName);
+		parent::tearDown();
 	}
 
 	/**
diff --git a/tests/lib/db/mysqlmigration.php b/tests/lib/db/mysqlmigration.php
index 584df1d4465fc107787ca524214bdabc04cacc2f..70199147760600535fa599f984549597aa59c774 100644
--- a/tests/lib/db/mysqlmigration.php
+++ b/tests/lib/db/mysqlmigration.php
@@ -6,7 +6,7 @@
  * See the COPYING-README file.
  */
 
-class TestMySqlMigration extends \PHPUnit_Framework_TestCase {
+class TestMySqlMigration extends \Test\TestCase {
 
 	/** @var \Doctrine\DBAL\Connection */
 	private $connection;
@@ -14,7 +14,9 @@ class TestMySqlMigration extends \PHPUnit_Framework_TestCase {
 	/** @var string */
 	private $tableName;
 
-	public function setUp() {
+	protected function setUp() {
+		parent::setUp();
+
 		$this->connection = \OC_DB::getConnection();
 		if (!$this->connection->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\MySqlPlatform) {
 			$this->markTestSkipped("Test only relevant on MySql");
@@ -25,8 +27,9 @@ class TestMySqlMigration extends \PHPUnit_Framework_TestCase {
 		$this->connection->exec("CREATE TABLE $this->tableName(b BIT,  e ENUM('1','2','3','4'))");
 	}
 
-	public function tearDown() {
+	protected function tearDown() {
 		$this->connection->getSchemaManager()->dropTable($this->tableName);
+		parent::tearDown();
 	}
 
 	public function testNonOCTables() {
diff --git a/tests/lib/db/sqlitemigration.php b/tests/lib/db/sqlitemigration.php
index adfc03a2ca74b1918665324d35ed1b78a5cc212f..e3d0e386ab538ad4f81a4c12115429ef34549df6 100644
--- a/tests/lib/db/sqlitemigration.php
+++ b/tests/lib/db/sqlitemigration.php
@@ -6,7 +6,7 @@
  * See the COPYING-README file.
  */
 
-class TestSqliteMigration extends \PHPUnit_Framework_TestCase {
+class TestSqliteMigration extends \Test\TestCase {
 
 	/** @var \Doctrine\DBAL\Connection */
 	private $connection;
@@ -14,7 +14,9 @@ class TestSqliteMigration extends \PHPUnit_Framework_TestCase {
 	/** @var string */
 	private $tableName;
 
-	public function setUp() {
+	protected function setUp() {
+		parent::setUp();
+
 		$this->connection = \OC_DB::getConnection();
 		if (!$this->connection->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\SqlitePlatform) {
 			$this->markTestSkipped("Test only relevant on Sqlite");
@@ -25,8 +27,9 @@ class TestSqliteMigration extends \PHPUnit_Framework_TestCase {
 		$this->connection->exec("CREATE TABLE $this->tableName(t0 tinyint unsigned, t1 tinyint)");
 	}
 
-	public function tearDown() {
+	protected function tearDown() {
 		$this->connection->getSchemaManager()->dropTable($this->tableName);
+		parent::tearDown();
 	}
 
 	public function testNonOCTables() {
diff --git a/tests/lib/dbschema.php b/tests/lib/dbschema.php
index d31bd34124e53b134ab957b148ffdc2fc188065e..cfaebec079ee44d5b4c8830ceb05cc0c53a30424 100644
--- a/tests/lib/dbschema.php
+++ b/tests/lib/dbschema.php
@@ -9,13 +9,15 @@
 
 use OCP\Security\ISecureRandom;
 
-class Test_DBSchema extends PHPUnit_Framework_TestCase {
+class Test_DBSchema extends \Test\TestCase {
 	protected $schema_file = 'static://test_db_scheme';
 	protected $schema_file2 = 'static://test_db_scheme2';
 	protected $table1;
 	protected $table2;
 
-	public function setUp() {
+	protected function setUp() {
+		parent::setUp();
+
 		$dbfile = OC::$SERVERROOT.'/tests/data/db_structure.xml';
 		$dbfile2 = OC::$SERVERROOT.'/tests/data/db_structure2.xml';
 
@@ -32,9 +34,11 @@ class Test_DBSchema extends PHPUnit_Framework_TestCase {
 		$this->table2 = $r.'cntcts_cards';
 	}
 
-	public function tearDown() {
+	protected function tearDown() {
 		unlink($this->schema_file);
 		unlink($this->schema_file2);
+
+		parent::tearDown();
 	}
 
 	// everything in one test, they depend on each other
diff --git a/tests/lib/errorHandler.php b/tests/lib/errorHandler.php
index 58db80b3c6efbcd85f3fc08b04e005a2c35ac8e8..726529e83f4dece236b8a7bb670fb94bb1a39e84 100644
--- a/tests/lib/errorHandler.php
+++ b/tests/lib/errorHandler.php
@@ -20,7 +20,7 @@
  *
  */
 
-class Test_ErrorHandler extends \PHPUnit_Framework_TestCase {
+class Test_ErrorHandler extends \Test\TestCase {
 
 	/**
 	 * provide username, password combinations for testRemovePassword
diff --git a/tests/lib/files/cache/cache.php b/tests/lib/files/cache/cache.php
index 969740419c685c4c297cbdca190d28dde88cbd59..02c45a165712a7668d0b917c4533f845dad9e505 100644
--- a/tests/lib/files/cache/cache.php
+++ b/tests/lib/files/cache/cache.php
@@ -16,7 +16,7 @@ class LongId extends \OC\Files\Storage\Temporary {
 	}
 }
 
-class Cache extends \PHPUnit_Framework_TestCase {
+class Cache extends \Test\TestCase {
 	/**
 	 * @var \OC\Files\Storage\Temporary $storage ;
 	 */
@@ -452,13 +452,17 @@ class Cache extends \PHPUnit_Framework_TestCase {
 		$this->assertEquals(1, count($this->cache->getFolderContents('folder')));
 	}
 
-	public function tearDown() {
+	protected function tearDown() {
 		if ($this->cache) {
 			$this->cache->clear();
 		}
+
+		parent::tearDown();
 	}
 
-	public function setUp() {
+	protected function setUp() {
+		parent::setUp();
+
 		$this->storage = new \OC\Files\Storage\Temporary(array());
 		$this->storage2 = new \OC\Files\Storage\Temporary(array());
 		$this->cache = new \OC\Files\Cache\Cache($this->storage);
diff --git a/tests/lib/files/cache/changepropagator.php b/tests/lib/files/cache/changepropagator.php
index a52682cd0861c5c44c0a59cebe4e16e0f03c8988..89bd9dfe80a7fd69dd20ee52401891134967d6fd 100644
--- a/tests/lib/files/cache/changepropagator.php
+++ b/tests/lib/files/cache/changepropagator.php
@@ -12,7 +12,7 @@ use OC\Files\Filesystem;
 use OC\Files\Storage\Temporary;
 use OC\Files\View;
 
-class ChangePropagator extends \PHPUnit_Framework_TestCase {
+class ChangePropagator extends \Test\TestCase {
 	/**
 	 * @var \OC\Files\Cache\ChangePropagator
 	 */
@@ -23,9 +23,11 @@ class ChangePropagator extends \PHPUnit_Framework_TestCase {
 	 */
 	private $view;
 
-	public function setUp() {
+	protected function setUp() {
+		parent::setUp();
+
 		$storage = new Temporary(array());
-		$root = '/' . uniqid();
+		$root = $this->getUniqueID('/');
 		Filesystem::mount($storage, array(), $root);
 		$this->view = new View($root);
 		$this->propagator = new \OC\Files\Cache\ChangePropagator($this->view);
diff --git a/tests/lib/files/cache/homecache.php b/tests/lib/files/cache/homecache.php
index 80dc54c9d19596beb23f16d4a3fcd82e0618faf1..7ebb053bcfa5e9f4bca79922c2129d6f9768c022 100644
--- a/tests/lib/files/cache/homecache.php
+++ b/tests/lib/files/cache/homecache.php
@@ -43,7 +43,7 @@ class DummyUser extends \OC\User\User {
 	}
 }
 
-class HomeCache extends \PHPUnit_Framework_TestCase {
+class HomeCache extends \Test\TestCase {
 	/**
 	 * @var \OC\Files\Storage\Home $storage
 	 */
@@ -59,7 +59,9 @@ class HomeCache extends \PHPUnit_Framework_TestCase {
 	 */
 	private $user;
 
-	public function setUp() {
+	protected function setUp() {
+		parent::setUp();
+
 		$this->user = new DummyUser('foo', \OC_Helper::tmpFolder());
 		$this->storage = new \OC\Files\Storage\Home(array('user' => $this->user));
 		$this->cache = $this->storage->getCache();
diff --git a/tests/lib/files/cache/scanner.php b/tests/lib/files/cache/scanner.php
index 0a274631d1cf72fe8f0c28a259574c0f5c95b5ff..b44cf0a49dfae6be4fd283df395fcff42e480493 100644
--- a/tests/lib/files/cache/scanner.php
+++ b/tests/lib/files/cache/scanner.php
@@ -8,7 +8,7 @@
 
 namespace Test\Files\Cache;
 
-class Scanner extends \PHPUnit_Framework_TestCase {
+class Scanner extends \Test\TestCase {
 	/**
 	 * @var \OC\Files\Storage\Storage $storage
 	 */
@@ -24,16 +24,20 @@ class Scanner extends \PHPUnit_Framework_TestCase {
 	 */
 	private $cache;
 
-	function setUp() {
+	protected function setUp() {
+		parent::setUp();
+
 		$this->storage = new \OC\Files\Storage\Temporary(array());
 		$this->scanner = new \OC\Files\Cache\Scanner($this->storage);
 		$this->cache = new \OC\Files\Cache\Cache($this->storage);
 	}
 
-	function tearDown() {
+	protected function tearDown() {
 		if ($this->cache) {
 			$this->cache->clear();
 		}
+
+		parent::tearDown();
 	}
 
 	function testFile() {
diff --git a/tests/lib/files/cache/updater.php b/tests/lib/files/cache/updater.php
index 9e7330db20c0c2ef5384e4e79eae0cbd97a0ae0d..01b036de5d832c621d5cba51b41b5a4c47e730ca 100644
--- a/tests/lib/files/cache/updater.php
+++ b/tests/lib/files/cache/updater.php
@@ -12,7 +12,7 @@ use OC\Files\Filesystem;
 use OC\Files\Storage\Temporary;
 use OC\Files\View;
 
-class Updater extends \PHPUnit_Framework_TestCase {
+class Updater extends \Test\TestCase {
 	/**
 	 * @var \OC\Files\Storage\Storage
 	 */
@@ -40,6 +40,7 @@ class Updater extends \PHPUnit_Framework_TestCase {
 		parent::setUp();
 
 		$this->originalStorage = Filesystem::getStorage('/');
+
 		$this->storage = new Temporary(array());
 		Filesystem::clearMounts();
 		Filesystem::mount($this->storage, array(), '/');
diff --git a/tests/lib/files/cache/updaterlegacy.php b/tests/lib/files/cache/updaterlegacy.php
index d16a062fcca203e1208c7dc283b94908eca97df2..7c05800cd6ba3f528549a71dc7985256e4c4d23a 100644
--- a/tests/lib/files/cache/updaterlegacy.php
+++ b/tests/lib/files/cache/updaterlegacy.php
@@ -11,7 +11,7 @@ namespace Test\Files\Cache;
 use \OC\Files\Filesystem as Filesystem;
 use OC\Files\Storage\Temporary;
 
-class UpdaterLegacy extends \PHPUnit_Framework_TestCase {
+class UpdaterLegacy extends \Test\TestCase {
 	/**
 	 * @var \OC\Files\Storage\Storage $storage
 	 */
@@ -34,7 +34,8 @@ class UpdaterLegacy extends \PHPUnit_Framework_TestCase {
 
 	private static $user;
 
-	public function setUp() {
+	protected function setUp() {
+		parent::setUp();
 
 		// remember files_encryption state
 		$this->stateFilesEncryption = \OC_App::isEnabled('files_encryption');
@@ -71,7 +72,7 @@ class UpdaterLegacy extends \PHPUnit_Framework_TestCase {
 		\OC_Hook::clear('OC_Filesystem');
 	}
 
-	public function tearDown() {
+	protected function tearDown() {
 		if ($this->cache) {
 			$this->cache->clear();
 		}
@@ -83,6 +84,8 @@ class UpdaterLegacy extends \PHPUnit_Framework_TestCase {
 		if ($this->stateFilesEncryption) {
 			\OC_App::enable('files_encryption');
 		}
+
+		parent::tearDown();
 	}
 
 	public function testWrite() {
diff --git a/tests/lib/files/cache/watcher.php b/tests/lib/files/cache/watcher.php
index 0b04b9e7058f87d849d479fc6ecaeaf1049b4c60..ee605c64e01993d23d7af1cfa1eaace2cd4f0899 100644
--- a/tests/lib/files/cache/watcher.php
+++ b/tests/lib/files/cache/watcher.php
@@ -8,7 +8,7 @@
 
 namespace Test\Files\Cache;
 
-class Watcher extends \PHPUnit_Framework_TestCase {
+class Watcher extends \Test\TestCase {
 
 	/**
 	 * @var \OC\Files\Storage\Storage[] $storages
diff --git a/tests/lib/files/etagtest.php b/tests/lib/files/etagtest.php
index 8f29ed0bc6377275cb90284de614c670def50c83..eec24d9f4c6609b552f0d55df4c5e208806d977e 100644
--- a/tests/lib/files/etagtest.php
+++ b/tests/lib/files/etagtest.php
@@ -56,7 +56,7 @@ class EtagTest extends \Test\TestCase {
 	}
 
 	public function testNewUser() {
-		$user1 = uniqid('user_');
+		$user1 = $this->getUniqueID('user_');
 		$this->userBackend->createUser($user1, '');
 
 		\OC_Util::tearDownFS();
diff --git a/tests/lib/files/filesystem.php b/tests/lib/files/filesystem.php
index f24d86b212dc8e2385edba2e4c80e48367e59464..746600c7d15f2defbed56aff6f2e1729b8e099cf 100644
--- a/tests/lib/files/filesystem.php
+++ b/tests/lib/files/filesystem.php
@@ -55,6 +55,8 @@ class Filesystem extends \Test\TestCase {
 		\OC\Files\Filesystem::clearMounts();
 		\OC\Files\Filesystem::mount($this->originalStorage, array(), '/');
 		\OC_User::setUserId('');
+
+		parent::tearDown();
 	}
 
 	public function testMount() {
diff --git a/tests/lib/files/mapper.php b/tests/lib/files/mapper.php
index d513f3ce4b3099a08304b9199dbf78d967ac1a93..18161734b60f41410a10d709b3c0722e8654bfff 100644
--- a/tests/lib/files/mapper.php
+++ b/tests/lib/files/mapper.php
@@ -22,14 +22,15 @@
 
 namespace Test\Files;
 
-class Mapper extends \PHPUnit_Framework_TestCase {
+class Mapper extends \Test\TestCase {
 
 	/**
 	 * @var \OC\Files\Mapper
 	 */
 	private $mapper = null;
 
-	public function setUp() {
+	protected function setUp() {
+		parent::setUp();
 		$this->mapper = new \OC\Files\Mapper('D:/');
 	}
 
diff --git a/tests/lib/files/mount/manager.php b/tests/lib/files/mount/manager.php
index 154c35ccead2b7d94700de031712b548976711f4..051b76ccf2ea5a1e8b8c7a7909dc5b111b997ca7 100644
--- a/tests/lib/files/mount/manager.php
+++ b/tests/lib/files/mount/manager.php
@@ -16,13 +16,14 @@ class LongId extends Temporary {
 	}
 }
 
-class Manager extends \PHPUnit_Framework_TestCase {
+class Manager extends \Test\TestCase {
 	/**
 	 * @var \OC\Files\Mount\Manager
 	 */
 	private $manager;
 
-	public function setup() {
+	protected function setup() {
+		parent::setUp();
 		$this->manager = new \OC\Files\Mount\Manager();
 	}
 
diff --git a/tests/lib/files/mount/mount.php b/tests/lib/files/mount/mount.php
index c3d33e0870b9c45df0e32dbbbf163bc7dcd79f9c..5ee3d934e97b6bc4723edb3c2ad470853ae760c4 100644
--- a/tests/lib/files/mount/mount.php
+++ b/tests/lib/files/mount/mount.php
@@ -12,7 +12,7 @@ namespace Test\Files\Mount;
 use OC\Files\Storage\Loader;
 use OC\Files\Storage\Wrapper\Wrapper;
 
-class Mount extends \PHPUnit_Framework_TestCase {
+class Mount extends \Test\TestCase {
 	public function testFromStorageObject() {
 		$storage = $this->getMockBuilder('\OC\Files\Storage\Temporary')
 			->disableOriginalConstructor()
diff --git a/tests/lib/files/node/file.php b/tests/lib/files/node/file.php
index 76938a0dcc8bcb44601d60974c6e035a2b433915..34ec7dee2135335d9b5d02b484b14658907bd85f 100644
--- a/tests/lib/files/node/file.php
+++ b/tests/lib/files/node/file.php
@@ -12,10 +12,11 @@ use OCP\Files\NotFoundException;
 use OCP\Files\NotPermittedException;
 use OC\Files\View;
 
-class File extends \PHPUnit_Framework_TestCase {
+class File extends \Test\TestCase {
 	private $user;
 
-	public function setUp() {
+	protected function setUp() {
+		parent::setUp();
 		$this->user = new \OC\User\User('', new \OC_User_Dummy);
 	}
 
diff --git a/tests/lib/files/node/folder.php b/tests/lib/files/node/folder.php
index 436161aba72fab9a8c26b1d4a40434b8f03dfcbd..e348e452f6fcf6906bf30361e06cf282c76203b8 100644
--- a/tests/lib/files/node/folder.php
+++ b/tests/lib/files/node/folder.php
@@ -15,10 +15,11 @@ use OCP\Files\NotFoundException;
 use OCP\Files\NotPermittedException;
 use OC\Files\View;
 
-class Folder extends \PHPUnit_Framework_TestCase {
+class Folder extends \Test\TestCase {
 	private $user;
 
-	public function setUp() {
+	protected function setUp() {
+		parent::setUp();
 		$this->user = new \OC\User\User('', new \OC_User_Dummy);
 	}
 
diff --git a/tests/lib/files/node/integration.php b/tests/lib/files/node/integration.php
index cde2eb22b7bad5d781684d2ed74463c2395f6a86..fd777460ec6cfd47e06a3f5bf4269146c610f103 100644
--- a/tests/lib/files/node/integration.php
+++ b/tests/lib/files/node/integration.php
@@ -14,7 +14,7 @@ use OC\Files\Storage\Temporary;
 use OC\Files\View;
 use OC\User\User;
 
-class IntegrationTests extends \PHPUnit_Framework_TestCase {
+class IntegrationTests extends \Test\TestCase {
 	/**
 	 * @var \OC\Files\Node\Root $root
 	 */
@@ -65,7 +65,6 @@ class IntegrationTests extends \PHPUnit_Framework_TestCase {
 			$storage->getCache()->clear();
 		}
 		\OC\Files\Filesystem::clearMounts();
-
 		\OC\Files\Filesystem::mount($this->originalStorage, array(), '/');
 
 		parent::tearDown();
diff --git a/tests/lib/files/node/node.php b/tests/lib/files/node/node.php
index cf5fec30522124ec39d6745d8f01e5555d757348..80e3ac6f80af8ed65d9fda0c3e28a866e450f536 100644
--- a/tests/lib/files/node/node.php
+++ b/tests/lib/files/node/node.php
@@ -8,10 +8,11 @@
 
 namespace Test\Files\Node;
 
-class Node extends \PHPUnit_Framework_TestCase {
+class Node extends \Test\TestCase {
 	private $user;
 
-	public function setUp() {
+	protected function setUp() {
+		parent::setUp();
 		$this->user = new \OC\User\User('', new \OC_User_Dummy);
 	}
 
diff --git a/tests/lib/files/node/root.php b/tests/lib/files/node/root.php
index 27f1a937826082f19e80fc96e4deb6118b00e919..fcce7070f5dbe341da6cdef85d4b37359bddcb4e 100644
--- a/tests/lib/files/node/root.php
+++ b/tests/lib/files/node/root.php
@@ -11,10 +11,11 @@ namespace Test\Files\Node;
 use OCP\Files\NotPermittedException;
 use OC\Files\Mount\Manager;
 
-class Root extends \PHPUnit_Framework_TestCase {
+class Root extends \Test\TestCase {
 	private $user;
 
-	public function setUp() {
+	protected function setUp() {
+		parent::setUp();
 		$this->user = new \OC\User\User('', new \OC_User_Dummy);
 	}
 
diff --git a/tests/lib/files/objectstore/swift.php b/tests/lib/files/objectstore/swift.php
index 37d6cc74de666cf7d7963a1ecbefbfd41ee391a5..f2c4a983cf28dbf254324933afaf61160387fc61 100644
--- a/tests/lib/files/objectstore/swift.php
+++ b/tests/lib/files/objectstore/swift.php
@@ -30,7 +30,9 @@ class Swift extends \Test\Files\Storage\Storage {
 
 	private $objectStorage;
 
-	public function setUp() {
+	protected function setUp() {
+		parent::setUp();
+
 		if (!getenv('RUN_OBJECTSTORE_TESTS')) {
 			$this->markTestSkipped('objectstore tests are unreliable on travis');
 		}
@@ -74,12 +76,14 @@ class Swift extends \Test\Files\Storage\Storage {
 		$this->instance = new ObjectStoreStorage($params);
 	}
 
-	public function tearDown() {
+	protected function tearDown() {
 		if (is_null($this->instance)) {
 			return;
 		}
 		$this->objectStorage->deleteContainer(true);
 		$this->instance->getCache()->clear();
+
+		parent::tearDown();
 	}
 
 	public function testStat() {
diff --git a/tests/lib/files/storage/commontest.php b/tests/lib/files/storage/commontest.php
index ce53c884f328b0716f39b73d7d206850b26197df..2b70dc8713eb7361a1796f0e7062d25903d8e16f 100644
--- a/tests/lib/files/storage/commontest.php
+++ b/tests/lib/files/storage/commontest.php
@@ -27,12 +27,15 @@ class CommonTest extends Storage {
 	 * @var string tmpDir
 	 */
 	private $tmpDir;
-	public function setUp() {
+	protected function setUp() {
+		parent::setUp();
+
 		$this->tmpDir=\OC_Helper::tmpFolder();
 		$this->instance=new \OC\Files\Storage\CommonTest(array('datadir'=>$this->tmpDir));
 	}
 
-	public function tearDown() {
+	protected function tearDown() {
 		\OC_Helper::rmdirr($this->tmpDir);
+		parent::tearDown();
 	}
 }
diff --git a/tests/lib/files/storage/home.php b/tests/lib/files/storage/home.php
index d085efe9c1c45afdbdd52a3dc0027b8474c6980f..b0670a22892a33b819be374aaf42afaad63a11e0 100644
--- a/tests/lib/files/storage/home.php
+++ b/tests/lib/files/storage/home.php
@@ -60,15 +60,18 @@ class Home extends Storage {
 	 */
 	private $user;
 
-	public function setUp() {
+	protected function setUp() {
+		parent::setUp();
+
 		$this->tmpDir = \OC_Helper::tmpFolder();
-		$this->userId = uniqid('user_');
+		$this->userId = $this->getUniqueID('user_');
 		$this->user = new DummyUser($this->userId, $this->tmpDir);
 		$this->instance = new \OC\Files\Storage\Home(array('user' => $this->user));
 	}
 
-	public function tearDown() {
+	protected function tearDown() {
 		\OC_Helper::rmdirr($this->tmpDir);
+		parent::tearDown();
 	}
 
 	/**
diff --git a/tests/lib/files/storage/local.php b/tests/lib/files/storage/local.php
index 490086c62f2a4ec0197a83c37376bfbd7cd37933..d2b27117c3b62cdbfbf9c31e0dd2ea0b2ae3f39a 100644
--- a/tests/lib/files/storage/local.php
+++ b/tests/lib/files/storage/local.php
@@ -28,13 +28,16 @@ class Local extends Storage {
 	 */
 	private $tmpDir;
 
-	public function setUp() {
+	protected function setUp() {
+		parent::setUp();
+
 		$this->tmpDir = \OC_Helper::tmpFolder();
 		$this->instance = new \OC\Files\Storage\Local(array('datadir' => $this->tmpDir));
 	}
 
-	public function tearDown() {
+	protected function tearDown() {
 		\OC_Helper::rmdirr($this->tmpDir);
+		parent::tearDown();
 	}
 
 	public function testStableEtag() {
diff --git a/tests/lib/files/storage/mappedlocal.php b/tests/lib/files/storage/mappedlocal.php
index b483f3a1954d7ae2139d78d90faf9bd827e8f717..1e87b53d00a70703aba71681ba354d946d391f4b 100644
--- a/tests/lib/files/storage/mappedlocal.php
+++ b/tests/lib/files/storage/mappedlocal.php
@@ -27,14 +27,17 @@ class MappedLocal extends Storage {
 	 * @var string tmpDir
 	 */
 	private $tmpDir;
-	public function setUp() {
+	protected function setUp() {
+		parent::setUp();
+
 		$this->tmpDir=\OC_Helper::tmpFolder();
 		$this->instance=new \OC\Files\Storage\MappedLocal(array('datadir'=>$this->tmpDir));
 	}
 
-	public function tearDown() {
+	protected function tearDown() {
 		\OC_Helper::rmdirr($this->tmpDir);
 		unset($this->instance);
+		parent::tearDown();
 	}
 }
 
diff --git a/tests/lib/files/storage/mappedlocalwithdotteddatadir.php b/tests/lib/files/storage/mappedlocalwithdotteddatadir.php
index d2e5e2e97aff8a84bd046410f1d5091036eb6373..3a733b7b4693a77599bad74c418d88a0790665a9 100644
--- a/tests/lib/files/storage/mappedlocalwithdotteddatadir.php
+++ b/tests/lib/files/storage/mappedlocalwithdotteddatadir.php
@@ -28,15 +28,18 @@ class MappedLocalWithDottedDataDir extends Storage {
 	 */
 	private $tmpDir;
 
-	public function setUp() {
+	protected function setUp() {
+		parent::setUp();
+
 		$this->tmpDir = \OC_Helper::tmpFolder().'dir.123'.DIRECTORY_SEPARATOR;
 		mkdir($this->tmpDir);
 		$this->instance=new \OC\Files\Storage\MappedLocal(array('datadir'=>$this->tmpDir));
 	}
 
-	public function tearDown() {
+	protected function tearDown() {
 		\OC_Helper::rmdirr($this->tmpDir);
 		unset($this->instance);
+		parent::tearDown();
 	}
 }
 
diff --git a/tests/lib/files/storage/storage.php b/tests/lib/files/storage/storage.php
index 960eb137ea011ee836cc8d21f7f425ccf41f75c1..30f403d60df0a42f0b07e5859fb0b2f0dd6c43c3 100644
--- a/tests/lib/files/storage/storage.php
+++ b/tests/lib/files/storage/storage.php
@@ -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
 	 */
diff --git a/tests/lib/files/storage/wrapper/quota.php b/tests/lib/files/storage/wrapper/quota.php
index 954fe199cc88bc98f7e7cf5df19832fc476537f8..9e6b1c85a95f28e4a9cebe0dc6235a231c3e55ec 100644
--- a/tests/lib/files/storage/wrapper/quota.php
+++ b/tests/lib/files/storage/wrapper/quota.php
@@ -17,14 +17,17 @@ class Quota extends \Test\Files\Storage\Storage {
 	 */
 	private $tmpDir;
 
-	public function setUp() {
+	protected function setUp() {
+		parent::setUp();
+
 		$this->tmpDir = \OC_Helper::tmpFolder();
 		$storage = new \OC\Files\Storage\Local(array('datadir' => $this->tmpDir));
 		$this->instance = new \OC\Files\Storage\Wrapper\Quota(array('storage' => $storage, 'quota' => 10000000));
 	}
 
-	public function tearDown() {
+	protected function tearDown() {
 		\OC_Helper::rmdirr($this->tmpDir);
+		parent::tearDown();
 	}
 
 	/**
diff --git a/tests/lib/files/storage/wrapper/wrapper.php b/tests/lib/files/storage/wrapper/wrapper.php
index 8bcf42035d4d60c152e71f2b7b291c92f1d15e1c..486cd0495c1c0dd4dbb05db43baa17c4750bb9cd 100644
--- a/tests/lib/files/storage/wrapper/wrapper.php
+++ b/tests/lib/files/storage/wrapper/wrapper.php
@@ -14,14 +14,17 @@ class Wrapper extends \Test\Files\Storage\Storage {
 	 */
 	private $tmpDir;
 
-	public function setUp() {
+	protected function setUp() {
+		parent::setUp();
+
 		$this->tmpDir = \OC_Helper::tmpFolder();
 		$storage = new \OC\Files\Storage\Local(array('datadir' => $this->tmpDir));
 		$this->instance = new \OC\Files\Storage\Wrapper\Wrapper(array('storage' => $storage));
 	}
 
-	public function tearDown() {
+	protected function tearDown() {
 		\OC_Helper::rmdirr($this->tmpDir);
+		parent::tearDown();
 	}
 
 	public function testInstanceOfStorageWrapper() {
diff --git a/tests/lib/files/stream/quota.php b/tests/lib/files/stream/quota.php
index d5edace544da0ecfdb88c3f42a43607e2b4a618a..28584cf82db2779aadac0a2fab6e14326b71df48 100644
--- a/tests/lib/files/stream/quota.php
+++ b/tests/lib/files/stream/quota.php
@@ -8,9 +8,10 @@
 
 namespace Test\Files\Stream;
 
-class Quota extends \PHPUnit_Framework_TestCase {
-	public function tearDown() {
+class Quota extends \Test\TestCase {
+	protected function tearDown() {
 		\OC\Files\Stream\Quota::clear();
+		parent::tearDown();
 	}
 
 	/**
diff --git a/tests/lib/files/stream/staticstream.php b/tests/lib/files/stream/staticstream.php
index d55086196a005359229e566038a9408be8ebadde..416a4670efda724c5f34710da5441bd87fccda1c 100644
--- a/tests/lib/files/stream/staticstream.php
+++ b/tests/lib/files/stream/staticstream.php
@@ -8,18 +8,20 @@
 
 namespace Test\Files\Stream;
 
-class StaticStream extends \PHPUnit_Framework_TestCase {
+class StaticStream extends \Test\TestCase {
 
 	private $sourceFile;
 	private $sourceText;
 
-	public function __construct() {
+	protected function setUp() {
+		parent::setUp();
 		$this->sourceFile = \OC::$SERVERROOT . '/tests/data/lorem.txt';
 		$this->sourceText = file_get_contents($this->sourceFile);
 	}
 
-	public function tearDown() {
+	protected function tearDown() {
 		\OC\Files\Stream\StaticStream::clear();
+		parent::tearDown();
 	}
 
 	public function testContent() {
diff --git a/tests/lib/files/utils/scanner.php b/tests/lib/files/utils/scanner.php
index db6a3fa78427ea1b36e0676c0592f9880fa6b3fa..f729be81bd7d4f404785e177a24f15dc314910eb 100644
--- a/tests/lib/files/utils/scanner.php
+++ b/tests/lib/files/utils/scanner.php
@@ -38,7 +38,6 @@ class TestScanner extends \OC\Files\Utils\Scanner {
 	}
 }
 
-
 class Scanner extends \Test\TestCase {
 	/** @var \OC\Files\Storage\Storage */
 	private $originalStorage;
diff --git a/tests/lib/files/view.php b/tests/lib/files/view.php
index 44fea65e64ec731e1919bd1e3211b3cd779cf388..d6dd176bba955d3c2c50582aed4b9ae6011babc6 100644
--- a/tests/lib/files/view.php
+++ b/tests/lib/files/view.php
@@ -16,7 +16,7 @@ class TemporaryNoTouch extends \OC\Files\Storage\Temporary {
 	}
 }
 
-class View extends \PHPUnit_Framework_TestCase {
+class View extends \Test\TestCase {
 	/**
 	 * @var \OC\Files\Storage\Storage[] $storages
 	 */
diff --git a/tests/lib/geo.php b/tests/lib/geo.php
index 1c56a976129fdb67810643cdc3745e3365d4871f..0678297b55ac2a4629362e58e96d1738e9cb801c 100644
--- a/tests/lib/geo.php
+++ b/tests/lib/geo.php
@@ -6,7 +6,7 @@
  * See the COPYING-README file.
  */
 
-class Test_Geo extends PHPUnit_Framework_TestCase {
+class Test_Geo extends \Test\TestCase {
 	
 	/**
 	 * @medium
diff --git a/tests/lib/group/group.php b/tests/lib/group/group.php
index 4d15999a8261b4fda30e1bc0716258285d4b616f..d758e5959d03d7d69d9b0524dd6ad5dff17c023e 100644
--- a/tests/lib/group/group.php
+++ b/tests/lib/group/group.php
@@ -11,7 +11,7 @@ namespace Test\Group;
 
 use OC\User\User;
 
-class Group extends \PHPUnit_Framework_TestCase {
+class Group extends \Test\TestCase {
 	/**
 	 * @return \OC\User\Manager | \OC\User\Manager
 	 */
diff --git a/tests/lib/group/manager.php b/tests/lib/group/manager.php
index 8fd19513c0a66831fa87e9ce28396c74822ec089..f72ea8e912f982a5510455df926f30a6c3f6cd34 100644
--- a/tests/lib/group/manager.php
+++ b/tests/lib/group/manager.php
@@ -11,7 +11,7 @@ namespace Test\Group;
 
 use OC\User\User;
 
-class Manager extends \PHPUnit_Framework_TestCase {
+class Manager extends \Test\TestCase {
 	public function testGet() {
 		/**
 		 * @var \PHPUnit_Framework_MockObject_MockObject | \OC_Group_Backend $backend
diff --git a/tests/lib/group/metadata.php b/tests/lib/group/metadata.php
index 7ef2d6b35ff0b524ba2cec54f232de2db1b1e096..94944189cadc5a13c684c28638d4dee4ecf662fc 100644
--- a/tests/lib/group/metadata.php
+++ b/tests/lib/group/metadata.php
@@ -9,7 +9,7 @@
 
 namespace Test\Group;
 
-class Test_MetaData extends \PHPUnit_Framework_TestCase {
+class Test_MetaData extends \Test\TestCase {
 	private function getGroupManagerMock() {
 		return $this->getMockBuilder('\OC\Group\Manager')
 			->disableOriginalConstructor()
diff --git a/tests/lib/helper.php b/tests/lib/helper.php
index 57c72c11987bf7af3650c9b241215e144f12fa6c..53a3e1a0ec82c86934d07b2ebc00b36bfe865288 100644
--- a/tests/lib/helper.php
+++ b/tests/lib/helper.php
@@ -6,7 +6,7 @@
  * See the COPYING-README file.
  */
 
-class Test_Helper extends PHPUnit_Framework_TestCase {
+class Test_Helper extends \Test\TestCase {
 
 	/**
 	 * @dataProvider humanFileSizeProvider
diff --git a/tests/lib/hooks/basicemitter.php b/tests/lib/hooks/basicemitter.php
index 0eae730d03056f2e159b0dc228301433043511c4..899d3ecd3b3eb4cb3190b9ab30e687ef77c212f7 100644
--- a/tests/lib/hooks/basicemitter.php
+++ b/tests/lib/hooks/basicemitter.php
@@ -31,13 +31,14 @@ class DummyEmitter extends \OC\Hooks\BasicEmitter {
 class EmittedException extends \Exception {
 }
 
-class BasicEmitter extends \PHPUnit_Framework_TestCase {
+class BasicEmitter extends \Test\TestCase {
 	/**
 	 * @var \OC\Hooks\Emitter $emitter
 	 */
 	protected $emitter;
 
-	public function setUp() {
+	protected function setUp() {
+		parent::setUp();
 		$this->emitter = new DummyEmitter();
 	}
 
diff --git a/tests/lib/hooks/legacyemitter.php b/tests/lib/hooks/legacyemitter.php
index a7bed879a722959414bee8752688ceb0f0fcfeda..f030afbc09025ac532bac0c44435d3f454f0059c 100644
--- a/tests/lib/hooks/legacyemitter.php
+++ b/tests/lib/hooks/legacyemitter.php
@@ -26,7 +26,9 @@ class LegacyEmitter extends BasicEmitter {
 	//we can't use exceptions here since OC_Hooks catches all exceptions
 	private static $emitted = false;
 
-	public function setUp() {
+	protected function setUp() {
+		parent::setUp();
+
 		$this->emitter = new DummyLegacyEmitter();
 		self::$emitted = false;
 		\OC_Hook::clear('Test','test');
diff --git a/tests/lib/httphelper.php b/tests/lib/httphelper.php
index 191200aee3d492219efda30d026fdbab2be7dd0f..34dee35fe0295db1bcb5357251f14a8e21dcb4a5 100644
--- a/tests/lib/httphelper.php
+++ b/tests/lib/httphelper.php
@@ -6,14 +6,16 @@
  * See the COPYING-README file.
  */
 
-class TestHTTPHelper extends \PHPUnit_Framework_TestCase {
+class TestHTTPHelper extends \Test\TestCase {
 
 	/** @var \OC\AllConfig*/
 	private $config;
 	/** @var \OC\HTTPHelper */
 	private $httpHelperMock;
 
-	function setUp() {
+	protected function setUp() {
+		parent::setUp();
+
 		$this->config = $this->getMockBuilder('\OC\AllConfig')
 			->disableOriginalConstructor()->getMock();
 		$this->httpHelperMock = $this->getMockBuilder('\OC\HTTPHelper')
diff --git a/tests/lib/image.php b/tests/lib/image.php
index a683c3d2c8b674b66f93dd639249fe1248adb310..e0009b9710ebf260f2c7de09e52f8aa6641436be 100644
--- a/tests/lib/image.php
+++ b/tests/lib/image.php
@@ -6,10 +6,12 @@
  * See the COPYING-README file.
  */
 
-class Test_Image extends PHPUnit_Framework_TestCase {
+class Test_Image extends \Test\TestCase {
 	public static function tearDownAfterClass() {
 		@unlink(OC::$SERVERROOT.'/tests/data/testimage2.png');
 		@unlink(OC::$SERVERROOT.'/tests/data/testimage2.jpg');
+
+		parent::tearDownAfterClass();
 	}
 
 	public function testGetMimeTypeForFile() {
diff --git a/tests/lib/installer.php b/tests/lib/installer.php
index 5e267245200eb6204b4439491eab2e212a17722f..b58a71b5a08d64e564c07dfb6307d9f9f96e1c37 100644
--- a/tests/lib/installer.php
+++ b/tests/lib/installer.php
@@ -6,20 +6,24 @@
  * See the COPYING-README file.
  */
 
-class Test_Installer extends PHPUnit_Framework_TestCase {
+class Test_Installer extends \Test\TestCase {
 
 	private static $appid = 'testapp';
 	private $appstore;
 
-	public function setUp() {
+	protected function setUp() {
+		parent::setUp();
+
 		$this->appstore = OC_Config::getValue('appstoreenabled', true);
 		OC_Config::setValue('appstoreenabled', true);
 		OC_Installer::removeApp(self::$appid);
 	}
 
-	public function tearDown() {
+	protected function tearDown() {
 		OC_Installer::removeApp(self::$appid);
 		OC_Config::setValue('appstoreenabled', $this->appstore);
+
+		parent::tearDown();
 	}
 
 	public function testInstallApp() {
diff --git a/tests/lib/l10n.php b/tests/lib/l10n.php
index df86fcfda81abf0cf752e27c88d2f92646afd5f3..68f43b76f518348f95db2e38cec9de63065e0bab 100644
--- a/tests/lib/l10n.php
+++ b/tests/lib/l10n.php
@@ -6,7 +6,7 @@
  * See the COPYING-README file.
  */
 
-class Test_L10n extends PHPUnit_Framework_TestCase {
+class Test_L10n extends \Test\TestCase {
 
 	public function testGermanPluralTranslations() {
 		$l = new OC_L10N('test');
diff --git a/tests/lib/largefilehelper.php b/tests/lib/largefilehelper.php
index 5db1f9c5a74bbd5f077423059c6cd9b0ffad07af..1267a8c5833901c524148932261ae922a6fd292a 100644
--- a/tests/lib/largefilehelper.php
+++ b/tests/lib/largefilehelper.php
@@ -8,10 +8,10 @@
 
 namespace Test;
 
-class LargeFileHelper extends \PHPUnit_Framework_TestCase {
+class LargeFileHelper extends TestCase {
 	protected $helper;
 
-	public function setUp() {
+	protected function setUp() {
 		parent::setUp();
 		$this->helper = new \OC\LargeFileHelper;
 	}
diff --git a/tests/lib/largefilehelpergetfilesize.php b/tests/lib/largefilehelpergetfilesize.php
index 90ecc3dde708d51cc75506aa6e8529af28344c89..c97b7b32b0faae8cba3904f78fdc6e7bd33e3f7f 100644
--- a/tests/lib/largefilehelpergetfilesize.php
+++ b/tests/lib/largefilehelpergetfilesize.php
@@ -12,11 +12,11 @@ namespace Test;
 * Tests whether LargeFileHelper is able to determine file size at all.
 * Large files are not considered yet.
 */
-class LargeFileHelperGetFileSize extends \PHPUnit_Framework_TestCase {
+class LargeFileHelperGetFileSize extends TestCase {
 	/** @var \OC\LargeFileHelper */
 	protected $helper;
 
-	public function setUp() {
+	protected function setUp() {
 		parent::setUp();
 		$this->helper = new \OC\LargeFileHelper();
 	}
diff --git a/tests/lib/logger.php b/tests/lib/logger.php
index fcdf5b586706d5117b316ee28b71b6cbd549e69d..700a847917b9baea1cb697a1fd208211bd2d99d4 100644
--- a/tests/lib/logger.php
+++ b/tests/lib/logger.php
@@ -10,14 +10,16 @@ namespace Test;
 
 use OC\Log;
 
-class Logger extends \PHPUnit_Framework_TestCase {
+class Logger extends TestCase {
 	/**
 	 * @var \OCP\ILogger
 	 */
 	private $logger;
 	static private $logs = array();
 
-	public function setUp() {
+	protected function setUp() {
+		parent::setUp();
+
 		self::$logs = array();
 		$this->logger = new Log('Test\Logger');
 	}
diff --git a/tests/lib/mail.php b/tests/lib/mail.php
index 3cc9868e25e876fb48be8cd7afc0123f5ab730a1..568ecff52b0636189d0c0aa09ea0cef4d8e5480b 100644
--- a/tests/lib/mail.php
+++ b/tests/lib/mail.php
@@ -6,10 +6,12 @@
  * See the COPYING-README file.
  */
 
-class Test_Mail extends PHPUnit_Framework_TestCase {
+class Test_Mail extends \Test\TestCase {
 
 	protected function setUp()
 	{
+		parent::setUp();
+
 		if (!function_exists('idn_to_ascii')) {
 			$this->markTestSkipped(
 				'The intl extension is not available.'
diff --git a/tests/lib/memcache/apc.php b/tests/lib/memcache/apc.php
index e5d753a4fa5e27381651fd1643238bc0eaacadd4..550d5068dc1fe9854421c5aaa9f64438608f20a4 100644
--- a/tests/lib/memcache/apc.php
+++ b/tests/lib/memcache/apc.php
@@ -10,7 +10,9 @@
 namespace Test\Memcache;
 
 class APC extends Cache {
-	public function setUp() {
+	protected function setUp() {
+		parent::setUp();
+
 		if(!\OC\Memcache\APC::isAvailable()) {
 			$this->markTestSkipped('The apc extension is not available.');
 			return;
diff --git a/tests/lib/memcache/apcu.php b/tests/lib/memcache/apcu.php
index 7b99e7cd5e0fcd95fe2d03ff22f2aeedf23b95a4..1b849e1c54d5eb17ab37b1383166164548c6cf07 100644
--- a/tests/lib/memcache/apcu.php
+++ b/tests/lib/memcache/apcu.php
@@ -10,7 +10,9 @@
 namespace Test\Memcache;
 
 class APCu extends Cache {
-	public function setUp() {
+	protected function setUp() {
+		parent::setUp();
+
 		if(!\OC\Memcache\APCu::isAvailable()) {
 			$this->markTestSkipped('The APCu extension is not available.');
 			return;
diff --git a/tests/lib/memcache/cache.php b/tests/lib/memcache/cache.php
index d07c492cef01d05814e7fd76d5cf3025ce2ec0cb..8a4a708e4b7588fcb91efbd865faa92fdf1059fc 100644
--- a/tests/lib/memcache/cache.php
+++ b/tests/lib/memcache/cache.php
@@ -50,9 +50,11 @@ abstract class Cache extends \Test_Cache {
 		$this->assertFalse($this->instance->hasKey('foo'));
 	}
 
-	public function tearDown() {
+	protected function tearDown() {
 		if ($this->instance) {
 			$this->instance->clear();
 		}
+
+		parent::tearDown();
 	}
 }
diff --git a/tests/lib/memcache/memcached.php b/tests/lib/memcache/memcached.php
index fdab32693ff8d9c81bf81a2b0ef99f6b8d299569..a94b809a7b558d88c094f05159172b5b3ecb2407 100644
--- a/tests/lib/memcache/memcached.php
+++ b/tests/lib/memcache/memcached.php
@@ -11,6 +11,8 @@ namespace Test\Memcache;
 
 class Memcached extends Cache {
 	static public function setUpBeforeClass() {
+		parent::setUpBeforeClass();
+
 		if (!\OC\Memcache\Memcached::isAvailable()) {
 			self::markTestSkipped('The memcached extension is not available.');
 		}
@@ -20,7 +22,8 @@ class Memcached extends Cache {
 		}
 	}
 
-	public function setUp() {
+	protected function setUp() {
+		parent::setUp();
 		$this->instance = new \OC\Memcache\Memcached(uniqid());
 	}
 }
diff --git a/tests/lib/memcache/xcache.php b/tests/lib/memcache/xcache.php
index f59afda396664ec1c63e94a7c37816a80cd21ba1..b97d5545c6e412e490692175e707ceca5ac32944 100644
--- a/tests/lib/memcache/xcache.php
+++ b/tests/lib/memcache/xcache.php
@@ -10,7 +10,9 @@
 namespace Test\Memcache;
 
 class XCache extends Cache {
-	public function setUp() {
+	protected function setUp() {
+		parent::setUp();
+
 		if (!\OC\Memcache\XCache::isAvailable()) {
 			$this->markTestSkipped('The xcache extension is not available.');
 			return;
diff --git a/tests/lib/migrate.php b/tests/lib/migrate.php
index 3f87bbc1ac8b83e4c6c7035cae25aaa74b87a92a..9c1e980c445189f01e9fc66af22fb73db69fbe71 100644
--- a/tests/lib/migrate.php
+++ b/tests/lib/migrate.php
@@ -6,7 +6,7 @@
  * See the COPYING-README file.
  */
 
-class Test_Migrate extends PHPUnit_Framework_TestCase {
+class Test_Migrate extends \Test\TestCase {
 
 	public $users;
 	public $tmpfiles = array();
@@ -38,7 +38,7 @@ class Test_Migrate extends PHPUnit_Framework_TestCase {
 	 * @return string the test users id
 	 */
 	public function generateUser() {
-		$username = uniqid();
+		$username = $this->getUniqueID();
 		\OC_User::createUser($username, 'password');
 		\OC_Util::tearDownFS();
 		\OC_User::setUserId('');
diff --git a/tests/lib/naturalsort.php b/tests/lib/naturalsort.php
index 09a0e6a5f9d7454555917a9b8b57358399e197ac..e022a85530918078264a7dc4fed476593edce3d0 100644
--- a/tests/lib/naturalsort.php
+++ b/tests/lib/naturalsort.php
@@ -6,9 +6,11 @@
  * See the COPYING-README file.
  */
 
-class Test_NaturalSort extends PHPUnit_Framework_TestCase {
+class Test_NaturalSort extends \Test\TestCase {
 
 	public function setUp() {
+		parent::setUp();
+
 		if(!class_exists('Collator')) {
 			$this->markTestSkipped('The intl module is not available, natural sorting will not work as expected.');
 			return;
diff --git a/tests/lib/ocs/privatedata.php b/tests/lib/ocs/privatedata.php
index 534fc21b07aa2e28cbf9c09a33a24098252478f5..20f1dd3836282176d67ea9aa7dbe4923631dc6cd 100644
--- a/tests/lib/ocs/privatedata.php
+++ b/tests/lib/ocs/privatedata.php
@@ -20,19 +20,15 @@
  *
  */
 
-class Test_OC_OCS_Privatedata extends PHPUnit_Framework_TestCase
-{
-
+class Test_OC_OCS_Privatedata extends \Test\TestCase {
 	private $appKey;
 
-	public function setUp() {
+	protected function setUp() {
+		parent::setUp();
 		\OC::$server->getSession()->set('user_id', 'user1');
 		$this->appKey = uniqid('app');
 	}
 
-	public function tearDown() {
-	}
-
 	public function testGetEmptyOne() {
 		$params = array('app' => $this->appKey, 'key' => '123');
 		$result = OC_OCS_Privatedata::get($params);
diff --git a/tests/lib/preferences-singleton.php b/tests/lib/preferences-singleton.php
index 7abf5a6be3618160b83756f741c7239dcedaddb9..01e15acdfe109d52492670eb889a83baef937557 100644
--- a/tests/lib/preferences-singleton.php
+++ b/tests/lib/preferences-singleton.php
@@ -7,8 +7,10 @@
  * See the COPYING-README file.
  */
 
-class Test_Preferences extends PHPUnit_Framework_TestCase {
+class Test_Preferences extends \Test\TestCase {
 	public static function setUpBeforeClass() {
+		parent::setUpBeforeClass();
+
 		$query = \OC_DB::prepare('INSERT INTO `*PREFIX*preferences` VALUES(?, ?, ?, ?)');
 		$query->execute(array("Someuser", "someapp", "somekey", "somevalue"));
 
@@ -34,6 +36,8 @@ class Test_Preferences extends PHPUnit_Framework_TestCase {
 		$query->execute(array('Someuser'));
 		$query->execute(array('Anotheruser'));
 		$query->execute(array('Anuser'));
+
+		parent::tearDownAfterClass();
 	}
 
 	public function testGetUsers() {
diff --git a/tests/lib/preferences.php b/tests/lib/preferences.php
index fe8e3e8b48c3ddd33816c3369c52622d1516161e..193b1f8028020bad4cb6ea769b56edfbe9bbff44 100644
--- a/tests/lib/preferences.php
+++ b/tests/lib/preferences.php
@@ -7,7 +7,7 @@
  * See the COPYING-README file.
  */
 
-class Test_Preferences_Object extends PHPUnit_Framework_TestCase {
+class Test_Preferences_Object extends \Test\TestCase {
 	public function testGetUsers()
 	{
 		$statementMock = $this->getMock('\Doctrine\DBAL\Statement', array(), array(), '', false);
diff --git a/tests/lib/preview.php b/tests/lib/preview.php
index 288dd2aa417505ce36f1634d83851cbb3ec5c22f..2a6761403f452bf21b80ffef9c230f8e78b1bdbb 100644
--- a/tests/lib/preview.php
+++ b/tests/lib/preview.php
@@ -8,7 +8,7 @@
 
 namespace Test;
 
-class Preview extends \Test\TestCase {
+class Preview extends TestCase {
 
 	/**
 	 * @var string
diff --git a/tests/lib/public/contacts.php b/tests/lib/public/contacts.php
index d6008876a0042094d3e1b1bbd3aa87a7f86cff58..151e98d39053bbe86f2ad40070e52262d68ec780 100644
--- a/tests/lib/public/contacts.php
+++ b/tests/lib/public/contacts.php
@@ -19,17 +19,12 @@
  * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-class Test_Contacts extends PHPUnit_Framework_TestCase
-{
-
-	public function setUp() {
-
+class Test_Contacts extends \Test\TestCase {
+	protected function setUp() {
+		parent::setUp();
 		OCP\Contacts::clear();
 	}
 
-	public function tearDown() {
-	}
-
 	public function testDisabledIfEmpty() {
 		// pretty simple
 		$this->assertFalse(OCP\Contacts::isEnabled());
diff --git a/tests/lib/public/ocpconfig.php b/tests/lib/public/ocpconfig.php
index 43a9ca625eecc149349edba5a6a974c2a661ad58..947d2b3c9ef39736dd40a0125e268e7a8aac6f72 100644
--- a/tests/lib/public/ocpconfig.php
+++ b/tests/lib/public/ocpconfig.php
@@ -19,12 +19,11 @@
  * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-class Test_OCPConfig extends PHPUnit_Framework_TestCase
-{
+class Test_OCPConfig extends \Test\TestCase {
 
 	public function testSetAppValueIfSetToNull() {
 
-		$key = uniqid("key-");
+		$key = $this->getUniqueID('key-');
 
 		$result = \OCP\Config::setAppValue('unit-test', $key, null);
 		$this->assertTrue($result);
diff --git a/tests/lib/repair.php b/tests/lib/repair.php
index 121f41dedd92625aa4f496390eb3b61e0bac24c9..248db382140cec371511b928f34bd39490546f93 100644
--- a/tests/lib/repair.php
+++ b/tests/lib/repair.php
@@ -29,7 +29,7 @@ class TestRepairStep extends BasicEmitter implements \OC\RepairStep{
 	}
 }
 
-class Test_Repair extends PHPUnit_Framework_TestCase {
+class Test_Repair extends \Test\TestCase {
 	public function testRunRepairStep() {
 		$output = array();
 
diff --git a/tests/lib/repair/repaircollation.php b/tests/lib/repair/repaircollation.php
index 362feb8463f1f581006202cae17b0b16d230ea31..e711fcd9d831cc4bdfe888ac339e3c44f7f1ab36 100644
--- a/tests/lib/repair/repaircollation.php
+++ b/tests/lib/repair/repaircollation.php
@@ -21,7 +21,7 @@ class TestCollationRepair extends \OC\Repair\Collation {
  *
  * @see \OC\Repair\RepairMimeTypes
  */
-class TestRepairCollation extends PHPUnit_Framework_TestCase {
+class TestRepairCollation extends \Test\TestCase {
 
 	/**
 	 * @var TestCollationRepair
@@ -43,7 +43,9 @@ class TestRepairCollation extends PHPUnit_Framework_TestCase {
 	 */
 	private $config;
 
-	public function setUp() {
+	protected function setUp() {
+		parent::setUp();
+
 		$this->connection = \OC_DB::getConnection();
 		$this->config = \OC::$server->getConfig();
 		if (!$this->connection->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\MySqlPlatform) {
@@ -57,8 +59,9 @@ class TestRepairCollation extends PHPUnit_Framework_TestCase {
 		$this->repair = new TestCollationRepair($this->config, $this->connection);
 	}
 
-	public function tearDown() {
+	protected function tearDown() {
 		$this->connection->getSchemaManager()->dropTable($this->tableName);
+		parent::tearDown();
 	}
 
 	public function testCollationConvert() {
diff --git a/tests/lib/repair/repairinnodb.php b/tests/lib/repair/repairinnodb.php
index e7d2442f127ff37f0299003ec667be58da50a5d5..21d7d97882139e6458b8d0988e9d7fcd2b6243b2 100644
--- a/tests/lib/repair/repairinnodb.php
+++ b/tests/lib/repair/repairinnodb.php
@@ -11,7 +11,7 @@
  *
  * @see \OC\Repair\RepairMimeTypes
  */
-class TestRepairInnoDB extends PHPUnit_Framework_TestCase {
+class TestRepairInnoDB extends \Test\TestCase {
 
 	/** @var \OC\RepairStep */
 	private $repair;
@@ -22,7 +22,9 @@ class TestRepairInnoDB extends PHPUnit_Framework_TestCase {
 	/** @var string */
 	private $tableName;
 
-	public function setUp() {
+	protected function setUp() {
+		parent::setUp();
+
 		$this->connection = \OC_DB::getConnection();
 		if (!$this->connection->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\MySqlPlatform) {
 			$this->markTestSkipped("Test only relevant on MySql");
@@ -35,8 +37,9 @@ class TestRepairInnoDB extends PHPUnit_Framework_TestCase {
 		$this->repair = new \OC\Repair\InnoDB();
 	}
 
-	public function tearDown() {
+	protected function tearDown() {
 		$this->connection->getSchemaManager()->dropTable($this->tableName);
+		parent::tearDown();
 	}
 
 	public function testInnoDBConvert() {
diff --git a/tests/lib/repair/repairlegacystorage.php b/tests/lib/repair/repairlegacystorage.php
index 4528c5288df65739a0c40a492139d7c96997f356..ac845657cd94ea926b9be5867d243112662e657f 100644
--- a/tests/lib/repair/repairlegacystorage.php
+++ b/tests/lib/repair/repairlegacystorage.php
@@ -11,7 +11,7 @@
  *
  * @see \OC\Repair\RepairLegacyStorages
  */
-class TestRepairLegacyStorages extends PHPUnit_Framework_TestCase {
+class TestRepairLegacyStorages extends \Test\TestCase {
 
 	private $user;
 	private $repair;
@@ -22,7 +22,9 @@ class TestRepairLegacyStorages extends PHPUnit_Framework_TestCase {
 	private $legacyStorageId;
 	private $newStorageId;
 
-	public function setUp() {
+	protected function setUp() {
+		parent::setUp();
+
 		$this->config = \OC::$server->getConfig();
 		$this->connection = \OC_DB::getConnection();
 		$this->oldDataDir = $this->config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data/');
@@ -30,7 +32,7 @@ class TestRepairLegacyStorages extends PHPUnit_Framework_TestCase {
 		$this->repair = new \OC\Repair\RepairLegacyStorages($this->config, $this->connection);
 	}
 
-	public function tearDown() {
+	protected function tearDown() {
 		\OC_User::deleteUser($this->user);
 
 		$sql = 'DELETE FROM `*PREFIX*storages`';
@@ -39,6 +41,8 @@ class TestRepairLegacyStorages extends PHPUnit_Framework_TestCase {
 		$this->connection->executeQuery($sql);
 		\OCP\Config::setSystemValue('datadirectory', $this->oldDataDir);
 		$this->config->setAppValue('core', 'repairlegacystoragesdone', 'no');
+
+		parent::tearDown();
 	}
 
 	function prepareSettings($dataDir, $userId) {
diff --git a/tests/lib/repair/repairmimetypes.php b/tests/lib/repair/repairmimetypes.php
index 7754864a69e768b405225df45e91b3cedbbd9638..6eaf68d8a44d67ddb9c45feba3d6862e230a71b3 100644
--- a/tests/lib/repair/repairmimetypes.php
+++ b/tests/lib/repair/repairmimetypes.php
@@ -11,26 +11,29 @@
  *
  * @see \OC\Repair\RepairMimeTypes
  */
-class TestRepairMimeTypes extends PHPUnit_Framework_TestCase {
+class TestRepairMimeTypes extends \Test\TestCase {
 
 	/** @var \OC\RepairStep */
 	private $repair;
 
 	private $storage;
 
-	public function setUp() {
+	protected function setUp() {
+		parent::setUp();
 		$this->storage = new \OC\Files\Storage\Temporary(array());
 
 		$this->repair = new \OC\Repair\RepairMimeTypes();
 	}
 
-	public function tearDown() {
+	protected function tearDown() {
 		$this->storage->getCache()->clear();
 		$sql = 'DELETE FROM `*PREFIX*storages` WHERE `id` = ?';
 		\OC_DB::executeAudited($sql, array($this->storage->getId()));
 		$this->clearMimeTypes();
 
 		DummyFileCache::clearCachedMimeTypes();
+
+		parent::tearDown();
 	}
 
 	private function clearMimeTypes() {
diff --git a/tests/lib/request.php b/tests/lib/request.php
index 2760377fa48d92755432d93d9cbbc788765df469..254048723e75a971aa5516cd27319b7bf6814ade 100644
--- a/tests/lib/request.php
+++ b/tests/lib/request.php
@@ -6,19 +6,23 @@
  * See the COPYING-README file.
  */
 
-class Test_Request extends PHPUnit_Framework_TestCase {
+class Test_Request extends \Test\TestCase {
+
+	protected function setUp() {
+		parent::setUp();
 
-	public function setUp() {
 		OC::$server->getConfig()->setSystemValue('overwritewebroot', '/domain.tld/ownCloud');
 
 		OC::$server->getConfig()->setSystemValue('trusted_proxies', array());
 		OC::$server->getConfig()->setSystemValue('forwarded_for_headers', array());
 	}
 
-	public function tearDown() {
+	protected function tearDown() {
 		OC::$server->getConfig()->setSystemValue('overwritewebroot', '');
 		OC::$server->getConfig()->setSystemValue('trusted_proxies', array());
 		OC::$server->getConfig()->setSystemValue('forwarded_for_headers', array());
+
+		parent::tearDown();
 	}
 
 	public function testScriptNameOverWrite() {
diff --git a/tests/lib/security/certificate.php b/tests/lib/security/certificate.php
index 898f583a43cb8e592213f8cf3af4c9d71eabcf36..361f2f8c38dffaae2228e03f958951df0e063273 100644
--- a/tests/lib/security/certificate.php
+++ b/tests/lib/security/certificate.php
@@ -8,7 +8,7 @@
 
 use \OC\Security\Certificate;
 
-class CertificateTest extends \PHPUnit_Framework_TestCase {
+class CertificateTest extends \Test\TestCase {
 
 	/** @var Certificate That contains a valid certificate */
 	protected $goodCertificate;
@@ -17,7 +17,9 @@ class CertificateTest extends \PHPUnit_Framework_TestCase {
 	/** @var Certificate That contains an expired certificate */
 	protected $expiredCertificate;
 
-	function setUp() {
+	protected function setUp() {
+		parent::setUp();
+
 		$goodCertificate = file_get_contents(__DIR__ . '/../../data/certificates/goodCertificate.crt');
 		$this->goodCertificate = new Certificate($goodCertificate, 'GoodCertificate');
 		$badCertificate = file_get_contents(__DIR__ . '/../../data/certificates/badCertificate.crt');
diff --git a/tests/lib/security/certificatemanager.php b/tests/lib/security/certificatemanager.php
index 01b3afb03ee806c78e8d22f9fa833a7f406a7732..cff6932b67029006d2dda972aca0b46dcf4d4136 100644
--- a/tests/lib/security/certificatemanager.php
+++ b/tests/lib/security/certificatemanager.php
@@ -17,7 +17,9 @@ class CertificateManagerTest extends \Test\TestCase {
 	/** @var  \OC\User\User */
 	private $user;
 
-	function setUp() {
+	protected function setUp() {
+		parent::setUp();
+
 		$this->username = $this->getUniqueID('', 20);
 		OC_User::createUser($this->username, $this->getUniqueID('', 20));
 
@@ -31,8 +33,9 @@ class CertificateManagerTest extends \Test\TestCase {
 		$this->certificateManager = new CertificateManager($this->user);
 	}
 
-	function tearDown() {
+	protected function tearDown() {
 		\OC_User::deleteUser($this->username);
+		parent::tearDown();
 	}
 
 	protected function assertEqualsArrays($expected, $actual) {
diff --git a/tests/lib/security/crypto.php b/tests/lib/security/crypto.php
index 0f89253839edca7d875ad64f51ebcc97550e8010..1571cf89248433b16f781461bba07060c32aa480 100644
--- a/tests/lib/security/crypto.php
+++ b/tests/lib/security/crypto.php
@@ -8,7 +8,7 @@
 
 use \OC\Security\Crypto;
 
-class CryptoTest extends \PHPUnit_Framework_TestCase {
+class CryptoTest extends \Test\TestCase {
 
 	public function defaultEncryptionProvider()
 	{
@@ -23,6 +23,7 @@ class CryptoTest extends \PHPUnit_Framework_TestCase {
 	protected $crypto;
 
 	protected function setUp() {
+		parent::setUp();
 		$this->crypto = new Crypto(\OC::$server->getConfig(), \OC::$server->getSecureRandom());
 	}
 
diff --git a/tests/lib/security/securerandom.php b/tests/lib/security/securerandom.php
index 2920077fa1d9cd28b35f6d92f9380be13ac664b7..d9bbd0e71e573681fa7e49f1bef826c28d0a8bee 100644
--- a/tests/lib/security/securerandom.php
+++ b/tests/lib/security/securerandom.php
@@ -8,7 +8,7 @@
 
 use \OC\Security\SecureRandom;
 
-class SecureRandomTest extends \PHPUnit_Framework_TestCase {
+class SecureRandomTest extends \Test\TestCase {
 
 	public function stringGenerationProvider() {
 		return array(
@@ -34,6 +34,7 @@ class SecureRandomTest extends \PHPUnit_Framework_TestCase {
 	protected $rng;
 
 	protected function setUp() {
+		parent::setUp();
 		$this->rng = new \OC\Security\SecureRandom();
 	}
 
diff --git a/tests/lib/security/stringutils.php b/tests/lib/security/stringutils.php
index 039f3d3756a3dfe6e91091163e0d78e43c538799..060315debb49da2cf54a3599e9319854c6314b3b 100644
--- a/tests/lib/security/stringutils.php
+++ b/tests/lib/security/stringutils.php
@@ -8,7 +8,7 @@
 
 use \OC\Security\StringUtils;
 
-class StringUtilsTest extends \PHPUnit_Framework_TestCase {
+class StringUtilsTest extends \Test\TestCase {
 
 	public function dataProvider()
 	{
diff --git a/tests/lib/session/memory.php b/tests/lib/session/memory.php
index 2dc236b73bfa0db751cd241692f0fdfe004b8104..84dee548a1e7631226a1ad7e6353beea47eb0c6a 100644
--- a/tests/lib/session/memory.php
+++ b/tests/lib/session/memory.php
@@ -10,7 +10,8 @@
 namespace Test\Session;
 
 class Memory extends Session {
-	public function setUp() {
+	protected function setUp() {
+		parent::setUp();
 		$this->instance = new \OC\Session\Memory(uniqid());
 	}
 }
diff --git a/tests/lib/session/session.php b/tests/lib/session/session.php
index 9ce11274c840d6b715e9bd621625ec8272b916a3..a1ed01b2ec8f4d66022abc20deba782d0dbe53ba 100644
--- a/tests/lib/session/session.php
+++ b/tests/lib/session/session.php
@@ -9,14 +9,15 @@
 
 namespace Test\Session;
 
-abstract class Session extends \PHPUnit_Framework_TestCase {
+abstract class Session extends \Test\TestCase {
 	/**
 	 * @var \OC\Session\Session
 	 */
 	protected $instance;
 
-	public function tearDown() {
+	protected function tearDown() {
 		$this->instance->clear();
+		parent::tearDown();
 	}
 
 	public function testNotExistsEmpty() {
diff --git a/tests/lib/setup.php b/tests/lib/setup.php
index 2c1569dd8004b757e150bb9edd7517f0038986ed..8373ba316d695e8ee18ad7f014922c6ccca0e75a 100644
--- a/tests/lib/setup.php
+++ b/tests/lib/setup.php
@@ -8,14 +8,16 @@
 
 use OCP\IConfig;
 
-class Test_OC_Setup extends PHPUnit_Framework_TestCase {
+class Test_OC_Setup extends \Test\TestCase {
 
 	/** @var IConfig */
 	protected $config;
 	/** @var \OC_Setup */
 	protected $setupClass;
 
-	public function setUp() {
+	protected function setUp() {
+		parent::setUp();
+
 		$this->config = $this->getMock('\OCP\IConfig');
 		$this->setupClass = $this->getMock('\OC_Setup', array('class_exists', 'is_callable'), array($this->config));
 	}
diff --git a/tests/lib/share/helper.php b/tests/lib/share/helper.php
index 367507417a0857033972c6c43fc88e1ae5a23531..76046d360bc0cc24c825bc1a921a1da99372da60 100644
--- a/tests/lib/share/helper.php
+++ b/tests/lib/share/helper.php
@@ -19,7 +19,7 @@
 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-class Test_Share_Helper extends PHPUnit_Framework_TestCase {
+class Test_Share_Helper extends \Test\TestCase {
 
 	public function expireDateProvider() {
 		return array(
diff --git a/tests/lib/share/searchresultsorter.php b/tests/lib/share/searchresultsorter.php
index eaf93400a7d9b9ff0a99b2272c0a6560a890ea77..97ef0f9478ab42008ab64bf8b397e5cc57f3ff11 100644
--- a/tests/lib/share/searchresultsorter.php
+++ b/tests/lib/share/searchresultsorter.php
@@ -19,7 +19,7 @@
 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-class Test_Share_Search extends \PHPUnit_Framework_TestCase {
+class Test_Share_Search extends \Test\TestCase {
 	public function testSort() {
 		$search = 'lin';
 		$sorter = new \OC\Share\SearchResultSorter($search, 'foobar');
diff --git a/tests/lib/share/share.php b/tests/lib/share/share.php
index 7644dadadc722bfda1465a84a6be2605f13ab639..7ae458a797d6f833f4bea772ff91c9bd93ce0fa5 100644
--- a/tests/lib/share/share.php
+++ b/tests/lib/share/share.php
@@ -19,7 +19,7 @@
 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-class Test_Share extends Test\TestCase {
+class Test_Share extends \Test\TestCase {
 
 	protected $itemType;
 	protected $userBackend;
@@ -37,6 +37,7 @@ class Test_Share extends Test\TestCase {
 
 	protected function setUp() {
 		parent::setUp();
+
 		OC_User::clearBackends();
 		OC_User::useBackend('dummy');
 		$this->user1 = $this->getUniqueID('user1_');
@@ -81,6 +82,7 @@ class Test_Share extends Test\TestCase {
 		$query = OC_DB::prepare('DELETE FROM `*PREFIX*share` WHERE `item_type` = ?');
 		$query->execute(array('test'));
 		OC_Appconfig::setValue('core', 'shareapi_allow_resharing', $this->resharing);
+
 		parent::tearDown();
 	}
 
diff --git a/tests/lib/streamwrappers.php b/tests/lib/streamwrappers.php
index 6f92f4870374be5b40223a14a3967dfc9ac8b36c..9a3b6bc9266908ed251a7d0a2ef6b574bdf2a0ef 100644
--- a/tests/lib/streamwrappers.php
+++ b/tests/lib/streamwrappers.php
@@ -20,7 +20,7 @@
  *
  */
 
-class Test_StreamWrappers extends PHPUnit_Framework_TestCase {
+class Test_StreamWrappers extends \Test\TestCase {
 	public function testFakeDir() {
 		$items = array('foo', 'bar');
 		\OC\Files\Stream\Dir::register('test', $items);
diff --git a/tests/lib/tags.php b/tests/lib/tags.php
index 57b64f1cd3686a838d260c5aabba79edb4aaf300..ab714bde3dfef23fff7483cc8fb0b35f9ac00e97 100644
--- a/tests/lib/tags.php
+++ b/tests/lib/tags.php
@@ -20,13 +20,14 @@
 *
 */
 
-class Test_Tags extends PHPUnit_Framework_TestCase {
+class Test_Tags extends \Test\TestCase {
 
 	protected $objectType;
 	protected $user;
 	protected $backupGlobals = FALSE;
 
-	public function setUp() {
+	protected function setUp() {
+		parent::setUp();
 
 		OC_User::clearBackends();
 		OC_User::useBackend('dummy');
@@ -39,9 +40,11 @@ class Test_Tags extends PHPUnit_Framework_TestCase {
 
 	}
 
-	public function tearDown() {
+	protected function tearDown() {
 		//$query = OC_DB::prepare('DELETE FROM `*PREFIX*vcategories` WHERE `item_type` = ?');
 		//$query->execute(array('test'));
+
+		parent::tearDown();
 	}
 
 	public function testInstantiateWithDefaults() {
diff --git a/tests/lib/template.php b/tests/lib/template.php
index 819d592aacfb9235f2099a37d7cbb61c47345349..d77284a5bf263800ef9a0dd420d491b31d44a9f2 100644
--- a/tests/lib/template.php
+++ b/tests/lib/template.php
@@ -20,9 +20,11 @@
 *
 */
 
-class Test_TemplateFunctions extends PHPUnit_Framework_TestCase {
+class Test_TemplateFunctions extends \Test\TestCase {
+
+	protected function setUp() {
+		parent::setUp();
 
-	public function setUp() {
 		$loader = new \OC\Autoloader();
 		$loader->load('OC_Template');
 	}
diff --git a/tests/lib/template/resourcelocator.php b/tests/lib/template/resourcelocator.php
index cd354df003621addebe6ccdb80c42eed823b60bc..f350fd144e176b428cad6e04ce7ed84bd3cd5ee4 100644
--- a/tests/lib/template/resourcelocator.php
+++ b/tests/lib/template/resourcelocator.php
@@ -6,7 +6,7 @@
  * See the COPYING-README file.
  */
 
-class Test_ResourceLocator extends PHPUnit_Framework_TestCase {
+class Test_ResourceLocator extends \Test\TestCase {
 
 	/**
 	 * @param string $theme
diff --git a/tests/lib/templatelayout.php b/tests/lib/templatelayout.php
index 0335c7c88ee0800f8046085167af2ef609160316..1035dae122d90b966e5706c5d550c1ea2ab89411 100644
--- a/tests/lib/templatelayout.php
+++ b/tests/lib/templatelayout.php
@@ -11,23 +11,27 @@ namespace OC\Test;
 /**
  * @package OC\Test
  */
-class OC_TemplateLayout extends \PHPUnit_Framework_TestCase {
+class OC_TemplateLayout extends \Test\TestCase {
 
-	private $oldServerUri;
+	private $oldServerURI;
 	private $oldScriptName;
 
-	public function setUp() {
+	protected function setUp() {
+		parent::setUp();
+
 		$this->oldServerURI = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : null;
 		$this->oldScriptName = $_SERVER['SCRIPT_NAME'];
 	}
 
-	public function tearDown() {
+	protected function tearDown() {
 		if ($this->oldServerURI === null) {
 			unset($_SERVER['REQUEST_URI']);
 		} else {
 			$_SERVER['REQUEST_URI'] = $this->oldServerURI;
 		}
 		$_SERVER['SCRIPT_NAME'] = $this->oldScriptName;
+
+		parent::tearDown();
 	}
 
 	/**
diff --git a/tests/lib/tempmanager.php b/tests/lib/tempmanager.php
index 85b94094393e0897a5150cf934f2fa8a2568b639..05311e820a7ed85da50a83a723311264dc881a28 100644
--- a/tests/lib/tempmanager.php
+++ b/tests/lib/tempmanager.php
@@ -21,18 +21,21 @@ class NullLogger extends Log {
 	}
 }
 
-class TempManager extends \PHPUnit_Framework_TestCase {
+class TempManager extends \Test\TestCase {
 	protected $baseDir;
 
-	public function setUp() {
+	protected function setUp() {
+		parent::setUp();
+
 		$this->baseDir = get_temp_dir() . '/oc_tmp_test';
 		if (!is_dir($this->baseDir)) {
 			mkdir($this->baseDir);
 		}
 	}
 
-	public function tearDown() {
+	protected function tearDown() {
 		\OC_Helper::rmdirr($this->baseDir);
+		parent::tearDown();
 	}
 
 	/**
diff --git a/tests/lib/testcase.php b/tests/lib/testcase.php
index a4b4b0103f016c019d814f7c7f383a1b5c80abc3..315cd6858ed1afd66d565224fad89682e7dfc739 100644
--- a/tests/lib/testcase.php
+++ b/tests/lib/testcase.php
@@ -30,4 +30,14 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase {
 			'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
 		);
 	}
+
+	public static function tearDownAfterClass() {
+		if (\OC_Util::runningOnWindows()) {
+			$rootDirectory = \OC::$server->getConfig()->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data-autotest');
+			$mapper = new \OC\Files\Mapper($rootDirectory);
+			$mapper->removePath($rootDirectory, true, true);
+		}
+
+		parent::tearDownAfterClass();
+	}
 }
diff --git a/tests/lib/updater.php b/tests/lib/updater.php
index 4488744fa1ded3ac138948375cb8418253ecdf35..cc82450cfb6125beec240e5f0681c81dbc8309d7 100644
--- a/tests/lib/updater.php
+++ b/tests/lib/updater.php
@@ -8,7 +8,7 @@
 
 namespace OC;
 
-class UpdaterTest extends \PHPUnit_Framework_TestCase {
+class UpdaterTest extends \Test\TestCase {
 
 	public function testVersionCompatbility() {
 		return array(
diff --git a/tests/lib/urlgenerator.php b/tests/lib/urlgenerator.php
index 066272731ee207b0c1c47a8102cf71e02a378f63..a92aaddeb4c6048019a790d6e0b8c9560b0907c6 100644
--- a/tests/lib/urlgenerator.php
+++ b/tests/lib/urlgenerator.php
@@ -6,7 +6,7 @@
  * See the COPYING-README file.
  */
 
-class Test_Urlgenerator extends PHPUnit_Framework_TestCase {
+class Test_Urlgenerator extends \Test\TestCase {
 
 	/**
 	 * @small
diff --git a/tests/lib/user.php b/tests/lib/user.php
index e2c3282a19f4181e68ff5f92d8ac9969f34891be..cb0c661b2a489862789bc31214107b7817698f7d 100644
--- a/tests/lib/user.php
+++ b/tests/lib/user.php
@@ -9,13 +9,15 @@
 
 namespace Test;
 
-class User extends \PHPUnit_Framework_TestCase {
+class User extends TestCase {
 	/**
 	 * @var \OC_User_Backend | \PHPUnit_Framework_MockObject_MockObject $backend
 	 */
 	private $backend;
 	
 	protected function setUp(){
+		parent::setUp();
+
 		$this->backend = $this->getMock('\OC_User_Dummy');
 		$manager = \OC_User::getManager();
 		$manager->registerBackend($this->backend);
diff --git a/tests/lib/user/manager.php b/tests/lib/user/manager.php
index 15b28e61bd5aa2c4e8dd84994204ceb5a81fe753..c825ec05775b60ec069cb26a97313ac4619b1263 100644
--- a/tests/lib/user/manager.php
+++ b/tests/lib/user/manager.php
@@ -9,7 +9,7 @@
 
 namespace Test\User;
 
-class Manager extends \PHPUnit_Framework_TestCase {
+class Manager extends \Test\TestCase {
 	public function testUserExistsSingleBackendExists() {
 		/**
 		 * @var \OC_User_Dummy | \PHPUnit_Framework_MockObject_MockObject $backend
diff --git a/tests/lib/user/session.php b/tests/lib/user/session.php
index 5126049d77f2b1f48253f0e3907460adda0f0801..8d9d024197c48d7b8a22c34edb5c26c7fbb40850 100644
--- a/tests/lib/user/session.php
+++ b/tests/lib/user/session.php
@@ -12,7 +12,7 @@ namespace Test\User;
 use OC\Session\Memory;
 use OC\User\User;
 
-class Session extends \PHPUnit_Framework_TestCase {
+class Session extends \Test\TestCase {
 	public function testGetUser() {
 		$session = $this->getMock('\OC\Session\Memory', array(), array(''));
 		$session->expects($this->once())
diff --git a/tests/lib/user/user.php b/tests/lib/user/user.php
index 7a1db861c982dbe08a7553cd1d64cbbeb2b5d96f..6aa7243a75ab8c513b18e482912f1d664adcdd24 100644
--- a/tests/lib/user/user.php
+++ b/tests/lib/user/user.php
@@ -12,7 +12,7 @@ namespace Test\User;
 use OC\AllConfig;
 use OC\Hooks\PublicEmitter;
 
-class User extends \PHPUnit_Framework_TestCase {
+class User extends \Test\TestCase {
 	public function testDisplayName() {
 		/**
 		 * @var \OC_User_Backend | \PHPUnit_Framework_MockObject_MockObject $backend
diff --git a/tests/lib/util.php b/tests/lib/util.php
index 9a3185b3f792926909845143e830a2f95db262b0..6de599b070ede1c190d9ccd9de4c5658d195c0a0 100644
--- a/tests/lib/util.php
+++ b/tests/lib/util.php
@@ -6,7 +6,7 @@
  * See the COPYING-README file.
  */
 
-class Test_Util extends PHPUnit_Framework_TestCase {
+class Test_Util extends \Test\TestCase {
 	public function testGetVersion() {
 		$version = \OC_Util::getVersion();
 		$this->assertTrue(is_array($version));
diff --git a/tests/lib/utilcheckserver.php b/tests/lib/utilcheckserver.php
index 73a1d0e95a6d3dbb0e25e363b8cad655c0fa5928..bb9b7a244528722057e4215e29a0c291de0eb593 100644
--- a/tests/lib/utilcheckserver.php
+++ b/tests/lib/utilcheckserver.php
@@ -9,7 +9,7 @@
 /**
  * Tests for server check functions
  */
-class Test_Util_CheckServer extends PHPUnit_Framework_TestCase {
+class Test_Util_CheckServer extends \Test\TestCase {
 
 	private $datadir;
 
@@ -32,16 +32,19 @@ class Test_Util_CheckServer extends PHPUnit_Framework_TestCase {
 		return $config;
 	}
 
-	public function setUp() {
+	protected function setUp() {
+		parent::setUp();
+
 		$this->datadir = \OC_Helper::tmpFolder();
 
 		file_put_contents($this->datadir . '/.ocdata', '');
 		\OC::$server->getSession()->set('checkServer_succeeded', false);
 	}
 
-	public function tearDown() {
+	protected function tearDown() {
 		// clean up
 		@unlink($this->datadir . '/.ocdata');
+		parent::tearDown();
 	}
 
 	/**
diff --git a/tests/lib/vobject.php b/tests/lib/vobject.php
index db5b0f99f06351076ea31d64ef1959095ad7f883..6fabf30e48f04a7d3c0731865c46e1ae3fce5eb9 100644
--- a/tests/lib/vobject.php
+++ b/tests/lib/vobject.php
@@ -6,9 +6,11 @@
  * See the COPYING-README file.
  */
 
-class Test_VObject extends PHPUnit_Framework_TestCase {
+class Test_VObject extends \Test\TestCase {
+
+	protected function setUp() {
+		parent::setUp();
 
-	public function setUp() {
 		Sabre\VObject\Property::$classMap['SUMMARY'] = 'OC\VObject\StringProperty';
 		Sabre\VObject\Property::$classMap['ORG'] = 'OC\VObject\CompoundProperty';
 	}
diff --git a/tests/settings/controller/mailsettingscontrollertest.php b/tests/settings/controller/mailsettingscontrollertest.php
index 789b6ce8fb038cbdcdd1c97bd8a387e327fd58de..f6ebade7b171740075cd0b0972eca87a322099b1 100644
--- a/tests/settings/controller/mailsettingscontrollertest.php
+++ b/tests/settings/controller/mailsettingscontrollertest.php
@@ -14,11 +14,13 @@ use \OC\Settings\Application;
 /**
  * @package OC\Settings\Controller
  */
-class MailSettingsControllerTest extends \PHPUnit_Framework_TestCase {
+class MailSettingsControllerTest extends \Test\TestCase {
 
 	private $container;
 
 	protected function setUp() {
+		parent::setUp();
+
 		$app = new Application();
 		$this->container = $app->getContainer();
 		$this->container['Config'] = $this->getMockBuilder('\OCP\IConfig')