From 0e5147f0013b3ef19736e0ccc4a23e46defbe14c Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Thu, 1 Nov 2018 11:29:29 +0100 Subject: Fix tests Signed-off-by: Roeland Jago Douma --- tests/lib/AppFramework/AppTest.php | 15 +++++---------- .../AppFramework/DependencyInjection/DIContainerTest.php | 9 ++------- 2 files changed, 7 insertions(+), 17 deletions(-) (limited to 'tests') diff --git a/tests/lib/AppFramework/AppTest.php b/tests/lib/AppFramework/AppTest.php index 93b8768e674..b31f4428777 100644 --- a/tests/lib/AppFramework/AppTest.php +++ b/tests/lib/AppFramework/AppTest.php @@ -25,6 +25,8 @@ namespace Test\AppFramework; use OC\AppFramework\App; +use OC\AppFramework\Http\Dispatcher; +use OCP\AppFramework\Controller; use OCP\AppFramework\Http; use OCP\AppFramework\Http\Response; @@ -60,16 +62,9 @@ class AppTest extends \Test\TestCase { parent::setUp(); $this->container = new \OC\AppFramework\DependencyInjection\DIContainer('test', array()); - $this->controller = $this->getMockBuilder( - 'OCP\AppFramework\Controller') - ->disableOriginalConstructor() - ->getMock(); - $this->dispatcher = $this->getMockBuilder( - 'OC\AppFramework\Http\Dispatcher') - ->disableOriginalConstructor() - ->getMock(); - - $this->io = $this->getMockBuilder('OCP\\AppFramework\\Http\\IOutput')->getMock(); + $this->controller = $this->createMock(Controller::class); + $this->dispatcher = $this->createMock(Dispatcher::class); + $this->io = $this->createMock(Http\IOutput::class); $this->headers = array('key' => 'value'); $this->output = 'hi'; diff --git a/tests/lib/AppFramework/DependencyInjection/DIContainerTest.php b/tests/lib/AppFramework/DependencyInjection/DIContainerTest.php index d4581aaaf23..5f089e96018 100644 --- a/tests/lib/AppFramework/DependencyInjection/DIContainerTest.php +++ b/tests/lib/AppFramework/DependencyInjection/DIContainerTest.php @@ -40,7 +40,6 @@ class DIContainerTest extends \Test\TestCase { /** @var DIContainer|\PHPUnit_Framework_MockObject_MockObject */ private $container; - private $api; protected function setUp(){ parent::setUp(); @@ -78,12 +77,8 @@ class DIContainerTest extends \Test\TestCase { public function testMiddlewareDispatcherIncludesSecurityMiddleware(){ $this->container['Request'] = new Request( ['method' => 'GET'], - $this->getMockBuilder(ISecureRandom::class) - ->disableOriginalConstructor() - ->getMock(), - $this->getMockBuilder(IConfig::class) - ->disableOriginalConstructor() - ->getMock() + $this->createMock(ISecureRandom::class), + $this->createMock(IConfig::class) ); $security = $this->container['SecurityMiddleware']; $dispatcher = $this->container['MiddlewareDispatcher']; -- cgit v1.2.3