diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2016-07-10 14:17:26 +0200 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2016-07-11 08:50:07 +0200 |
commit | 2fa9e672940012bfff5c3763d573158960416372 (patch) | |
tree | 558f3acefa54f5fc5303e3320795ac6855e2c0a7 /tests/lib/AppFramework/Http | |
parent | 67278d12e1f572d390722935f0eeb9aed34b708c (diff) | |
download | nextcloud-server-2fa9e672940012bfff5c3763d573158960416372.tar.gz nextcloud-server-2fa9e672940012bfff5c3763d573158960416372.zip |
Fix phpunit-5.4 wargning
* getMock is deprecated.
* \PDOStatement mocking fails hard on phpunit 4.8
Diffstat (limited to 'tests/lib/AppFramework/Http')
-rw-r--r-- | tests/lib/AppFramework/Http/DispatcherTest.php | 56 | ||||
-rw-r--r-- | tests/lib/AppFramework/Http/StreamResponseTest.php | 4 | ||||
-rw-r--r-- | tests/lib/AppFramework/Http/TemplateResponseTest.php | 6 |
3 files changed, 48 insertions, 18 deletions
diff --git a/tests/lib/AppFramework/Http/DispatcherTest.php b/tests/lib/AppFramework/Http/DispatcherTest.php index 6df6f7fa7fe..c2d73adfd7b 100644 --- a/tests/lib/AppFramework/Http/DispatcherTest.php +++ b/tests/lib/AppFramework/Http/DispatcherTest.php @@ -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, diff --git a/tests/lib/AppFramework/Http/StreamResponseTest.php b/tests/lib/AppFramework/Http/StreamResponseTest.php index 1f761d6b89c..c082b36e0ac 100644 --- a/tests/lib/AppFramework/Http/StreamResponseTest.php +++ b/tests/lib/AppFramework/Http/StreamResponseTest.php @@ -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(){ diff --git a/tests/lib/AppFramework/Http/TemplateResponseTest.php b/tests/lib/AppFramework/Http/TemplateResponseTest.php index 87fb6864f78..4f779e8c697 100644 --- a/tests/lib/AppFramework/Http/TemplateResponseTest.php +++ b/tests/lib/AppFramework/Http/TemplateResponseTest.php @@ -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')); |