summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2014-11-20 14:53:18 +0100
committerMorris Jobke <hey@morrisjobke.de>2014-11-20 14:53:18 +0100
commit46e610479514787d114ea519a4d70982413d152e (patch)
tree9dd79427d97c92e12a40a97e647e72485891738b /tests
parent288acb55a0384b0608b9df0e64dcf62b1fdc7387 (diff)
parent6202ca33ba76a38b4aea8774018d661f919fa464 (diff)
downloadnextcloud-server-46e610479514787d114ea519a4d70982413d152e.tar.gz
nextcloud-server-46e610479514787d114ea519a4d70982413d152e.zip
Merge pull request #12297 from owncloud/issue/10991-all-testcase
Issue/10991 all testcase
Diffstat (limited to 'tests')
-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/appframework/AppTest.php4
-rw-r--r--tests/lib/appframework/controller/ApiControllerTest.php2
-rw-r--r--tests/lib/appframework/controller/ControllerTest.php4
-rw-r--r--tests/lib/appframework/db/EntityTest.php3
-rw-r--r--tests/lib/appframework/db/mappertest.php2
-rw-r--r--tests/lib/appframework/db/mappertestutility.php6
-rw-r--r--tests/lib/appframework/dependencyinjection/DIContainerTest.php3
-rw-r--r--tests/lib/appframework/http/DataResponseTest.php3
-rw-r--r--tests/lib/appframework/http/DispatcherTest.php5
-rw-r--r--tests/lib/appframework/http/DownloadResponseTest.php3
-rw-r--r--tests/lib/appframework/http/HttpTest.php4
-rw-r--r--tests/lib/appframework/http/JSONResponseTest.php3
-rw-r--r--tests/lib/appframework/http/RedirectResponseTest.php3
-rw-r--r--tests/lib/appframework/http/RequestTest.php9
-rw-r--r--tests/lib/appframework/http/ResponseTest.php3
-rw-r--r--tests/lib/appframework/http/TemplateResponseTest.php4
-rw-r--r--tests/lib/appframework/middleware/MiddlewareDispatcherTest.php5
-rw-r--r--tests/lib/appframework/middleware/MiddlewareTest.php4
-rw-r--r--tests/lib/appframework/middleware/security/CORSMiddlewareTest.php3
-rw-r--r--tests/lib/appframework/middleware/security/SecurityMiddlewareTest.php6
-rw-r--r--tests/lib/appframework/middleware/sessionmiddlewaretest.php4
-rw-r--r--tests/lib/appframework/routing/RoutingTest.php2
-rw-r--r--tests/lib/appframework/utility/ControllerMethodReflectorTest.php2
-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/backgroundjob/job.php5
-rw-r--r--tests/lib/backgroundjob/joblist.php6
-rw-r--r--tests/lib/backgroundjob/queuedjob.php6
-rw-r--r--tests/lib/backgroundjob/timedjob.php6
-rw-r--r--tests/lib/cache.php6
-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/connector/sabre/directory.php6
-rw-r--r--tests/lib/connector/sabre/file.php2
-rw-r--r--tests/lib/connector/sabre/node.php2
-rw-r--r--tests/lib/connector/sabre/objecttree.php4
-rw-r--r--tests/lib/connector/sabre/quotaplugin.php2
-rw-r--r--tests/lib/contacts/localadressbook.php2
-rw-r--r--tests/lib/db.php10
-rw-r--r--tests/lib/db/mdb2schemamanager.php6
-rw-r--r--tests/lib/db/mdb2schemareader.php2
-rw-r--r--tests/lib/db/migrator.php9
-rw-r--r--tests/lib/db/mysqlmigration.php9
-rw-r--r--tests/lib/db/sqlitemigration.php9
-rw-r--r--tests/lib/dbschema.php10
-rw-r--r--tests/lib/errorHandler.php2
-rw-r--r--tests/lib/files/cache/cache.php10
-rw-r--r--tests/lib/files/cache/changepropagator.php8
-rw-r--r--tests/lib/files/cache/homecache.php6
-rw-r--r--tests/lib/files/cache/scanner.php10
-rw-r--r--tests/lib/files/cache/updater.php3
-rw-r--r--tests/lib/files/cache/updaterlegacy.php9
-rw-r--r--tests/lib/files/cache/watcher.php2
-rw-r--r--tests/lib/files/etagtest.php2
-rw-r--r--tests/lib/files/filesystem.php2
-rw-r--r--tests/lib/files/mapper.php5
-rw-r--r--tests/lib/files/mount/manager.php5
-rw-r--r--tests/lib/files/mount/mount.php2
-rw-r--r--tests/lib/files/node/file.php5
-rw-r--r--tests/lib/files/node/folder.php5
-rw-r--r--tests/lib/files/node/integration.php3
-rw-r--r--tests/lib/files/node/node.php5
-rw-r--r--tests/lib/files/node/root.php5
-rw-r--r--tests/lib/files/objectstore/swift.php8
-rw-r--r--tests/lib/files/storage/commontest.php7
-rw-r--r--tests/lib/files/storage/home.php9
-rw-r--r--tests/lib/files/storage/local.php7
-rw-r--r--tests/lib/files/storage/mappedlocal.php7
-rw-r--r--tests/lib/files/storage/mappedlocalwithdotteddatadir.php7
-rw-r--r--tests/lib/files/storage/storage.php2
-rw-r--r--tests/lib/files/storage/wrapper/quota.php7
-rw-r--r--tests/lib/files/storage/wrapper/wrapper.php7
-rw-r--r--tests/lib/files/stream/quota.php5
-rw-r--r--tests/lib/files/stream/staticstream.php8
-rw-r--r--tests/lib/files/utils/scanner.php1
-rw-r--r--tests/lib/files/view.php2
-rw-r--r--tests/lib/geo.php2
-rw-r--r--tests/lib/group/group.php2
-rw-r--r--tests/lib/group/manager.php2
-rw-r--r--tests/lib/group/metadata.php2
-rw-r--r--tests/lib/helper.php2
-rw-r--r--tests/lib/hooks/basicemitter.php5
-rw-r--r--tests/lib/hooks/legacyemitter.php4
-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/memcache/apc.php4
-rw-r--r--tests/lib/memcache/apcu.php4
-rw-r--r--tests/lib/memcache/cache.php4
-rw-r--r--tests/lib/memcache/memcached.php5
-rw-r--r--tests/lib/memcache/xcache.php4
-rw-r--r--tests/lib/migrate.php4
-rw-r--r--tests/lib/naturalsort.php4
-rw-r--r--tests/lib/ocs/privatedata.php10
-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/public/contacts.php11
-rw-r--r--tests/lib/public/ocpconfig.php5
-rw-r--r--tests/lib/repair.php2
-rw-r--r--tests/lib/repair/repaircollation.php9
-rw-r--r--tests/lib/repair/repairinnodb.php9
-rw-r--r--tests/lib/repair/repairlegacystorage.php10
-rw-r--r--tests/lib/repair/repairmimetypes.php9
-rw-r--r--tests/lib/request.php10
-rw-r--r--tests/lib/security/certificate.php6
-rw-r--r--tests/lib/security/certificatemanager.php7
-rw-r--r--tests/lib/security/crypto.php3
-rw-r--r--tests/lib/security/securerandom.php3
-rw-r--r--tests/lib/security/stringutils.php2
-rw-r--r--tests/lib/session/memory.php3
-rw-r--r--tests/lib/session/session.php5
-rw-r--r--tests/lib/setup.php6
-rw-r--r--tests/lib/share/helper.php2
-rw-r--r--tests/lib/share/searchresultsorter.php2
-rw-r--r--tests/lib/share/share.php4
-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/template/resourcelocator.php2
-rw-r--r--tests/lib/templatelayout.php12
-rw-r--r--tests/lib/tempmanager.php9
-rw-r--r--tests/lib/testcase.php10
-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/user/manager.php2
-rw-r--r--tests/lib/user/session.php2
-rw-r--r--tests/lib/user/user.php2
-rw-r--r--tests/lib/util.php2
-rw-r--r--tests/lib/utilcheckserver.php9
-rw-r--r--tests/lib/vobject.php6
-rw-r--r--tests/settings/controller/mailsettingscontrollertest.php4
146 files changed, 468 insertions, 257 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/appframework/AppTest.php b/tests/lib/appframework/AppTest.php
index 92fa4838341..bd565e9765e 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 b772f540ce8..3055fbe0da8 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 0de94ff5b70..d186651dc23 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 d98cb549422..161e11d8030 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 fd1acd0367e..6ad8cd86bff 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 0430eef2c21..ad7a67a96b1 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 acc5c2e66d8..08e72aff984 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 961327c978c..e91d3cefea9 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 f082ddc8b3a..f92e7161e6b 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 ab381e5c298..5e5db2c55ec 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 a7a189c98e5..e9be3e73904 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 06cd3410a69..cdd8d269b41 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 e5d452f7f91..17db0c0be6c 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 58828d17bb2..caa22c84415 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 b1dddd9ebc7..04e19fdaf71 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 afdcf322b85..2ec57f8979a 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 b1e221aab99..be8765afd39 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 9d952f61573..b41ec33eb15 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 79cd3b278af..b4bbcce5ad7 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 cc7704f4d1a..a8925403a95 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 13e558bf21a..344b555ec3c 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 a1d9a51a3c8..276307680af 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 8939a203edb..cd6bd57da4c 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 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/backgroundjob/job.php b/tests/lib/backgroundjob/job.php
index 10a8f46462e..fec9b0a792d 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 c3318f80cb2..13bee12479e 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 19c1b28a507..8d3cd6f907b 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 646a2607ef3..7d9bfe979af 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 8fefa25f65d..894d8c57662 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 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/connector/sabre/directory.php b/tests/lib/connector/sabre/directory.php
index 453d8e8d42a..d8dca35cd71 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 0993a27f372..cfc6e29ae74 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 0f303457248..9a2bf41bd19 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 fc9f802066f..d1de46d2ee7 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 3b144cf56b5..f08637854ce 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 bb69910820f..5fa260ffc3b 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 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/db/mdb2schemamanager.php b/tests/lib/db/mdb2schemamanager.php
index 527b2cba648..3e6abab70b4 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 f08996cbeaf..b2ff55e1632 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 09742a53eb4..7acd3382fe2 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 584df1d4465..70199147760 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 adfc03a2ca7..e3d0e386ab5 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 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/files/cache/cache.php b/tests/lib/files/cache/cache.php
index 969740419c6..02c45a16571 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 a52682cd086..89bd9dfe80a 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 80dc54c9d19..7ebb053bcfa 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 0a274631d1c..b44cf0a49df 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 9e7330db20c..01b036de5d8 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 d16a062fcca..7c05800cd6b 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 0b04b9e7058..ee605c64e01 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 8f29ed0bc63..eec24d9f4c6 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 f24d86b212d..746600c7d15 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 d513f3ce4b3..18161734b60 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 154c35ccead..051b76ccf2e 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 c3d33e0870b..5ee3d934e97 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 76938a0dcc8..34ec7dee213 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 436161aba72..e348e452f6f 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 cde2eb22b7b..fd777460ec6 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 cf5fec30522..80e3ac6f80a 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 27f1a937826..fcce7070f5d 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 37d6cc74de6..f2c4a983cf2 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 ce53c884f32..2b70dc8713e 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 d085efe9c1c..b0670a22892 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 490086c62f2..d2b27117c3b 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 b483f3a1954..1e87b53d00a 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 d2e5e2e97af..3a733b7b469 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 960eb137ea0..30f403d60df 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 954fe199cc8..9e6b1c85a95 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 8bcf42035d4..486cd0495c1 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 d5edace544d..28584cf82db 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 d55086196a0..416a4670efd 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 db6a3fa7842..f729be81bd7 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 44fea65e64e..d6dd176bba9 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 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/group/group.php b/tests/lib/group/group.php
index 4d15999a826..d758e5959d0 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 8fd19513c0a..f72ea8e912f 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 7ef2d6b35ff..94944189cad 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 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/hooks/basicemitter.php b/tests/lib/hooks/basicemitter.php
index 0eae730d030..899d3ecd3b3 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 a7bed879a72..f030afbc090 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 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/memcache/apc.php b/tests/lib/memcache/apc.php
index e5d753a4fa5..550d5068dc1 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 7b99e7cd5e0..1b849e1c54d 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 d07c492cef0..8a4a708e4b7 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 fdab32693ff..a94b809a7b5 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 f59afda3966..b97d5545c6e 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 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/ocs/privatedata.php b/tests/lib/ocs/privatedata.php
index 534fc21b07a..20f1dd38362 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 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/public/contacts.php b/tests/lib/public/contacts.php
index d6008876a00..151e98d3905 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 43a9ca625ee..947d2b3c9ef 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 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/repair/repaircollation.php b/tests/lib/repair/repaircollation.php
index 362feb8463f..e711fcd9d83 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 e7d2442f127..21d7d978821 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 4528c5288df..ac845657cd9 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 7754864a69e..6eaf68d8a44 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 2760377fa48..254048723e7 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 898f583a43c..361f2f8c38d 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 01b3afb03ee..cff6932b670 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 0f89253839e..1571cf89248 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 2920077fa1d..d9bbd0e71e5 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 039f3d3756a..060315debb4 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 2dc236b73bf..84dee548a1e 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 9ce11274c84..a1ed01b2ec8 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 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/share/helper.php b/tests/lib/share/helper.php
index 367507417a0..76046d360bc 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 eaf93400a7d..97ef0f9478a 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 7644dadadc7..7ae458a797d 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 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/template/resourcelocator.php b/tests/lib/template/resourcelocator.php
index cd354df0036..f350fd144e1 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 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/testcase.php b/tests/lib/testcase.php
index a4b4b0103f0..315cd6858ed 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 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/user/manager.php b/tests/lib/user/manager.php
index 15b28e61bd5..c825ec05775 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 5126049d77f..8d9d024197c 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 7a1db861c98..6aa7243a75a 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 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';
}
diff --git a/tests/settings/controller/mailsettingscontrollertest.php b/tests/settings/controller/mailsettingscontrollertest.php
index 789b6ce8fb0..f6ebade7b17 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')