createMock

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2017-03-20 11:14:14 +01:00
parent 3eb8313657
commit 5795482282
No known key found for this signature in database
GPG Key ID: E166FD8976B3BAC8
1 changed files with 8 additions and 24 deletions

View File

@ -35,9 +35,7 @@ class AppManagerTest extends TestCase {
*/ */
protected function getAppConfig() { protected function getAppConfig() {
$appConfig = array(); $appConfig = array();
$config = $this->getMockBuilder(IAppConfig::class) $config = $this->createMock(IAppConfig::class);
->disableOriginalConstructor()
->getMock();
$config->expects($this->any()) $config->expects($this->any())
->method('getValue') ->method('getValue')
@ -95,22 +93,12 @@ class AppManagerTest extends TestCase {
protected function setUp() { protected function setUp() {
parent::setUp(); parent::setUp();
$this->userSession = $this->getMockBuilder(IUserSession::class) $this->userSession = $this->createMock(IUserSession::class);
->disableOriginalConstructor() $this->groupManager = $this->createMock(IGroupManager::class);
->getMock();
$this->groupManager = $this->getMockBuilder(IGroupManager::class)
->disableOriginalConstructor()
->getMock();
$this->appConfig = $this->getAppConfig(); $this->appConfig = $this->getAppConfig();
$this->cacheFactory = $this->getMockBuilder(ICacheFactory::class) $this->cacheFactory = $this->createMock(ICacheFactory::class);
->disableOriginalConstructor() $this->cache = $this->createMock(ICache::class);
->getMock(); $this->eventDispatcher = $this->createMock(EventDispatcherInterface::class);
$this->cache = $this->getMockBuilder(ICache::class)
->disableOriginalConstructor()
->getMock();
$this->eventDispatcher = $this->getMockBuilder(EventDispatcherInterface::class)
->disableOriginalConstructor()
->getMock();
$this->cacheFactory->expects($this->any()) $this->cacheFactory->expects($this->any())
->method('create') ->method('create')
->with('settings') ->with('settings')
@ -267,12 +255,8 @@ class AppManagerTest extends TestCase {
} }
private function newUser($uid) { private function newUser($uid) {
$config = $this->getMockBuilder(IConfig::class) $config = $this->createMock(IConfig::class);
->disableOriginalConstructor() $urlgenerator = $this->createMock(IURLGenerator::class);
->getMock();
$urlgenerator = $this->getMockBuilder(IURLGenerator::class)
->disableOriginalConstructor()
->getMock();
return new User($uid, null, null, $config, $urlgenerator); return new User($uid, null, null, $config, $urlgenerator);
} }