Quellcode durchsuchen

Make remaining files extend the test base

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

+ 3
- 1
tests/lib/appframework/AppTest.php Datei anzeigen

@@ -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')

+ 1
- 1
tests/lib/appframework/controller/ApiControllerTest.php Datei anzeigen

@@ -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() {

+ 3
- 1
tests/lib/appframework/controller/ControllerTest.php Datei anzeigen

@@ -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'),

+ 2
- 1
tests/lib/appframework/db/EntityTest.php Datei anzeigen

@@ -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();
}


+ 1
- 1
tests/lib/appframework/db/mappertest.php Datei anzeigen

@@ -57,7 +57,7 @@ class MapperTest extends MapperTestUtility {
*/
private $mapper;

public function setUp(){
protected function setUp(){
parent::setUp();
$this->mapper = new ExampleMapper($this->db);
}

+ 3
- 3
tests/lib/appframework/db/mappertestutility.php Datei anzeigen

@@ -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()

+ 2
- 1
tests/lib/appframework/dependencyinjection/DIContainerTest.php Datei anzeigen

@@ -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'));
}

+ 2
- 1
tests/lib/appframework/http/DataResponseTest.php Datei anzeigen

@@ -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();
}


+ 2
- 3
tests/lib/appframework/http/DispatcherTest.php Datei anzeigen

@@ -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(

+ 2
- 1
tests/lib/appframework/http/DownloadResponseTest.php Datei anzeigen

@@ -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');
}


+ 3
- 1
tests/lib/appframework/http/HttpTest.php Datei anzeigen

@@ -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);
}

+ 2
- 1
tests/lib/appframework/http/JSONResponseTest.php Datei anzeigen

@@ -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();
}


+ 2
- 1
tests/lib/appframework/http/RedirectResponseTest.php Datei anzeigen

@@ -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');
}


+ 6
- 3
tests/lib/appframework/http/RequestTest.php Datei anzeigen

@@ -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() {

+ 2
- 1
tests/lib/appframework/http/ResponseTest.php Datei anzeigen

@@ -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();
}


+ 3
- 1
tests/lib/appframework/http/TemplateResponseTest.php Datei anzeigen

@@ -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())

+ 3
- 2
tests/lib/appframework/middleware/MiddlewareDispatcherTest.php Datei anzeigen

@@ -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';

+ 3
- 1
tests/lib/appframework/middleware/MiddlewareTest.php Datei anzeigen

@@ -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(

+ 2
- 1
tests/lib/appframework/middleware/security/CORSMiddlewareTest.php Datei anzeigen

@@ -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();
}


+ 4
- 2
tests/lib/appframework/middleware/security/SecurityMiddlewareTest.php Datei anzeigen

@@ -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();

+ 3
- 1
tests/lib/appframework/middleware/sessionmiddlewaretest.php Datei anzeigen

@@ -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();
}

+ 1
- 1
tests/lib/appframework/routing/RoutingTest.php Datei anzeigen

@@ -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()

+ 1
- 1
tests/lib/appframework/utility/ControllerMethodReflectorTest.php Datei anzeigen

@@ -25,7 +25,7 @@
namespace OC\AppFramework\Utility;


class ControllerMethodReflectorTest extends \PHPUnit_Framework_TestCase {
class ControllerMethodReflectorTest extends \Test\TestCase {


/**

+ 3
- 2
tests/lib/backgroundjob/job.php Datei anzeigen

@@ -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;
}


+ 4
- 2
tests/lib/backgroundjob/joblist.php Datei anzeigen

@@ -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);

+ 4
- 2
tests/lib/backgroundjob/queuedjob.php Datei anzeigen

@@ -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);

+ 4
- 2
tests/lib/backgroundjob/timedjob.php Datei anzeigen

@@ -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);

+ 1
- 0
tests/lib/cache.php Datei anzeigen

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

parent::tearDown();
}


+ 4
- 2
tests/lib/connector/sabre/directory.php Datei anzeigen

@@ -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);
}

+ 1
- 1
tests/lib/connector/sabre/file.php Datei anzeigen

@@ -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

+ 1
- 1
tests/lib/connector/sabre/node.php Datei anzeigen

@@ -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'),

+ 2
- 2
tests/lib/connector/sabre/objecttree.php Datei anzeigen

@@ -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

+ 1
- 1
tests/lib/connector/sabre/quotaplugin.php Datei anzeigen

@@ -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

+ 1
- 1
tests/lib/contacts/localadressbook.php Datei anzeigen

@@ -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() {

+ 4
- 2
tests/lib/db/mdb2schemamanager.php Datei anzeigen

@@ -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() {

+ 1
- 1
tests/lib/db/mdb2schemareader.php Datei anzeigen

@@ -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
*/

+ 6
- 3
tests/lib/db/migrator.php Datei anzeigen

@@ -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();
}

/**

+ 6
- 3
tests/lib/db/mysqlmigration.php Datei anzeigen

@@ -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() {

+ 6
- 3
tests/lib/db/sqlitemigration.php Datei anzeigen

@@ -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() {

+ 1
- 1
tests/lib/group/group.php Datei anzeigen

@@ -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
*/

+ 1
- 1
tests/lib/group/manager.php Datei anzeigen

@@ -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

+ 1
- 1
tests/lib/group/metadata.php Datei anzeigen

@@ -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()

+ 3
- 2
tests/lib/hooks/basicemitter.php Datei anzeigen

@@ -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();
}


+ 3
- 1
tests/lib/hooks/legacyemitter.php Datei anzeigen

@@ -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');

+ 3
- 1
tests/lib/memcache/apc.php Datei anzeigen

@@ -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;

+ 3
- 1
tests/lib/memcache/apcu.php Datei anzeigen

@@ -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;

+ 3
- 1
tests/lib/memcache/cache.php Datei anzeigen

@@ -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();
}
}

+ 4
- 1
tests/lib/memcache/memcached.php Datei anzeigen

@@ -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());
}
}

+ 3
- 1
tests/lib/memcache/xcache.php Datei anzeigen

@@ -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;

+ 3
- 7
tests/lib/ocs/privatedata.php Datei anzeigen

@@ -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);

+ 3
- 8
tests/lib/public/contacts.php Datei anzeigen

@@ -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());

+ 2
- 3
tests/lib/public/ocpconfig.php Datei anzeigen

@@ -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);

+ 6
- 3
tests/lib/repair/repaircollation.php Datei anzeigen

@@ -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() {

+ 6
- 3
tests/lib/repair/repairinnodb.php Datei anzeigen

@@ -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() {

+ 7
- 3
tests/lib/repair/repairlegacystorage.php Datei anzeigen

@@ -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) {

+ 6
- 3
tests/lib/repair/repairmimetypes.php Datei anzeigen

@@ -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() {

+ 4
- 2
tests/lib/security/certificate.php Datei anzeigen

@@ -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');

+ 5
- 2
tests/lib/security/certificatemanager.php Datei anzeigen

@@ -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) {

+ 2
- 1
tests/lib/security/crypto.php Datei anzeigen

@@ -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());
}


+ 2
- 1
tests/lib/security/securerandom.php Datei anzeigen

@@ -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();
}


+ 1
- 1
tests/lib/security/stringutils.php Datei anzeigen

@@ -8,7 +8,7 @@

use \OC\Security\StringUtils;

class StringUtilsTest extends \PHPUnit_Framework_TestCase {
class StringUtilsTest extends \Test\TestCase {

public function dataProvider()
{

+ 2
- 1
tests/lib/session/memory.php Datei anzeigen

@@ -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());
}
}

+ 3
- 2
tests/lib/session/session.php Datei anzeigen

@@ -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() {

+ 1
- 1
tests/lib/share/helper.php Datei anzeigen

@@ -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(

+ 1
- 1
tests/lib/share/searchresultsorter.php Datei anzeigen

@@ -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');

+ 3
- 1
tests/lib/share/share.php Datei anzeigen

@@ -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();
}


+ 1
- 1
tests/lib/template/resourcelocator.php Datei anzeigen

@@ -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

+ 1
- 1
tests/lib/user/manager.php Datei anzeigen

@@ -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

+ 1
- 1
tests/lib/user/session.php Datei anzeigen

@@ -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())

+ 1
- 1
tests/lib/user/user.php Datei anzeigen

@@ -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

Laden…
Abbrechen
Speichern