From 5795482282bed45c678b26799da83e4da4ae2978 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 20 Mar 2017 11:14:14 +0100 Subject: [PATCH] createMock Signed-off-by: Joas Schilling --- tests/lib/App/AppManagerTest.php | 32 ++++++++------------------------ 1 file changed, 8 insertions(+), 24 deletions(-) diff --git a/tests/lib/App/AppManagerTest.php b/tests/lib/App/AppManagerTest.php index 4ae53801ae..bfb2893955 100644 --- a/tests/lib/App/AppManagerTest.php +++ b/tests/lib/App/AppManagerTest.php @@ -35,9 +35,7 @@ class AppManagerTest extends TestCase { */ protected function getAppConfig() { $appConfig = array(); - $config = $this->getMockBuilder(IAppConfig::class) - ->disableOriginalConstructor() - ->getMock(); + $config = $this->createMock(IAppConfig::class); $config->expects($this->any()) ->method('getValue') @@ -95,22 +93,12 @@ class AppManagerTest extends TestCase { protected function setUp() { parent::setUp(); - $this->userSession = $this->getMockBuilder(IUserSession::class) - ->disableOriginalConstructor() - ->getMock(); - $this->groupManager = $this->getMockBuilder(IGroupManager::class) - ->disableOriginalConstructor() - ->getMock(); + $this->userSession = $this->createMock(IUserSession::class); + $this->groupManager = $this->createMock(IGroupManager::class); $this->appConfig = $this->getAppConfig(); - $this->cacheFactory = $this->getMockBuilder(ICacheFactory::class) - ->disableOriginalConstructor() - ->getMock(); - $this->cache = $this->getMockBuilder(ICache::class) - ->disableOriginalConstructor() - ->getMock(); - $this->eventDispatcher = $this->getMockBuilder(EventDispatcherInterface::class) - ->disableOriginalConstructor() - ->getMock(); + $this->cacheFactory = $this->createMock(ICacheFactory::class); + $this->cache = $this->createMock(ICache::class); + $this->eventDispatcher = $this->createMock(EventDispatcherInterface::class); $this->cacheFactory->expects($this->any()) ->method('create') ->with('settings') @@ -267,12 +255,8 @@ class AppManagerTest extends TestCase { } private function newUser($uid) { - $config = $this->getMockBuilder(IConfig::class) - ->disableOriginalConstructor() - ->getMock(); - $urlgenerator = $this->getMockBuilder(IURLGenerator::class) - ->disableOriginalConstructor() - ->getMock(); + $config = $this->createMock(IConfig::class); + $urlgenerator = $this->createMock(IURLGenerator::class); return new User($uid, null, null, $config, $urlgenerator); }