summaryrefslogtreecommitdiffstats
path: root/tests/lib
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2014-11-10 22:59:50 +0100
committerJoas Schilling <nickvergessen@gmx.de>2014-11-19 14:53:51 +0100
commitcb3a598cdb238f9ce74dce80ef9e59cdfc531a4f (patch)
tree2a3ec09e86f13885483286ba5f5213201eb4ee67 /tests/lib
parent76ebd3a050cb3c84b958f071ec559e6bc9cbc847 (diff)
downloadnextcloud-server-cb3a598cdb238f9ce74dce80ef9e59cdfc531a4f.tar.gz
nextcloud-server-cb3a598cdb238f9ce74dce80ef9e59cdfc531a4f.zip
Make root tests extend the \Test\TestCase
Diffstat (limited to 'tests/lib')
-rw-r--r--tests/lib/activitymanager.php6
-rw-r--r--tests/lib/api.php2
-rw-r--r--tests/lib/app.php2
-rw-r--r--tests/lib/appconfig.php6
-rw-r--r--tests/lib/archive.php2
-rw-r--r--tests/lib/archive/tar.php5
-rw-r--r--tests/lib/archive/zip.php10
-rw-r--r--tests/lib/autoloader.php5
-rw-r--r--tests/lib/avatar.php8
-rw-r--r--tests/lib/cache.php5
-rw-r--r--tests/lib/cache/file.php8
-rw-r--r--tests/lib/cache/usercache.php6
-rw-r--r--tests/lib/config.php9
-rw-r--r--tests/lib/db.php10
-rw-r--r--tests/lib/dbschema.php10
-rw-r--r--tests/lib/errorHandler.php2
-rw-r--r--tests/lib/geo.php2
-rw-r--r--tests/lib/helper.php2
-rw-r--r--tests/lib/httphelper.php6
-rw-r--r--tests/lib/image.php4
-rw-r--r--tests/lib/installer.php10
-rw-r--r--tests/lib/l10n.php2
-rw-r--r--tests/lib/largefilehelper.php4
-rw-r--r--tests/lib/largefilehelpergetfilesize.php4
-rw-r--r--tests/lib/logger.php6
-rw-r--r--tests/lib/mail.php4
-rw-r--r--tests/lib/migrate.php4
-rw-r--r--tests/lib/naturalsort.php4
-rw-r--r--tests/lib/preferences-singleton.php6
-rw-r--r--tests/lib/preferences.php2
-rw-r--r--tests/lib/preview.php2
-rw-r--r--tests/lib/repair.php2
-rw-r--r--tests/lib/request.php10
-rw-r--r--tests/lib/setup.php6
-rw-r--r--tests/lib/streamwrappers.php2
-rw-r--r--tests/lib/tags.php9
-rw-r--r--tests/lib/template.php6
-rw-r--r--tests/lib/templatelayout.php12
-rw-r--r--tests/lib/tempmanager.php9
-rw-r--r--tests/lib/updater.php2
-rw-r--r--tests/lib/urlgenerator.php2
-rw-r--r--tests/lib/user.php4
-rw-r--r--tests/lib/util.php2
-rw-r--r--tests/lib/utilcheckserver.php9
-rw-r--r--tests/lib/vobject.php6
45 files changed, 157 insertions, 82 deletions
diff --git a/tests/lib/activitymanager.php b/tests/lib/activitymanager.php
index f21b82c52c3..85f8320de09 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 0f7d08543ea..bf9748a6040 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 6ae548759ed..23c1a340e03 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 9257ae45b0e..188721ff92d 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/archive.php b/tests/lib/archive.php
index be5cc897a67..690b4378b88 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 99f7fb30e2b..43157e2054d 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 90958baf380..09ea5d7d27c 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 46172647249..bf63094a9ef 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 0334639afa8..421be155d17 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/cache.php b/tests/lib/cache.php
index 8fefa25f65d..bdee0348e50 100644
--- a/tests/lib/cache.php
+++ b/tests/lib/cache.php
@@ -6,16 +6,17 @@
* 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 8cc45c85405..d51322036c8 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 8a23a805ebe..3822a714d5a 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 180f6b1649b..9dff3aab84f 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/db.php b/tests/lib/db.php
index fb673b8092b..a401aded62a 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/dbschema.php b/tests/lib/dbschema.php
index d31bd34124e..cfaebec079e 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 58db80b3c6e..726529e83f4 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/geo.php b/tests/lib/geo.php
index 1c56a976129..0678297b55a 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/helper.php b/tests/lib/helper.php
index 57c72c11987..53a3e1a0ec8 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/httphelper.php b/tests/lib/httphelper.php
index 191200aee3d..34dee35fe02 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 a683c3d2c8b..e0009b9710e 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 5e267245200..b58a71b5a08 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 df86fcfda81..68f43b76f51 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 5db1f9c5a74..1267a8c5833 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 90ecc3dde70..c97b7b32b0f 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 fcdf5b58670..700a847917b 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 3cc9868e25e..568ecff52b0 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/migrate.php b/tests/lib/migrate.php
index 3f87bbc1ac8..9c1e980c445 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 09a0e6a5f9d..e022a855309 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/preferences-singleton.php b/tests/lib/preferences-singleton.php
index 7abf5a6be36..01e15acdfe1 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 fe8e3e8b48c..193b1f80280 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 288dd2aa417..2a6761403f4 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/repair.php b/tests/lib/repair.php
index 121f41dedd9..248db382140 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/request.php b/tests/lib/request.php
index b89bf92ece7..fbab8645d72 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/setup.php b/tests/lib/setup.php
index 2c1569dd800..8373ba316d6 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/streamwrappers.php b/tests/lib/streamwrappers.php
index 6f92f487037..9a3b6bc9266 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 57b64f1cd36..ab714bde3df 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 819d592aacf..d77284a5bf2 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/templatelayout.php b/tests/lib/templatelayout.php
index 0335c7c88ee..1035dae122d 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 85b94094393..05311e820a7 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/updater.php b/tests/lib/updater.php
index 4488744fa1d..cc82450cfb6 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 066272731ee..a92aaddeb4c 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 e2c3282a19f..cb0c661b2a4 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/util.php b/tests/lib/util.php
index 9a3185b3f79..6de599b070e 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 73a1d0e95a6..bb9b7a24452 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 db5b0f99f06..6fabf30e48f 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';
}