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() {
$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);
}