$umMethods = get_class_methods('\OCA\User_LDAP\User\Manager');
}
$lw = $this->createMock(ILDAPWrapper::class);
- $connector = $this->getMock('\OCA\User_LDAP\Connection',
- $conMethods,
- array($lw, null, null));
- $um = $this->getMock('\OCA\User_LDAP\User\Manager',
- $umMethods, array(
+ $connector = $this->getMockBuilder('\OCA\User_LDAP\Connection')
+ ->setMethods($conMethods)
+ ->setConstructorArgs([$lw, null, null])
+ ->getMock();
+ $um = $this->getMockBuilder('\OCA\User_LDAP\User\Manager')
$this->createMock(IConfig::class),
$this->createMock(FilesystemHelper::class),
$this->createMock(LogWrapper::class),
$this->createMock(IDBConnection::class),
$this->createMock(IUserManager::class)));
$helper = new \OCA\User_LDAP\Helper(\OC::$server->getConfig());
+ $this->createMock('\OCP\IUserManager')
+ ])
+ ->getMock();
return array($lw, $connector, $um, $helper);
}
$this->ldap = $this->createMock(ILDAPWrapper::class);
// we use a mock here to replace the cache mechanism, due to missing DI in LDAP backend.
$this->connection = $this->getMockBuilder('OCA\User_LDAP\Connection')
- ->setMethods(['getFromCache', 'writeToCache'])
- ->setConstructorArgs([$this->ldap, '', null])
- ->getMock();
+ ->setMethods(['getFromCache', 'writeToCache'])
+ ->setConstructorArgs([$this->ldap, '', null])
+ ->getMock();
$this->ldap->expects($this->any())
->method('areLDAPFunctionsAvailable')
$accMethods = get_class_methods('\OCA\User_LDAP\Access');
}
$lw = $this->createMock(ILDAPWrapper::class);
- $connector = $this->getMock('\OCA\User_LDAP\Connection',
- $conMethods,
- array($lw, null, null));
+ $connector = $this->getMockBuilder('\OCA\User_LDAP\Connection')
+ ->setMethods($conMethods)
+ ->setConstructorArgs([$lw, null, null])
+ ->getMock();
$um = $this->getMockBuilder('\OCA\User_LDAP\User\Manager')
->disableOriginalConstructor()
->getMock();
$helper = new \OCA\User_LDAP\Helper(\OC::$server->getConfig());
- $access = $this->getMock('\OCA\User_LDAP\Access',
- $accMethods,
- array($connector, $lw, $um, $helper));
+ $access = $this->getMockBuilder('\OCA\User_LDAP\Access')
+ ->setMethods($accMethods)
+ ->setConstructorArgs([$connector, $lw, $um, $helper])
+ ->getMock();
$access->expects($this->any())
->method('getConnection')
if (is_null($userMgr)) {
$userMgr = $this->createMock(IUserManager::class);
}
- $um = $this->getMock('\OCA\User_LDAP\User\Manager',
- $umMethods, array($cfMock, $fsMock, $logMock, $avaMgr, $im, $dbc, $userMgr));
- $connector = $this->getMock('\OCA\User_LDAP\Connection',
- $conMethods, array($lw, null, null));
+ $um = $this->getMockBuilder('\OCA\User_LDAP\User\Manager')
+ ->setMethods($umMethods)
+ ->setConstructorArgs([$cfMock, $fsMock, $logMock, $avaMgr, $im, $dbc, $userMgr])
+ ->getMock();
$helper = new \OCA\User_LDAP\Helper(\OC::$server->getConfig());
- $access = $this->getMock('\OCA\User_LDAP\Access',
- $accMethods, array($connector, $lw, $um, $helper));
+ $connector = $this->getMockBuilder('\OCA\User_LDAP\Connection')
+ ->setMethods($conMethods)
+ ->setConstructorArgs([$lw, null, null])
+ ->getMock();
+ $access = $this->getMockBuilder('\OCA\User_LDAP\Access')
+ ->setMethods($accMethods)
+ ->setConstructorArgs([$connector, $lw, $um, $helper])
+ ->getMock();
return array($access, $connector);
}
$accMethods = get_class_methods('\OCA\User_LDAP\Access');
}
$lw = $this->createMock(ILDAPWrapper::class);
- $conf = $this->getMock('\OCA\User_LDAP\Configuration',
- $confMethods,
- array($lw, null, null));
-
- $connector = $this->getMock('\OCA\User_LDAP\Connection',
- $connMethods, array($lw, null, null));
+ $conf = $this->getMockBuilder('\OCA\User_LDAP\Configuration')
+ ->setMethods($confMethods)
+ ->setConstructorArgs([$lw, null, null])
+ ->getMock();
+
+ $connector = $this->getMockBuilder('\OCA\User_LDAP\Connection')
+ ->setMethods($connMethods)
+ ->setConstructorArgs([$lw, null, null])
+ ->getMock();
+
$um = $this->getMockBuilder('\OCA\User_LDAP\User\Manager')
- ->disableOriginalConstructor()
- ->getMock();
+ ->disableOriginalConstructor()
+ ->getMock();
$helper = new \OCA\User_LDAP\Helper(\OC::$server->getConfig());
- $access = $this->getMock('\OCA\User_LDAP\Access',
- $accMethods, array($connector, $lw, $um, $helper));
+ $access = $this->getMockBuilder('\OCA\User_LDAP\Access')
+ ->setMethods($accMethods)
+ ->setConstructorArgs([$connector, $lw, $um, $helper])
+ ->getMock();
return array(new Wizard($conf, $lw, $access), $conf, $lw, $access);
}