diff options
Diffstat (limited to 'tests')
70 files changed, 191 insertions, 117 deletions
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/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 bdee0348e50..894d8c57662 100644 --- a/tests/lib/cache.php +++ b/tests/lib/cache.php @@ -16,6 +16,7 @@ abstract class Test_Cache extends \Test\TestCase { if($this->instance) { $this->instance->clear(); } + parent::tearDown(); } 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/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/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/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/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/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/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/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/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/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/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/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 |