Browse Source

Fix phpunit-5.4 wargning

* getMock is deprecated.
* \PDOStatement mocking fails hard on phpunit 4.8
tags/v10.0RC1
Roeland Jago Douma 8 years ago
parent
commit
2fa9e67294
No account linked to committer's email address

+ 26
- 22
tests/lib/AppFramework/Controller/ApiControllerTest.php View File

@@ -32,27 +32,31 @@ class ChildApiController extends ApiController {};


class ApiControllerTest extends \Test\TestCase {
/** @var ChildApiController */
protected $controller;

public function testCors() {
$request = new Request(
['server' => ['HTTP_ORIGIN' => 'test']],
$this->getMock('\OCP\Security\ISecureRandom'),
$this->getMock('\OCP\IConfig')
);
$this->controller = new ChildApiController('app', $request, 'verbs',
'headers', 100);

$response = $this->controller->preflightedCors();

$headers = $response->getHeaders();

$this->assertEquals('test', $headers['Access-Control-Allow-Origin']);
$this->assertEquals('verbs', $headers['Access-Control-Allow-Methods']);
$this->assertEquals('headers', $headers['Access-Control-Allow-Headers']);
$this->assertEquals('false', $headers['Access-Control-Allow-Credentials']);
$this->assertEquals(100, $headers['Access-Control-Max-Age']);
}
/** @var ChildApiController */
protected $controller;

public function testCors() {
$request = new Request(
['server' => ['HTTP_ORIGIN' => 'test']],
$this->getMockBuilder('\OCP\Security\ISecureRandom')
->disableOriginalConstructor()
->getMock(),
$this->getMockBuilder('\OCP\IConfig')
->disableOriginalConstructor()
->getMock()
);
$this->controller = new ChildApiController('app', $request, 'verbs',
'headers', 100);

$response = $this->controller->preflightedCors();

$headers = $response->getHeaders();

$this->assertEquals('test', $headers['Access-Control-Allow-Origin']);
$this->assertEquals('verbs', $headers['Access-Control-Allow-Methods']);
$this->assertEquals('headers', $headers['Access-Control-Allow-Headers']);
$this->assertEquals('false', $headers['Access-Control-Allow-Credentials']);
$this->assertEquals(100, $headers['Access-Control-Max-Age']);
}

}

+ 10
- 4
tests/lib/AppFramework/Controller/ControllerTest.php View File

@@ -76,12 +76,18 @@ class ControllerTest extends \Test\TestCase {
'session' => ['sezession' => 'kein'],
'method' => 'hi',
],
$this->getMock('\OCP\Security\ISecureRandom'),
$this->getMock('\OCP\IConfig')
$this->getMockBuilder('\OCP\Security\ISecureRandom')
->disableOriginalConstructor()
->getMock(),
$this->getMockBuilder('\OCP\IConfig')
->disableOriginalConstructor()
->getMock()
);

$this->app = $this->getMock('OC\AppFramework\DependencyInjection\DIContainer',
array('getAppName'), array('test'));
$this->app = $this->getMockBuilder('OC\AppFramework\DependencyInjection\DIContainer')
->setMethods(['getAppName'])
->setConstructorArgs(['test'])
->getMock();
$this->app->expects($this->any())
->method('getAppName')
->will($this->returnValue('apptemplate_advanced'));

+ 24
- 11
tests/lib/AppFramework/Controller/OCSControllerTest.php View File

@@ -33,9 +33,6 @@ class ChildOCSController extends OCSController {}


class OCSControllerTest extends \Test\TestCase {

private $controller;

public function testCors() {
$request = new Request(
[
@@ -43,8 +40,12 @@ class OCSControllerTest extends \Test\TestCase {
'HTTP_ORIGIN' => 'test',
],
],
$this->getMock('\OCP\Security\ISecureRandom'),
$this->getMock('\OCP\IConfig')
$this->getMockBuilder('\OCP\Security\ISecureRandom')
->disableOriginalConstructor()
->getMock(),
$this->getMockBuilder('\OCP\IConfig')
->disableOriginalConstructor()
->getMock()
);
$controller = new ChildOCSController('app', $request, 'verbs',
'headers', 100);
@@ -64,8 +65,12 @@ class OCSControllerTest extends \Test\TestCase {
public function testXML() {
$controller = new ChildOCSController('app', new Request(
[],
$this->getMock('\OCP\Security\ISecureRandom'),
$this->getMock('\OCP\IConfig')
$this->getMockBuilder('\OCP\Security\ISecureRandom')
->disableOriginalConstructor()
->getMock(),
$this->getMockBuilder('\OCP\IConfig')
->disableOriginalConstructor()
->getMock()
));
$expected = "<?xml version=\"1.0\"?>\n" .
"<ocs>\n" .
@@ -96,8 +101,12 @@ class OCSControllerTest extends \Test\TestCase {
public function testXMLDataResponse() {
$controller = new ChildOCSController('app', new Request(
[],
$this->getMock('\OCP\Security\ISecureRandom'),
$this->getMock('\OCP\IConfig')
$this->getMockBuilder('\OCP\Security\ISecureRandom')
->disableOriginalConstructor()
->getMock(),
$this->getMockBuilder('\OCP\IConfig')
->disableOriginalConstructor()
->getMock()
));
$expected = "<?xml version=\"1.0\"?>\n" .
"<ocs>\n" .
@@ -128,8 +137,12 @@ class OCSControllerTest extends \Test\TestCase {
public function testJSON() {
$controller = new ChildOCSController('app', new Request(
[],
$this->getMock('\OCP\Security\ISecureRandom'),
$this->getMock('\OCP\IConfig')
$this->getMockBuilder('\OCP\Security\ISecureRandom')
->disableOriginalConstructor()
->getMock(),
$this->getMockBuilder('\OCP\IConfig')
->disableOriginalConstructor()
->getMock()
));
$expected = '{"ocs":{"meta":{"status":"failure","statuscode":400,"message":"OK",' .
'"totalitems":"","itemsperpage":""},"data":{"test":"hi"}}}';

+ 13
- 6
tests/lib/AppFramework/DependencyInjection/DIContainerTest.php View File

@@ -36,10 +36,13 @@ class DIContainerTest extends \Test\TestCase {

protected function setUp(){
parent::setUp();
$this->container = $this->getMock('OC\AppFramework\DependencyInjection\DIContainer',
['isAdminUser'], ['name']
);
$this->api = $this->getMock('OC\AppFramework\Core\API', array(), array('hi'));
$this->container = $this->getMockBuilder('OC\AppFramework\DependencyInjection\DIContainer')
->setMethods(['isAdminUser'])
->setConstructorArgs(['name'])
->getMock();
$this->api = $this->getMockBuilder('OC\AppFramework\Core\API')
->setConstructorArgs(['hi'])
->getMock();
}

public function testProvidesAPI(){
@@ -75,8 +78,12 @@ class DIContainerTest extends \Test\TestCase {
public function testMiddlewareDispatcherIncludesSecurityMiddleware(){
$this->container['Request'] = new Request(
['method' => 'GET'],
$this->getMock('\OCP\Security\ISecureRandom'),
$this->getMock('\OCP\IConfig')
$this->getMockBuilder('\OCP\Security\ISecureRandom')
->disableOriginalConstructor()
->getMock(),
$this->getMockBuilder('\OCP\IConfig')
->disableOriginalConstructor()
->getMock()
);
$security = $this->container['SecurityMiddleware'];
$dispatcher = $this->container['MiddlewareDispatcher'];

+ 41
- 15
tests/lib/AppFramework/Http/DispatcherTest.php View File

@@ -105,9 +105,11 @@ class DispatcherTest extends \Test\TestCase {
'\OC\AppFramework\Middleware\MiddlewareDispatcher')
->disableOriginalConstructor()
->getMock();
$this->controller = $this->getMock(
'\OCP\AppFramework\Controller',
array($this->controllerMethod), array($app, $request));
$this->controller = $this->getMockBuilder(
'\OCP\AppFramework\Controller')
->setMethods([$this->controllerMethod])
->setConstructorArgs([$app, $request])
->getMock();

$this->request = $this->getMockBuilder(
'\OC\AppFramework\Http\Request')
@@ -296,8 +298,12 @@ class DispatcherTest extends \Test\TestCase {
],
'method' => 'POST'
],
$this->getMock('\OCP\Security\ISecureRandom'),
$this->getMock('\OCP\IConfig')
$this->getMockBuilder('\OCP\Security\ISecureRandom')
->disableOriginalConstructor()
->getMock(),
$this->getMockBuilder('\OCP\IConfig')
->disableOriginalConstructor()
->getMock()
);
$this->dispatcher = new Dispatcher(
$this->http, $this->middlewareDispatcher, $this->reflector,
@@ -323,8 +329,12 @@ class DispatcherTest extends \Test\TestCase {
],
'method' => 'POST',
],
$this->getMock('\OCP\Security\ISecureRandom'),
$this->getMock('\OCP\IConfig')
$this->getMockBuilder('\OCP\Security\ISecureRandom')
->disableOriginalConstructor()
->getMock(),
$this->getMockBuilder('\OCP\IConfig')
->disableOriginalConstructor()
->getMock()
);
$this->dispatcher = new Dispatcher(
$this->http, $this->middlewareDispatcher, $this->reflector,
@@ -353,8 +363,12 @@ class DispatcherTest extends \Test\TestCase {
],
'method' => 'GET'
],
$this->getMock('\OCP\Security\ISecureRandom'),
$this->getMock('\OCP\IConfig')
$this->getMockBuilder('\OCP\Security\ISecureRandom')
->disableOriginalConstructor()
->getMock(),
$this->getMockBuilder('\OCP\IConfig')
->disableOriginalConstructor()
->getMock()
);
$this->dispatcher = new Dispatcher(
$this->http, $this->middlewareDispatcher, $this->reflector,
@@ -382,8 +396,12 @@ class DispatcherTest extends \Test\TestCase {
],
'method' => 'GET'
],
$this->getMock('\OCP\Security\ISecureRandom'),
$this->getMock('\OCP\IConfig')
$this->getMockBuilder('\OCP\Security\ISecureRandom')
->disableOriginalConstructor()
->getMock(),
$this->getMockBuilder('\OCP\IConfig')
->disableOriginalConstructor()
->getMock()
);
$this->dispatcher = new Dispatcher(
$this->http, $this->middlewareDispatcher, $this->reflector,
@@ -412,8 +430,12 @@ class DispatcherTest extends \Test\TestCase {
],
'method' => 'PUT'
],
$this->getMock('\OCP\Security\ISecureRandom'),
$this->getMock('\OCP\IConfig')
$this->getMockBuilder('\OCP\Security\ISecureRandom')
->disableOriginalConstructor()
->getMock(),
$this->getMockBuilder('\OCP\IConfig')
->disableOriginalConstructor()
->getMock()
);
$this->dispatcher = new Dispatcher(
$this->http, $this->middlewareDispatcher, $this->reflector,
@@ -444,8 +466,12 @@ class DispatcherTest extends \Test\TestCase {
],
'method' => 'POST'
],
$this->getMock('\OCP\Security\ISecureRandom'),
$this->getMock('\OCP\IConfig')
$this->getMockBuilder('\OCP\Security\ISecureRandom')
->disableOriginalConstructor()
->getMock(),
$this->getMockBuilder('\OCP\IConfig')
->disableOriginalConstructor()
->getMock()
);
$this->dispatcher = new Dispatcher(
$this->http, $this->middlewareDispatcher, $this->reflector,

+ 3
- 1
tests/lib/AppFramework/Http/StreamResponseTest.php View File

@@ -37,7 +37,9 @@ class StreamResponseTest extends \Test\TestCase {

protected function setUp() {
parent::setUp();
$this->output = $this->getMock('OCP\\AppFramework\\Http\\IOutput');
$this->output = $this->getMockBuilder('OCP\\AppFramework\\Http\\IOutput')
->disableOriginalConstructor()
->getMock();
}

public function testOutputNotModified(){

+ 4
- 2
tests/lib/AppFramework/Http/TemplateResponseTest.php View File

@@ -43,8 +43,10 @@ class TemplateResponseTest extends \Test\TestCase {
protected function setUp() {
parent::setUp();

$this->api = $this->getMock('OC\AppFramework\Core\API',
array('getAppName'), array('test'));
$this->api = $this->getMockBuilder('OC\AppFramework\Core\API')
->setMethods(['getAppName'])
->setConstructorArgs(['test'])
->getMock();
$this->api->expects($this->any())
->method('getAppName')
->will($this->returnValue('app'));

+ 13
- 13
tests/lib/AppFramework/Middleware/MiddlewareDispatcherTest.php View File

@@ -126,17 +126,15 @@ class MiddlewareDispatcherTest extends \Test\TestCase {


private function getControllerMock(){
return $this->getMock(
'OCP\AppFramework\Controller',
['method'],
['app',
return $this->getMockBuilder('OCP\AppFramework\Controller')
->setMethods(['method'])
->setConstructorArgs(['app',
new Request(
['method' => 'GET'],
$this->getMock('\OCP\Security\ISecureRandom'),
$this->getMock('\OCP\IConfig')
$this->getMockBuilder('\OCP\Security\ISecureRandom')->getMock(),
$this->getMockBuilder('\OCP\IConfig')->getMock()
)
]
);
])->getMock();
}


@@ -149,13 +147,15 @@ class MiddlewareDispatcherTest extends \Test\TestCase {

public function testAfterExceptionShouldReturnResponseOfMiddleware(){
$response = new Response();
$m1 = $this->getMock('\OCP\AppFramework\Middleware',
array('afterException', 'beforeController'));
$m1 = $this->getMockBuilder('\OCP\AppFramework\Middleware')
->setMethods(['afterException', 'beforeController'])
->getMock();
$m1->expects($this->never())
->method('afterException');

$m2 = $this->getMock('OCP\AppFramework\Middleware',
array('afterException', 'beforeController'));
$m2 = $this->getMockBuilder('OCP\AppFramework\Middleware')
->setMethods(['afterException', 'beforeController'])
->getMock();
$m2->expects($this->once())
->method('afterException')
->will($this->returnValue($response));
@@ -274,7 +274,7 @@ class MiddlewareDispatcherTest extends \Test\TestCase {
public function testExceptionShouldRunAfterExceptionOfOnlyPreviouslyExecutedMiddlewares(){
$m1 = $this->getMiddleware();
$m2 = $this->getMiddleware(true);
$m3 = $this->getMock('\OCP\AppFramework\Middleware');
$m3 = $this->getMockBuilder('\OCP\AppFramework\Middleware')->getMock();
$m3->expects($this->never())
->method('afterException');
$m3->expects($this->never())

+ 8
- 11
tests/lib/AppFramework/Middleware/MiddlewareTest.php View File

@@ -48,25 +48,22 @@ class MiddlewareTest extends \Test\TestCase {

$this->middleware = new ChildMiddleware();

$this->api = $this->getMockBuilder(
'OC\AppFramework\DependencyInjection\DIContainer')
$this->api = $this->getMockBuilder('OC\AppFramework\DependencyInjection\DIContainer')
->disableOriginalConstructor()
->getMock();

$this->controller = $this->getMock(
'OCP\AppFramework\Controller',
[],
[
$this->controller = $this->getMockBuilder('OCP\AppFramework\Controller')
->setMethods([])
->setConstructorArgs([
$this->api,
new Request(
[],
$this->getMock('\OCP\Security\ISecureRandom'),
$this->getMock('\OCP\IConfig')
$this->getMockBuilder('\OCP\Security\ISecureRandom')->getMock(),
$this->getMockBuilder('\OCP\IConfig')->getMock()
)
]
);
])->getMock();
$this->exception = new \Exception();
$this->response = $this->getMock('OCP\AppFramework\Http\Response');
$this->response = $this->getMockBuilder('OCP\AppFramework\Http\Response')->getMock();
}



+ 22
- 22
tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php View File

@@ -43,8 +43,8 @@ class CORSMiddlewareTest extends \Test\TestCase {
'HTTP_ORIGIN' => 'test'
]
],
$this->getMock('\OCP\Security\ISecureRandom'),
$this->getMock('\OCP\IConfig')
$this->getMockBuilder('\OCP\Security\ISecureRandom')->getMock(),
$this->getMockBuilder('\OCP\IConfig')->getMock()
);
$this->reflector->reflect($this, __FUNCTION__);
$middleware = new CORSMiddleware($request, $this->reflector, $this->session);
@@ -62,8 +62,8 @@ class CORSMiddlewareTest extends \Test\TestCase {
'HTTP_ORIGIN' => 'test'
]
],
$this->getMock('\OCP\Security\ISecureRandom'),
$this->getMock('\OCP\IConfig')
$this->getMockBuilder('\OCP\Security\ISecureRandom')->getMock(),
$this->getMockBuilder('\OCP\IConfig')->getMock()
);
$middleware = new CORSMiddleware($request, $this->reflector, $this->session);

@@ -79,8 +79,8 @@ class CORSMiddlewareTest extends \Test\TestCase {
public function testNoOriginHeaderNoCORSHEADER() {
$request = new Request(
[],
$this->getMock('\OCP\Security\ISecureRandom'),
$this->getMock('\OCP\IConfig')
$this->getMockBuilder('\OCP\Security\ISecureRandom')->getMock(),
$this->getMockBuilder('\OCP\IConfig')->getMock()
);
$this->reflector->reflect($this, __FUNCTION__);
$middleware = new CORSMiddleware($request, $this->reflector, $this->session);
@@ -102,8 +102,8 @@ class CORSMiddlewareTest extends \Test\TestCase {
'HTTP_ORIGIN' => 'test'
]
],
$this->getMock('\OCP\Security\ISecureRandom'),
$this->getMock('\OCP\IConfig')
$this->getMockBuilder('\OCP\Security\ISecureRandom')->getMock(),
$this->getMockBuilder('\OCP\IConfig')->getMock()
);
$this->reflector->reflect($this, __FUNCTION__);
$middleware = new CORSMiddleware($request, $this->reflector, $this->session);
@@ -120,8 +120,8 @@ class CORSMiddlewareTest extends \Test\TestCase {
public function testNoCORSShouldAllowCookieAuth() {
$request = new Request(
[],
$this->getMock('\OCP\Security\ISecureRandom'),
$this->getMock('\OCP\IConfig')
$this->getMockBuilder('\OCP\Security\ISecureRandom')->getMock(),
$this->getMockBuilder('\OCP\IConfig')->getMock()
);
$this->reflector->reflect($this, __FUNCTION__);
$middleware = new CORSMiddleware($request, $this->reflector, $this->session);
@@ -145,8 +145,8 @@ class CORSMiddlewareTest extends \Test\TestCase {
'PHP_AUTH_USER' => 'user',
'PHP_AUTH_PW' => 'pass'
]],
$this->getMock('\OCP\Security\ISecureRandom'),
$this->getMock('\OCP\IConfig')
$this->getMockBuilder('\OCP\Security\ISecureRandom')->getMock(),
$this->getMockBuilder('\OCP\IConfig')->getMock()
);
$this->session->expects($this->once())
->method('logout');
@@ -170,8 +170,8 @@ class CORSMiddlewareTest extends \Test\TestCase {
'PHP_AUTH_USER' => 'user',
'PHP_AUTH_PW' => 'pass'
]],
$this->getMock('\OCP\Security\ISecureRandom'),
$this->getMock('\OCP\IConfig')
$this->getMockBuilder('\OCP\Security\ISecureRandom')->getMock(),
$this->getMockBuilder('\OCP\IConfig')->getMock()
);
$this->session->expects($this->once())
->method('logout');
@@ -195,8 +195,8 @@ class CORSMiddlewareTest extends \Test\TestCase {
'PHP_AUTH_USER' => 'user',
'PHP_AUTH_PW' => 'pass'
]],
$this->getMock('\OCP\Security\ISecureRandom'),
$this->getMock('\OCP\IConfig')
$this->getMockBuilder('\OCP\Security\ISecureRandom')->getMock(),
$this->getMockBuilder('\OCP\IConfig')->getMock()
);
$this->session->expects($this->once())
->method('logout');
@@ -216,8 +216,8 @@ class CORSMiddlewareTest extends \Test\TestCase {
'PHP_AUTH_USER' => 'user',
'PHP_AUTH_PW' => 'pass'
]],
$this->getMock('\OCP\Security\ISecureRandom'),
$this->getMock('\OCP\IConfig')
$this->getMockBuilder('\OCP\Security\ISecureRandom')->getMock(),
$this->getMockBuilder('\OCP\IConfig')->getMock()
);
$middleware = new CORSMiddleware($request, $this->reflector, $this->session);
$response = $middleware->afterException($this, __FUNCTION__, new SecurityException('A security exception'));
@@ -232,8 +232,8 @@ class CORSMiddlewareTest extends \Test\TestCase {
'PHP_AUTH_USER' => 'user',
'PHP_AUTH_PW' => 'pass'
]],
$this->getMock('\OCP\Security\ISecureRandom'),
$this->getMock('\OCP\IConfig')
$this->getMockBuilder('\OCP\Security\ISecureRandom')->getMock(),
$this->getMockBuilder('\OCP\IConfig')->getMock()
);
$middleware = new CORSMiddleware($request, $this->reflector, $this->session);
$response = $middleware->afterException($this, __FUNCTION__, new SecurityException('A security exception', 501));
@@ -252,8 +252,8 @@ class CORSMiddlewareTest extends \Test\TestCase {
'PHP_AUTH_USER' => 'user',
'PHP_AUTH_PW' => 'pass'
]],
$this->getMock('\OCP\Security\ISecureRandom'),
$this->getMock('\OCP\IConfig')
$this->getMockBuilder('\OCP\Security\ISecureRandom')->getMock(),
$this->getMockBuilder('\OCP\IConfig')->getMock()
);
$middleware = new CORSMiddleware($request, $this->reflector, $this->session);
$middleware->afterException($this, __FUNCTION__, new \Exception('A regular exception'));

+ 4
- 4
tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php View File

@@ -338,8 +338,8 @@ class SecurityMiddlewareTest extends \Test\TestCase {
'REQUEST_URI' => 'owncloud/index.php/apps/specialapp'
]
],
$this->getMock('\OCP\Security\ISecureRandom'),
$this->getMock('\OCP\IConfig')
$this->getMockBuilder('\OCP\Security\ISecureRandom')->getMock(),
$this->getMockBuilder('\OCP\IConfig')->getMock()
);
$this->middleware = $this->getMiddleware(false, false);
$this->urlGenerator
@@ -396,8 +396,8 @@ class SecurityMiddlewareTest extends \Test\TestCase {
'REQUEST_URI' => 'owncloud/index.php/apps/specialapp'
]
],
$this->getMock('\OCP\Security\ISecureRandom'),
$this->getMock('\OCP\IConfig')
$this->getMockBuilder('\OCP\Security\ISecureRandom')->getMock(),
$this->getMockBuilder('\OCP\IConfig')->getMock()
);
$this->middleware = $this->getMiddleware(false, false);
$this->logger

+ 1
- 1
tests/lib/AppFramework/Middleware/SessionMiddlewareTest.php View File

@@ -36,7 +36,7 @@ class SessionMiddlewareTest extends \Test\TestCase {
$this->request = new Request(
[],
$this->getMockBuilder('\OCP\Security\ISecureRandom')->getMock(),
$this->getMock('\OCP\IConfig')
$this->getMockBuilder('\OCP\IConfig')->getMock()
);
$this->reflector = new ControllerMethodReflector();
}

+ 16
- 4
tests/lib/AppFramework/Routing/RoutingTest.php View File

@@ -74,7 +74,10 @@ class RoutingTest extends \Test\TestCase
));

// router mock
$router = $this->getMock("\OC\Route\Router", array('create'), [\OC::$server->getLogger()]);
$router = $this->getMockBuilder('\OC\Route\Router')
->setMethods(['create'])
->setConstructorArgs([\OC::$server->getLogger()])
->getMock();

// load route configuration
$container = new DIContainer('app1');
@@ -124,7 +127,10 @@ class RoutingTest extends \Test\TestCase
$route = $this->mockRoute($container, $verb, $controllerName, $actionName, $requirements, $defaults);

// router mock
$router = $this->getMock("\OC\Route\Router", array('create'), [\OC::$server->getLogger()]);
$router = $this->getMockBuilder('\OC\Route\Router')
->setMethods(['create'])
->setConstructorArgs([\OC::$server->getLogger()])
->getMock();

// we expect create to be called once:
$router
@@ -148,7 +154,10 @@ class RoutingTest extends \Test\TestCase
private function assertResource($yaml, $resourceName, $url, $controllerName, $paramName)
{
// router mock
$router = $this->getMock("\OC\Route\Router", array('create'), [\OC::$server->getLogger()]);
$router = $this->getMockBuilder('\OC\Route\Router')
->setMethods(['create'])
->setConstructorArgs([\OC::$server->getLogger()])
->getMock();

// route mocks
$container = new DIContainer('app1');
@@ -214,7 +223,10 @@ class RoutingTest extends \Test\TestCase
array $requirements=array(),
array $defaults=array()
) {
$route = $this->getMock("\OC\Route\Route", array('method', 'action', 'requirements', 'defaults'), array(), '', false);
$route = $this->getMockBuilder('\OC\Route\Route')
->setMethods(['method', 'action', 'requirements', 'defaults'])
->disableOriginalConstructor()
->getMock();
$route
->expects($this->exactly(1))
->method('method')

Loading…
Cancel
Save