Make remaining files extend the test base

remotes/origin/fix-10825
Joas Schilling 11 years ago
parent cb3a598cdb
commit 6202ca33ba
  1. 4
      tests/lib/appframework/AppTest.php
  2. 2
      tests/lib/appframework/controller/ApiControllerTest.php
  3. 4
      tests/lib/appframework/controller/ControllerTest.php
  4. 3
      tests/lib/appframework/db/EntityTest.php
  5. 2
      tests/lib/appframework/db/mappertest.php
  6. 6
      tests/lib/appframework/db/mappertestutility.php
  7. 3
      tests/lib/appframework/dependencyinjection/DIContainerTest.php
  8. 3
      tests/lib/appframework/http/DataResponseTest.php
  9. 5
      tests/lib/appframework/http/DispatcherTest.php
  10. 3
      tests/lib/appframework/http/DownloadResponseTest.php
  11. 4
      tests/lib/appframework/http/HttpTest.php
  12. 3
      tests/lib/appframework/http/JSONResponseTest.php
  13. 3
      tests/lib/appframework/http/RedirectResponseTest.php
  14. 9
      tests/lib/appframework/http/RequestTest.php
  15. 3
      tests/lib/appframework/http/ResponseTest.php
  16. 4
      tests/lib/appframework/http/TemplateResponseTest.php
  17. 5
      tests/lib/appframework/middleware/MiddlewareDispatcherTest.php
  18. 4
      tests/lib/appframework/middleware/MiddlewareTest.php
  19. 3
      tests/lib/appframework/middleware/security/CORSMiddlewareTest.php
  20. 6
      tests/lib/appframework/middleware/security/SecurityMiddlewareTest.php
  21. 4
      tests/lib/appframework/middleware/sessionmiddlewaretest.php
  22. 2
      tests/lib/appframework/routing/RoutingTest.php
  23. 2
      tests/lib/appframework/utility/ControllerMethodReflectorTest.php
  24. 5
      tests/lib/backgroundjob/job.php
  25. 6
      tests/lib/backgroundjob/joblist.php
  26. 6
      tests/lib/backgroundjob/queuedjob.php
  27. 6
      tests/lib/backgroundjob/timedjob.php
  28. 1
      tests/lib/cache.php
  29. 6
      tests/lib/connector/sabre/directory.php
  30. 2
      tests/lib/connector/sabre/file.php
  31. 2
      tests/lib/connector/sabre/node.php
  32. 4
      tests/lib/connector/sabre/objecttree.php
  33. 2
      tests/lib/connector/sabre/quotaplugin.php
  34. 2
      tests/lib/contacts/localadressbook.php
  35. 6
      tests/lib/db/mdb2schemamanager.php
  36. 2
      tests/lib/db/mdb2schemareader.php
  37. 9
      tests/lib/db/migrator.php
  38. 9
      tests/lib/db/mysqlmigration.php
  39. 9
      tests/lib/db/sqlitemigration.php
  40. 2
      tests/lib/group/group.php
  41. 2
      tests/lib/group/manager.php
  42. 2
      tests/lib/group/metadata.php
  43. 5
      tests/lib/hooks/basicemitter.php
  44. 4
      tests/lib/hooks/legacyemitter.php
  45. 4
      tests/lib/memcache/apc.php
  46. 4
      tests/lib/memcache/apcu.php
  47. 4
      tests/lib/memcache/cache.php
  48. 5
      tests/lib/memcache/memcached.php
  49. 4
      tests/lib/memcache/xcache.php
  50. 10
      tests/lib/ocs/privatedata.php
  51. 11
      tests/lib/public/contacts.php
  52. 5
      tests/lib/public/ocpconfig.php
  53. 9
      tests/lib/repair/repaircollation.php
  54. 9
      tests/lib/repair/repairinnodb.php
  55. 10
      tests/lib/repair/repairlegacystorage.php
  56. 9
      tests/lib/repair/repairmimetypes.php
  57. 6
      tests/lib/security/certificate.php
  58. 7
      tests/lib/security/certificatemanager.php
  59. 3
      tests/lib/security/crypto.php
  60. 3
      tests/lib/security/securerandom.php
  61. 2
      tests/lib/security/stringutils.php
  62. 3
      tests/lib/session/memory.php
  63. 5
      tests/lib/session/session.php
  64. 2
      tests/lib/share/helper.php
  65. 2
      tests/lib/share/searchresultsorter.php
  66. 4
      tests/lib/share/share.php
  67. 2
      tests/lib/template/resourcelocator.php
  68. 2
      tests/lib/user/manager.php
  69. 2
      tests/lib/user/session.php
  70. 2
      tests/lib/user/user.php

@ -25,7 +25,7 @@
namespace OC\AppFramework; namespace OC\AppFramework;
class AppTest extends \PHPUnit_Framework_TestCase { class AppTest extends \Test\TestCase {
private $container; private $container;
private $api; private $api;
@ -38,6 +38,8 @@ class AppTest extends \PHPUnit_Framework_TestCase {
private $controllerMethod; private $controllerMethod;
protected function setUp() { protected function setUp() {
parent::setUp();
$this->container = new \OC\AppFramework\DependencyInjection\DIContainer('test', array()); $this->container = new \OC\AppFramework\DependencyInjection\DIContainer('test', array());
$this->controller = $this->getMockBuilder( $this->controller = $this->getMockBuilder(
'OCP\AppFramework\Controller') 'OCP\AppFramework\Controller')

@ -31,7 +31,7 @@ use OCP\AppFramework\Http\TemplateResponse;
class ChildApiController extends ApiController {}; class ChildApiController extends ApiController {};
class ApiControllerTest extends \PHPUnit_Framework_TestCase { class ApiControllerTest extends \Test\TestCase {
public function testCors() { public function testCors() {

@ -54,7 +54,7 @@ class ChildController extends Controller {
} }
}; };
class ControllerTest extends \PHPUnit_Framework_TestCase { class ControllerTest extends \Test\TestCase {
/** /**
* @var Controller * @var Controller
@ -63,6 +63,8 @@ class ControllerTest extends \PHPUnit_Framework_TestCase {
private $app; private $app;
protected function setUp(){ protected function setUp(){
parent::setUp();
$request = new Request( $request = new Request(
array( array(
'get' => array('name' => 'John Q. Public', 'nickname' => 'Joey'), 'get' => array('name' => 'John Q. Public', 'nickname' => 'Joey'),

@ -49,11 +49,12 @@ class TestEntity extends Entity {
}; };
class EntityTest extends \PHPUnit_Framework_TestCase { class EntityTest extends \Test\TestCase {
private $entity; private $entity;
protected function setUp(){ protected function setUp(){
parent::setUp();
$this->entity = new TestEntity(); $this->entity = new TestEntity();
} }

@ -57,7 +57,7 @@ class MapperTest extends MapperTestUtility {
*/ */
private $mapper; private $mapper;
public function setUp(){ protected function setUp(){
parent::setUp(); parent::setUp();
$this->mapper = new ExampleMapper($this->db); $this->mapper = new ExampleMapper($this->db);
} }

@ -28,9 +28,7 @@ namespace Test\AppFramework\Db;
/** /**
* Simple utility class for testing mappers * Simple utility class for testing mappers
*/ */
abstract class MapperTestUtility extends \PHPUnit_Framework_TestCase { abstract class MapperTestUtility extends \Test\TestCase {
protected $db; protected $db;
private $query; private $query;
private $pdoResult; 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 * db. After this the db can be accessed by using $this->db
*/ */
protected function setUp(){ protected function setUp(){
parent::setUp();
$this->db = $this->getMockBuilder( $this->db = $this->getMockBuilder(
'\OCP\IDb') '\OCP\IDb')
->disableOriginalConstructor() ->disableOriginalConstructor()

@ -29,12 +29,13 @@ namespace OC\AppFramework\DependencyInjection;
use \OC\AppFramework\Http\Request; use \OC\AppFramework\Http\Request;
class DIContainerTest extends \PHPUnit_Framework_TestCase { class DIContainerTest extends \Test\TestCase {
private $container; private $container;
private $api; private $api;
protected function setUp(){ protected function setUp(){
parent::setUp();
$this->container = new DIContainer('name'); $this->container = new DIContainer('name');
$this->api = $this->getMock('OC\AppFramework\Core\API', array(), array('hi')); $this->api = $this->getMock('OC\AppFramework\Core\API', array(), array('hi'));
} }

@ -29,7 +29,7 @@ use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\Http; use OCP\AppFramework\Http;
class DataResponseTest extends \PHPUnit_Framework_TestCase { class DataResponseTest extends \Test\TestCase {
/** /**
* @var DataResponse * @var DataResponse
@ -37,6 +37,7 @@ class DataResponseTest extends \PHPUnit_Framework_TestCase {
private $response; private $response;
protected function setUp() { protected function setUp() {
parent::setUp();
$this->response = new DataResponse(); $this->response = new DataResponse();
} }

@ -62,9 +62,7 @@ class TestController extends Controller {
} }
class DispatcherTest extends \PHPUnit_Framework_TestCase { class DispatcherTest extends \Test\TestCase {
private $middlewareDispatcher; private $middlewareDispatcher;
private $dispatcher; private $dispatcher;
private $controllerMethod; private $controllerMethod;
@ -75,6 +73,7 @@ class DispatcherTest extends \PHPUnit_Framework_TestCase {
private $reflector; private $reflector;
protected function setUp() { protected function setUp() {
parent::setUp();
$this->controllerMethod = 'test'; $this->controllerMethod = 'test';
$app = $this->getMockBuilder( $app = $this->getMockBuilder(

@ -30,7 +30,7 @@ class ChildDownloadResponse extends DownloadResponse {
}; };
class DownloadResponseTest extends \PHPUnit_Framework_TestCase { class DownloadResponseTest extends \Test\TestCase {
/** /**
* @var ChildDownloadResponse * @var ChildDownloadResponse
@ -38,6 +38,7 @@ class DownloadResponseTest extends \PHPUnit_Framework_TestCase {
protected $response; protected $response;
protected function setUp(){ protected function setUp(){
parent::setUp();
$this->response = new ChildDownloadResponse('file', 'content'); $this->response = new ChildDownloadResponse('file', 'content');
} }

@ -27,7 +27,7 @@ namespace OC\AppFramework\Http;
use OC\AppFramework\Http; use OC\AppFramework\Http;
class HttpTest extends \PHPUnit_Framework_TestCase { class HttpTest extends \Test\TestCase {
private $server; private $server;
@ -37,6 +37,8 @@ class HttpTest extends \PHPUnit_Framework_TestCase {
private $http; private $http;
protected function setUp(){ protected function setUp(){
parent::setUp();
$this->server = array(); $this->server = array();
$this->http = new Http($this->server); $this->http = new Http($this->server);
} }

@ -30,7 +30,7 @@ namespace OC\AppFramework\Http;
use OCP\AppFramework\Http\JSONResponse; use OCP\AppFramework\Http\JSONResponse;
use OCP\AppFramework\Http; use OCP\AppFramework\Http;
class JSONResponseTest extends \PHPUnit_Framework_TestCase { class JSONResponseTest extends \Test\TestCase {
/** /**
* @var JSONResponse * @var JSONResponse
@ -38,6 +38,7 @@ class JSONResponseTest extends \PHPUnit_Framework_TestCase {
private $json; private $json;
protected function setUp() { protected function setUp() {
parent::setUp();
$this->json = new JSONResponse(); $this->json = new JSONResponse();
} }

@ -27,7 +27,7 @@ namespace OCP\AppFramework\Http;
use OCP\AppFramework\Http; use OCP\AppFramework\Http;
class RedirectResponseTest extends \PHPUnit_Framework_TestCase { class RedirectResponseTest extends \Test\TestCase {
/** /**
* @var RedirectResponse * @var RedirectResponse
@ -35,6 +35,7 @@ class RedirectResponseTest extends \PHPUnit_Framework_TestCase {
protected $response; protected $response;
protected function setUp(){ protected function setUp(){
parent::setUp();
$this->response = new RedirectResponse('/url'); $this->response = new RedirectResponse('/url');
} }

@ -10,9 +10,11 @@ namespace OC\AppFramework\Http;
global $data; 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'; require_once __DIR__ . '/requeststream.php';
if (in_array('fakeinput', stream_get_wrappers())) { if (in_array('fakeinput', stream_get_wrappers())) {
stream_wrapper_unregister('fakeinput'); stream_wrapper_unregister('fakeinput');
@ -21,8 +23,9 @@ class RequestTest extends \PHPUnit_Framework_TestCase {
$this->stream = 'fakeinput://data'; $this->stream = 'fakeinput://data';
} }
public function tearDown() { protected function tearDown() {
stream_wrapper_unregister('fakeinput'); stream_wrapper_unregister('fakeinput');
parent::tearDown();
} }
public function testRequestAccessors() { public function testRequestAccessors() {

@ -29,7 +29,7 @@ use OCP\AppFramework\Http\Response;
use OCP\AppFramework\Http; use OCP\AppFramework\Http;
class ResponseTest extends \PHPUnit_Framework_TestCase { class ResponseTest extends \Test\TestCase {
/** /**
* @var \OCP\AppFramework\Http\Response * @var \OCP\AppFramework\Http\Response
@ -37,6 +37,7 @@ class ResponseTest extends \PHPUnit_Framework_TestCase {
private $childResponse; private $childResponse;
protected function setUp(){ protected function setUp(){
parent::setUp();
$this->childResponse = new Response(); $this->childResponse = new Response();
} }

@ -28,7 +28,7 @@ use OCP\AppFramework\Http\TemplateResponse;
use OCP\AppFramework\Http; use OCP\AppFramework\Http;
class TemplateResponseTest extends \PHPUnit_Framework_TestCase { class TemplateResponseTest extends \Test\TestCase {
/** /**
* @var \OCP\AppFramework\Http\TemplateResponse * @var \OCP\AppFramework\Http\TemplateResponse
@ -41,6 +41,8 @@ class TemplateResponseTest extends \PHPUnit_Framework_TestCase {
private $api; private $api;
protected function setUp() { protected function setUp() {
parent::setUp();
$this->api = $this->getMock('OC\AppFramework\Core\API', $this->api = $this->getMock('OC\AppFramework\Core\API',
array('getAppName'), array('test')); array('getAppName'), array('test'));
$this->api->expects($this->any()) $this->api->expects($this->any())

@ -100,7 +100,7 @@ class TestMiddleware extends Middleware {
} }
class MiddlewareDispatcherTest extends \PHPUnit_Framework_TestCase { class MiddlewareDispatcherTest extends \Test\TestCase {
public $exception; public $exception;
public $response; public $response;
@ -113,8 +113,9 @@ class MiddlewareDispatcherTest extends \PHPUnit_Framework_TestCase {
*/ */
private $dispatcher; private $dispatcher;
protected function setUp() {
parent::setUp();
public function setUp() {
$this->dispatcher = new MiddlewareDispatcher(); $this->dispatcher = new MiddlewareDispatcher();
$this->controller = $this->getControllerMock(); $this->controller = $this->getControllerMock();
$this->method = 'method'; $this->method = 'method';

@ -31,7 +31,7 @@ use OCP\AppFramework\Middleware;
class ChildMiddleware extends Middleware {}; class ChildMiddleware extends Middleware {};
class MiddlewareTest extends \PHPUnit_Framework_TestCase { class MiddlewareTest extends \Test\TestCase {
/** /**
* @var Middleware * @var Middleware
@ -42,6 +42,8 @@ class MiddlewareTest extends \PHPUnit_Framework_TestCase {
private $api; private $api;
protected function setUp(){ protected function setUp(){
parent::setUp();
$this->middleware = new ChildMiddleware(); $this->middleware = new ChildMiddleware();
$this->api = $this->getMockBuilder( $this->api = $this->getMockBuilder(

@ -18,11 +18,12 @@ use OC\AppFramework\Utility\ControllerMethodReflector;
use OCP\AppFramework\Http\Response; use OCP\AppFramework\Http\Response;
class CORSMiddlewareTest extends \PHPUnit_Framework_TestCase { class CORSMiddlewareTest extends \Test\TestCase {
private $reflector; private $reflector;
protected function setUp() { protected function setUp() {
parent::setUp();
$this->reflector = new ControllerMethodReflector(); $this->reflector = new ControllerMethodReflector();
} }

@ -31,7 +31,7 @@ use OCP\AppFramework\Http\RedirectResponse;
use OCP\AppFramework\Http\JSONResponse; use OCP\AppFramework\Http\JSONResponse;
class SecurityMiddlewareTest extends \PHPUnit_Framework_TestCase { class SecurityMiddlewareTest extends \Test\TestCase {
private $middleware; private $middleware;
private $controller; private $controller;
@ -43,7 +43,9 @@ class SecurityMiddlewareTest extends \PHPUnit_Framework_TestCase {
private $navigationManager; private $navigationManager;
private $urlGenerator; private $urlGenerator;
public function setUp() { protected function setUp() {
parent::setUp();
$this->controller = $this->getMockBuilder('OCP\AppFramework\Controller') $this->controller = $this->getMockBuilder('OCP\AppFramework\Controller')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();

@ -18,7 +18,7 @@ use OC\AppFramework\Utility\ControllerMethodReflector;
use OCP\AppFramework\Http\Response; use OCP\AppFramework\Http\Response;
class SessionMiddlewareTest extends \PHPUnit_Framework_TestCase { class SessionMiddlewareTest extends \Test\TestCase {
/** /**
* @var ControllerMethodReflector * @var ControllerMethodReflector
@ -31,6 +31,8 @@ class SessionMiddlewareTest extends \PHPUnit_Framework_TestCase {
private $request; private $request;
protected function setUp() { protected function setUp() {
parent::setUp();
$this->request = new Request(); $this->request = new Request();
$this->reflector = new ControllerMethodReflector(); $this->reflector = new ControllerMethodReflector();
} }

@ -6,7 +6,7 @@ use OC\AppFramework\DependencyInjection\DIContainer;
use OC\AppFramework\routing\RouteConfig; use OC\AppFramework\routing\RouteConfig;
class RoutingTest extends \PHPUnit_Framework_TestCase class RoutingTest extends \Test\TestCase
{ {
public function testSimpleRoute() public function testSimpleRoute()

@ -25,7 +25,7 @@
namespace OC\AppFramework\Utility; namespace OC\AppFramework\Utility;
class ControllerMethodReflectorTest extends \PHPUnit_Framework_TestCase { class ControllerMethodReflectorTest extends \Test\TestCase {
/** /**

@ -8,10 +8,11 @@
namespace Test\BackgroundJob; namespace Test\BackgroundJob;
class Job extends \PHPUnit_Framework_TestCase { class Job extends \Test\TestCase {
private $run = false; private $run = false;
public function setUp() { protected function setUp() {
parent::setUp();
$this->run = false; $this->run = false;
} }

@ -8,7 +8,7 @@
namespace Test\BackgroundJob; namespace Test\BackgroundJob;
class JobList extends \PHPUnit_Framework_TestCase { class JobList extends \Test\TestCase {
/** /**
* @var \OC\BackgroundJob\JobList * @var \OC\BackgroundJob\JobList
*/ */
@ -19,7 +19,9 @@ class JobList extends \PHPUnit_Framework_TestCase {
*/ */
protected $config; protected $config;
public function setUp() { protected function setUp() {
parent::setUp();
$conn = \OC::$server->getDatabaseConnection(); $conn = \OC::$server->getDatabaseConnection();
$this->config = $this->getMock('\OCP\IConfig'); $this->config = $this->getMock('\OCP\IConfig');
$this->instance = new \OC\BackgroundJob\JobList($conn, $this->config); $this->instance = new \OC\BackgroundJob\JobList($conn, $this->config);

@ -23,7 +23,7 @@ class TestQueuedJob extends \OC\BackgroundJob\QueuedJob {
} }
} }
class QueuedJob extends \PHPUnit_Framework_TestCase { class QueuedJob extends \Test\TestCase {
/** /**
* @var DummyJobList $jobList * @var DummyJobList $jobList
*/ */
@ -39,7 +39,9 @@ class QueuedJob extends \PHPUnit_Framework_TestCase {
$this->jobRun = true; $this->jobRun = true;
} }
public function setup() { protected function setup() {
parent::setUp();
$this->jobList = new DummyJobList(); $this->jobList = new DummyJobList();
$this->job = new TestQueuedJob($this); $this->job = new TestQueuedJob($this);
$this->jobList->add($this->job); $this->jobList->add($this->job);

@ -24,7 +24,7 @@ class TestTimedJob extends \OC\BackgroundJob\TimedJob {
} }
} }
class TimedJob extends \PHPUnit_Framework_TestCase { class TimedJob extends \Test\TestCase {
/** /**
* @var DummyJobList $jobList * @var DummyJobList $jobList
*/ */
@ -40,7 +40,9 @@ class TimedJob extends \PHPUnit_Framework_TestCase {
$this->jobRun = true; $this->jobRun = true;
} }
public function setup() { protected function setup() {
parent::setUp();
$this->jobList = new DummyJobList(); $this->jobList = new DummyJobList();
$this->job = new TestTimedJob($this); $this->job = new TestTimedJob($this);
$this->jobList->add($this->job); $this->jobList->add($this->job);

@ -16,6 +16,7 @@ abstract class Test_Cache extends \Test\TestCase {
if($this->instance) { if($this->instance) {
$this->instance->clear(); $this->instance->clear();
} }
parent::tearDown(); parent::tearDown();
} }

@ -6,12 +6,14 @@
* later. * later.
* See the COPYING-README file. * 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 $view;
private $info; private $info;
public function setUp() { protected function setUp() {
parent::setUp();
$this->view = $this->getMock('OC\Files\View', array(), array(), '', false); $this->view = $this->getMock('OC\Files\View', array(), array(), '', false);
$this->info = $this->getMock('OC\Files\FileInfo', array(), array(), '', false); $this->info = $this->getMock('OC\Files\FileInfo', array(), array(), '', false);
} }

@ -6,7 +6,7 @@
* See the COPYING-README file. * 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 * @expectedException \Sabre\DAV\Exception

@ -12,7 +12,7 @@ namespace Test\Connector\Sabre;
use OC\Files\FileInfo; use OC\Files\FileInfo;
use OC\Files\View; use OC\Files\View;
class Node extends \PHPUnit_Framework_TestCase { class Node extends \Test\TestCase {
public function davPermissionsProvider() { public function davPermissionsProvider() {
return array( return array(
array(\OCP\PERMISSION_ALL, 'file', false, false, 'RDNVW'), array(\OCP\PERMISSION_ALL, 'file', false, false, 'RDNVW'),

@ -13,7 +13,7 @@ use OC\Files\FileInfo;
use OC_Connector_Sabre_Directory; use OC_Connector_Sabre_Directory;
use PHPUnit_Framework_TestCase; use PHPUnit_Framework_TestCase;
class TestDoubleFileView extends \OC\Files\View{ class TestDoubleFileView extends \OC\Files\View {
public function __construct($updatables, $deletables, $canRename = true) { public function __construct($updatables, $deletables, $canRename = true) {
$this->updatables = $updatables; $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 * @dataProvider moveFailedProvider

@ -6,7 +6,7 @@
* later. * later.
* See the COPYING-README file. * 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 * @var \Sabre\DAV\Server

@ -11,7 +11,7 @@ use OC\Contacts\LocalAddressBook;
* License along with this library. If not, see <http://www.gnu.org/licenses/>. * 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() { public function testSearchFN() {

@ -12,15 +12,17 @@ namespace Test\DB;
use Doctrine\DBAL\Platforms\OraclePlatform; use Doctrine\DBAL\Platforms\OraclePlatform;
use Doctrine\DBAL\Platforms\SQLServerPlatform; 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 // do not drop the table for Oracle as it will create a bogus transaction
// that will break the following test suites requiring transactions // that will break the following test suites requiring transactions
if (\OC::$server->getConfig()->getSystemValue('dbtype', 'sqlite') === 'oci') { if (\OC::$server->getConfig()->getSystemValue('dbtype', 'sqlite') === 'oci') {
return; return;
} }
\OC_DB::dropTable('table'); \OC_DB::dropTable('table');
parent::tearDown();
} }
public function testAutoIncrement() { public function testAutoIncrement() {

@ -11,7 +11,7 @@ namespace Test\DB;
use Doctrine\DBAL\Platforms\MySqlPlatform; use Doctrine\DBAL\Platforms\MySqlPlatform;
class MDB2SchemaReader extends \PHPUnit_Framework_TestCase { class MDB2SchemaReader extends \Test\TestCase {
/** /**
* @var \OC\DB\MDB2SchemaReader $reader * @var \OC\DB\MDB2SchemaReader $reader
*/ */

@ -15,7 +15,7 @@ use Doctrine\DBAL\Platforms\SQLServerPlatform;
use \Doctrine\DBAL\Schema\Schema; use \Doctrine\DBAL\Schema\Schema;
use \Doctrine\DBAL\Schema\SchemaConfig; use \Doctrine\DBAL\Schema\SchemaConfig;
class Migrator extends \PHPUnit_Framework_TestCase { class Migrator extends \Test\TestCase {
/** /**
* @var \Doctrine\DBAL\Connection $connection * @var \Doctrine\DBAL\Connection $connection
*/ */
@ -28,7 +28,9 @@ class Migrator extends \PHPUnit_Framework_TestCase {
private $tableName; private $tableName;
public function setUp() { protected function setUp() {
parent::setUp();
$this->connection = \OC_DB::getConnection(); $this->connection = \OC_DB::getConnection();
if ($this->connection->getDatabasePlatform() instanceof OraclePlatform) { if ($this->connection->getDatabasePlatform() instanceof OraclePlatform) {
$this->markTestSkipped('DB migration tests are not supported on OCI'); $this->markTestSkipped('DB migration tests are not supported on OCI');
@ -40,8 +42,9 @@ class Migrator extends \PHPUnit_Framework_TestCase {
$this->tableName = 'test_' . uniqid(); $this->tableName = 'test_' . uniqid();
} }
public function tearDown() { protected function tearDown() {
$this->connection->exec('DROP TABLE ' . $this->tableName); $this->connection->exec('DROP TABLE ' . $this->tableName);
parent::tearDown();
} }
/** /**

@ -6,7 +6,7 @@
* See the COPYING-README file. * See the COPYING-README file.
*/ */
class TestMySqlMigration extends \PHPUnit_Framework_TestCase { class TestMySqlMigration extends \Test\TestCase {
/** @var \Doctrine\DBAL\Connection */ /** @var \Doctrine\DBAL\Connection */
private $connection; private $connection;
@ -14,7 +14,9 @@ class TestMySqlMigration extends \PHPUnit_Framework_TestCase {
/** @var string */ /** @var string */
private $tableName; private $tableName;
public function setUp() { protected function setUp() {
parent::setUp();
$this->connection = \OC_DB::getConnection(); $this->connection = \OC_DB::getConnection();
if (!$this->connection->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\MySqlPlatform) { if (!$this->connection->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\MySqlPlatform) {
$this->markTestSkipped("Test only relevant on MySql"); $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'))"); $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); $this->connection->getSchemaManager()->dropTable($this->tableName);
parent::tearDown();
} }
public function testNonOCTables() { public function testNonOCTables() {

@ -6,7 +6,7 @@
* See the COPYING-README file. * See the COPYING-README file.
*/ */
class TestSqliteMigration extends \PHPUnit_Framework_TestCase { class TestSqliteMigration extends \Test\TestCase {
/** @var \Doctrine\DBAL\Connection */ /** @var \Doctrine\DBAL\Connection */
private $connection; private $connection;
@ -14,7 +14,9 @@ class TestSqliteMigration extends \PHPUnit_Framework_TestCase {
/** @var string */ /** @var string */
private $tableName; private $tableName;
public function setUp() { protected function setUp() {
parent::setUp();
$this->connection = \OC_DB::getConnection(); $this->connection = \OC_DB::getConnection();
if (!$this->connection->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\SqlitePlatform) { if (!$this->connection->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\SqlitePlatform) {
$this->markTestSkipped("Test only relevant on Sqlite"); $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)"); $this->connection->exec("CREATE TABLE $this->tableName(t0 tinyint unsigned, t1 tinyint)");
} }
public function tearDown() { protected function tearDown() {
$this->connection->getSchemaManager()->dropTable($this->tableName); $this->connection->getSchemaManager()->dropTable($this->tableName);
parent::tearDown();
} }
public function testNonOCTables() { public function testNonOCTables() {

@ -11,7 +11,7 @@ namespace Test\Group;
use OC\User\User; use OC\User\User;
class Group extends \PHPUnit_Framework_TestCase { class Group extends \Test\TestCase {
/** /**
* @return \OC\User\Manager | \OC\User\Manager * @return \OC\User\Manager | \OC\User\Manager
*/ */

@ -11,7 +11,7 @@ namespace Test\Group;
use OC\User\User; use OC\User\User;
class Manager extends \PHPUnit_Framework_TestCase { class Manager extends \Test\TestCase {
public function testGet() { public function testGet() {
/** /**
* @var \PHPUnit_Framework_MockObject_MockObject | \OC_Group_Backend $backend * @var \PHPUnit_Framework_MockObject_MockObject | \OC_Group_Backend $backend

@ -9,7 +9,7 @@
namespace Test\Group; namespace Test\Group;
class Test_MetaData extends \PHPUnit_Framework_TestCase { class Test_MetaData extends \Test\TestCase {
private function getGroupManagerMock() { private function getGroupManagerMock() {
return $this->getMockBuilder('\OC\Group\Manager') return $this->getMockBuilder('\OC\Group\Manager')
->disableOriginalConstructor() ->disableOriginalConstructor()

@ -31,13 +31,14 @@ class DummyEmitter extends \OC\Hooks\BasicEmitter {
class EmittedException extends \Exception { class EmittedException extends \Exception {
} }
class BasicEmitter extends \PHPUnit_Framework_TestCase { class BasicEmitter extends \Test\TestCase {
/** /**
* @var \OC\Hooks\Emitter $emitter * @var \OC\Hooks\Emitter $emitter
*/ */
protected $emitter; protected $emitter;
public function setUp() { protected function setUp() {
parent::setUp();
$this->emitter = new DummyEmitter(); $this->emitter = new DummyEmitter();
} }

@ -26,7 +26,9 @@ class LegacyEmitter extends BasicEmitter {
//we can't use exceptions here since OC_Hooks catches all exceptions //we can't use exceptions here since OC_Hooks catches all exceptions
private static $emitted = false; private static $emitted = false;
public function setUp() { protected function setUp() {
parent::setUp();
$this->emitter = new DummyLegacyEmitter(); $this->emitter = new DummyLegacyEmitter();
self::$emitted = false; self::$emitted = false;
\OC_Hook::clear('Test','test'); \OC_Hook::clear('Test','test');

@ -10,7 +10,9 @@
namespace Test\Memcache; namespace Test\Memcache;
class APC extends Cache { class APC extends Cache {
public function setUp() { protected function setUp() {
parent::setUp();
if(!\OC\Memcache\APC::isAvailable()) { if(!\OC\Memcache\APC::isAvailable()) {
$this->markTestSkipped('The apc extension is not available.'); $this->markTestSkipped('The apc extension is not available.');
return; return;

@ -10,7 +10,9 @@
namespace Test\Memcache; namespace Test\Memcache;
class APCu extends Cache { class APCu extends Cache {
public function setUp() { protected function setUp() {
parent::setUp();
if(!\OC\Memcache\APCu::isAvailable()) { if(!\OC\Memcache\APCu::isAvailable()) {
$this->markTestSkipped('The APCu extension is not available.'); $this->markTestSkipped('The APCu extension is not available.');
return; return;

@ -50,9 +50,11 @@ abstract class Cache extends \Test_Cache {
$this->assertFalse($this->instance->hasKey('foo')); $this->assertFalse($this->instance->hasKey('foo'));
} }
public function tearDown() { protected function tearDown() {
if ($this->instance) { if ($this->instance) {
$this->instance->clear(); $this->instance->clear();
} }
parent::tearDown();
} }
} }

@ -11,6 +11,8 @@ namespace Test\Memcache;
class Memcached extends Cache { class Memcached extends Cache {
static public function setUpBeforeClass() { static public function setUpBeforeClass() {
parent::setUpBeforeClass();
if (!\OC\Memcache\Memcached::isAvailable()) { if (!\OC\Memcache\Memcached::isAvailable()) {
self::markTestSkipped('The memcached extension is not available.'); 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()); $this->instance = new \OC\Memcache\Memcached(uniqid());
} }
} }

@ -10,7 +10,9 @@
namespace Test\Memcache; namespace Test\Memcache;
class XCache extends Cache { class XCache extends Cache {
public function setUp() { protected function setUp() {
parent::setUp();
if (!\OC\Memcache\XCache::isAvailable()) { if (!\OC\Memcache\XCache::isAvailable()) {
$this->markTestSkipped('The xcache extension is not available.'); $this->markTestSkipped('The xcache extension is not available.');
return; return;

@ -20,19 +20,15 @@
* *
*/ */
class Test_OC_OCS_Privatedata extends PHPUnit_Framework_TestCase class Test_OC_OCS_Privatedata extends \Test\TestCase {
{
private $appKey; private $appKey;
public function setUp() { protected function setUp() {
parent::setUp();
\OC::$server->getSession()->set('user_id', 'user1'); \OC::$server->getSession()->set('user_id', 'user1');
$this->appKey = uniqid('app'); $this->appKey = uniqid('app');
} }
public function tearDown() {
}
public function testGetEmptyOne() { public function testGetEmptyOne() {
$params = array('app' => $this->appKey, 'key' => '123'); $params = array('app' => $this->appKey, 'key' => '123');
$result = OC_OCS_Privatedata::get($params); $result = OC_OCS_Privatedata::get($params);

@ -19,17 +19,12 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>. * License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/ */
class Test_Contacts extends PHPUnit_Framework_TestCase class Test_Contacts extends \Test\TestCase {
{ protected function setUp() {
parent::setUp();
public function setUp() {
OCP\Contacts::clear(); OCP\Contacts::clear();
} }
public function tearDown() {
}
public function testDisabledIfEmpty() { public function testDisabledIfEmpty() {
// pretty simple // pretty simple
$this->assertFalse(OCP\Contacts::isEnabled()); $this->assertFalse(OCP\Contacts::isEnabled());

@ -19,12 +19,11 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>. * 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() { public function testSetAppValueIfSetToNull() {
$key = uniqid("key-"); $key = $this->getUniqueID('key-');
$result = \OCP\Config::setAppValue('unit-test', $key, null); $result = \OCP\Config::setAppValue('unit-test', $key, null);
$this->assertTrue($result); $this->assertTrue($result);

@ -21,7 +21,7 @@ class TestCollationRepair extends \OC\Repair\Collation {
* *
* @see \OC\Repair\RepairMimeTypes * @see \OC\Repair\RepairMimeTypes
*/ */
class TestRepairCollation extends PHPUnit_Framework_TestCase { class TestRepairCollation extends \Test\TestCase {
/** /**
* @var TestCollationRepair * @var TestCollationRepair
@ -43,7 +43,9 @@ class TestRepairCollation extends PHPUnit_Framework_TestCase {
*/ */
private $config; private $config;
public function setUp() { protected function setUp() {
parent::setUp();
$this->connection = \OC_DB::getConnection(); $this->connection = \OC_DB::getConnection();
$this->config = \OC::$server->getConfig(); $this->config = \OC::$server->getConfig();
if (!$this->connection->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\MySqlPlatform) { 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); $this->repair = new TestCollationRepair($this->config, $this->connection);
} }
public function tearDown() { protected function tearDown() {
$this->connection->getSchemaManager()->dropTable($this->tableName); $this->connection->getSchemaManager()->dropTable($this->tableName);
parent::tearDown();
} }
public function testCollationConvert() { public function testCollationConvert() {

@ -11,7 +11,7 @@
* *
* @see \OC\Repair\RepairMimeTypes * @see \OC\Repair\RepairMimeTypes
*/ */
class TestRepairInnoDB extends PHPUnit_Framework_TestCase { class TestRepairInnoDB extends \Test\TestCase {
/** @var \OC\RepairStep */ /** @var \OC\RepairStep */
private $repair; private $repair;
@ -22,7 +22,9 @@ class TestRepairInnoDB extends PHPUnit_Framework_TestCase {
/** @var string */ /** @var string */
private $tableName; private $tableName;
public function setUp() { protected function setUp() {
parent::setUp();
$this->connection = \OC_DB::getConnection(); $this->connection = \OC_DB::getConnection();
if (!$this->connection->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\MySqlPlatform) { if (!$this->connection->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\MySqlPlatform) {
$this->markTestSkipped("Test only relevant on MySql"); $this->markTestSkipped("Test only relevant on MySql");
@ -35,8 +37,9 @@ class TestRepairInnoDB extends PHPUnit_Framework_TestCase {
$this->repair = new \OC\Repair\InnoDB(); $this->repair = new \OC\Repair\InnoDB();
} }
public function tearDown() { protected function tearDown() {
$this->connection->getSchemaManager()->dropTable($this->tableName); $this->connection->getSchemaManager()->dropTable($this->tableName);
parent::tearDown();
} }
public function testInnoDBConvert() { public function testInnoDBConvert() {

@ -11,7 +11,7 @@
* *
* @see \OC\Repair\RepairLegacyStorages * @see \OC\Repair\RepairLegacyStorages
*/ */
class TestRepairLegacyStorages extends PHPUnit_Framework_TestCase { class TestRepairLegacyStorages extends \Test\TestCase {
private $user; private $user;
private $repair; private $repair;
@ -22,7 +22,9 @@ class TestRepairLegacyStorages extends PHPUnit_Framework_TestCase {
private $legacyStorageId; private $legacyStorageId;
private $newStorageId; private $newStorageId;
public function setUp() { protected function setUp() {
parent::setUp();
$this->config = \OC::$server->getConfig(); $this->config = \OC::$server->getConfig();
$this->connection = \OC_DB::getConnection(); $this->connection = \OC_DB::getConnection();
$this->oldDataDir = $this->config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data/'); $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); $this->repair = new \OC\Repair\RepairLegacyStorages($this->config, $this->connection);
} }
public function tearDown() { protected function tearDown() {
\OC_User::deleteUser($this->user); \OC_User::deleteUser($this->user);
$sql = 'DELETE FROM `*PREFIX*storages`'; $sql = 'DELETE FROM `*PREFIX*storages`';
@ -39,6 +41,8 @@ class TestRepairLegacyStorages extends PHPUnit_Framework_TestCase {
$this->connection->executeQuery($sql); $this->connection->executeQuery($sql);
\OCP\Config::setSystemValue('datadirectory', $this->oldDataDir); \OCP\Config::setSystemValue('datadirectory', $this->oldDataDir);
$this->config->setAppValue('core', 'repairlegacystoragesdone', 'no'); $this->config->setAppValue('core', 'repairlegacystoragesdone', 'no');
parent::tearDown();
} }
function prepareSettings($dataDir, $userId) { function prepareSettings($dataDir, $userId) {

@ -11,26 +11,29 @@
* *
* @see \OC\Repair\RepairMimeTypes * @see \OC\Repair\RepairMimeTypes
*/ */
class TestRepairMimeTypes extends PHPUnit_Framework_TestCase { class TestRepairMimeTypes extends \Test\TestCase {
/** @var \OC\RepairStep */ /** @var \OC\RepairStep */
private $repair; private $repair;
private $storage; private $storage;
public function setUp() { protected function setUp() {
parent::setUp();
$this->storage = new \OC\Files\Storage\Temporary(array()); $this->storage = new \OC\Files\Storage\Temporary(array());
$this->repair = new \OC\Repair\RepairMimeTypes(); $this->repair = new \OC\Repair\RepairMimeTypes();
} }
public function tearDown() { protected function tearDown() {
$this->storage->getCache()->clear(); $this->storage->getCache()->clear();
$sql = 'DELETE FROM `*PREFIX*storages` WHERE `id` = ?'; $sql = 'DELETE FROM `*PREFIX*storages` WHERE `id` = ?';
\OC_DB::executeAudited($sql, array($this->storage->getId())); \OC_DB::executeAudited($sql, array($this->storage->getId()));
$this->clearMimeTypes(); $this->clearMimeTypes();
DummyFileCache::clearCachedMimeTypes(); DummyFileCache::clearCachedMimeTypes();
parent::tearDown();
} }
private function clearMimeTypes() { private function clearMimeTypes() {

@ -8,7 +8,7 @@
use \OC\Security\Certificate; use \OC\Security\Certificate;
class CertificateTest extends \PHPUnit_Framework_TestCase { class CertificateTest extends \Test\TestCase {
/** @var Certificate That contains a valid certificate */ /** @var Certificate That contains a valid certificate */
protected $goodCertificate; protected $goodCertificate;
@ -17,7 +17,9 @@ class CertificateTest extends \PHPUnit_Framework_TestCase {
/** @var Certificate That contains an expired certificate */ /** @var Certificate That contains an expired certificate */
protected $expiredCertificate; protected $expiredCertificate;
function setUp() { protected function setUp() {
parent::setUp();
$goodCertificate = file_get_contents(__DIR__ . '/../../data/certificates/goodCertificate.crt'); $goodCertificate = file_get_contents(__DIR__ . '/../../data/certificates/goodCertificate.crt');
$this->goodCertificate = new Certificate($goodCertificate, 'GoodCertificate'); $this->goodCertificate = new Certificate($goodCertificate, 'GoodCertificate');
$badCertificate = file_get_contents(__DIR__ . '/../../data/certificates/badCertificate.crt'); $badCertificate = file_get_contents(__DIR__ . '/../../data/certificates/badCertificate.crt');

@ -17,7 +17,9 @@ class CertificateManagerTest extends \Test\TestCase {
/** @var \OC\User\User */ /** @var \OC\User\User */
private $user; private $user;
function setUp() { protected function setUp() {
parent::setUp();
$this->username = $this->getUniqueID('', 20); $this->username = $this->getUniqueID('', 20);
OC_User::createUser($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); $this->certificateManager = new CertificateManager($this->user);
} }
function tearDown() { protected function tearDown() {
\OC_User::deleteUser($this->username); \OC_User::deleteUser($this->username);
parent::tearDown();
} }
protected function assertEqualsArrays($expected, $actual) { protected function assertEqualsArrays($expected, $actual) {

@ -8,7 +8,7 @@
use \OC\Security\Crypto; use \OC\Security\Crypto;
class CryptoTest extends \PHPUnit_Framework_TestCase { class CryptoTest extends \Test\TestCase {
public function defaultEncryptionProvider() public function defaultEncryptionProvider()
{ {
@ -23,6 +23,7 @@ class CryptoTest extends \PHPUnit_Framework_TestCase {
protected $crypto; protected $crypto;
protected function setUp() { protected function setUp() {
parent::setUp();
$this->crypto = new Crypto(\OC::$server->getConfig(), \OC::$server->getSecureRandom()); $this->crypto = new Crypto(\OC::$server->getConfig(), \OC::$server->getSecureRandom());
} }

@ -8,7 +8,7 @@
use \OC\Security\SecureRandom; use \OC\Security\SecureRandom;
class SecureRandomTest extends \PHPUnit_Framework_TestCase { class SecureRandomTest extends \Test\TestCase {
public function stringGenerationProvider() { public function stringGenerationProvider() {
return array( return array(
@ -34,6 +34,7 @@ class SecureRandomTest extends \PHPUnit_Framework_TestCase {
protected $rng; protected $rng;
protected function setUp() { protected function setUp() {
parent::setUp();
$this->rng = new \OC\Security\SecureRandom(); $this->rng = new \OC\Security\SecureRandom();
} }

@ -8,7 +8,7 @@
use \OC\Security\StringUtils; use \OC\Security\StringUtils;
class StringUtilsTest extends \PHPUnit_Framework_TestCase { class StringUtilsTest extends \Test\TestCase {
public function dataProvider() public function dataProvider()
{ {

@ -10,7 +10,8 @@
namespace Test\Session; namespace Test\Session;
class Memory extends Session { class Memory extends Session {
public function setUp() { protected function setUp() {
parent::setUp();
$this->instance = new \OC\Session\Memory(uniqid()); $this->instance = new \OC\Session\Memory(uniqid());
} }
} }

@ -9,14 +9,15 @@
namespace Test\Session; namespace Test\Session;
abstract class Session extends \PHPUnit_Framework_TestCase { abstract class Session extends \Test\TestCase {
/** /**
* @var \OC\Session\Session * @var \OC\Session\Session
*/ */
protected $instance; protected $instance;
public function tearDown() { protected function tearDown() {
$this->instance->clear(); $this->instance->clear();
parent::tearDown();
} }
public function testNotExistsEmpty() { public function testNotExistsEmpty() {

@ -19,7 +19,7 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>. * 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() { public function expireDateProvider() {
return array( return array(

@ -19,7 +19,7 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>. * 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() { public function testSort() {
$search = 'lin'; $search = 'lin';
$sorter = new \OC\Share\SearchResultSorter($search, 'foobar'); $sorter = new \OC\Share\SearchResultSorter($search, 'foobar');

@ -19,7 +19,7 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>. * 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 $itemType;
protected $userBackend; protected $userBackend;
@ -37,6 +37,7 @@ class Test_Share extends Test\TestCase {
protected function setUp() { protected function setUp() {
parent::setUp(); parent::setUp();
OC_User::clearBackends(); OC_User::clearBackends();
OC_User::useBackend('dummy'); OC_User::useBackend('dummy');
$this->user1 = $this->getUniqueID('user1_'); $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 = OC_DB::prepare('DELETE FROM `*PREFIX*share` WHERE `item_type` = ?');
$query->execute(array('test')); $query->execute(array('test'));
OC_Appconfig::setValue('core', 'shareapi_allow_resharing', $this->resharing); OC_Appconfig::setValue('core', 'shareapi_allow_resharing', $this->resharing);
parent::tearDown(); parent::tearDown();
} }

@ -6,7 +6,7 @@
* See the COPYING-README file. * See the COPYING-README file.
*/ */
class Test_ResourceLocator extends PHPUnit_Framework_TestCase { class Test_ResourceLocator extends \Test\TestCase {
/** /**
* @param string $theme * @param string $theme

@ -9,7 +9,7 @@
namespace Test\User; namespace Test\User;
class Manager extends \PHPUnit_Framework_TestCase { class Manager extends \Test\TestCase {
public function testUserExistsSingleBackendExists() { public function testUserExistsSingleBackendExists() {
/** /**
* @var \OC_User_Dummy | \PHPUnit_Framework_MockObject_MockObject $backend * @var \OC_User_Dummy | \PHPUnit_Framework_MockObject_MockObject $backend

@ -12,7 +12,7 @@ namespace Test\User;
use OC\Session\Memory; use OC\Session\Memory;
use OC\User\User; use OC\User\User;
class Session extends \PHPUnit_Framework_TestCase { class Session extends \Test\TestCase {
public function testGetUser() { public function testGetUser() {
$session = $this->getMock('\OC\Session\Memory', array(), array('')); $session = $this->getMock('\OC\Session\Memory', array(), array(''));
$session->expects($this->once()) $session->expects($this->once())

@ -12,7 +12,7 @@ namespace Test\User;
use OC\AllConfig; use OC\AllConfig;
use OC\Hooks\PublicEmitter; use OC\Hooks\PublicEmitter;
class User extends \PHPUnit_Framework_TestCase { class User extends \Test\TestCase {
public function testDisplayName() { public function testDisplayName() {
/** /**
* @var \OC_User_Backend | \PHPUnit_Framework_MockObject_MockObject $backend * @var \OC_User_Backend | \PHPUnit_Framework_MockObject_MockObject $backend

Loading…
Cancel
Save