Commit 6202ca33 authored by Joas Schilling's avatar Joas Schilling
Browse files

Make remaining files extend the test base

parent cb3a598c
......@@ -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')
......
......@@ -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() {
......
......@@ -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'),
......
......@@ -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();
}
......
......@@ -57,7 +57,7 @@ class MapperTest extends MapperTestUtility {
*/
private $mapper;
public function setUp(){
protected function setUp(){
parent::setUp();
$this->mapper = new ExampleMapper($this->db);
}
......
......@@ -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()
......
......@@ -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'));
}
......
......@@ -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();
}
......
......@@ -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(
......
......@@ -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');
}
......
......@@ -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);
}
......
......@@ -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();
}
......
......@@ -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');
}
......
......@@ -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() {
......
......@@ -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();
}
......
......@@ -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())
......
......@@ -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';
......
......@@ -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(
......
......@@ -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();
}
......
......@@ -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();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment