make tests php 5.4 / phpunit 4.8 compatible
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
This commit is contained in:
parent
005d264d60
commit
0898cfce98
|
@ -56,11 +56,18 @@ class User_LDAPTest extends TestCase {
|
||||||
* @return \PHPUnit_Framework_MockObject_MockObject|Access
|
* @return \PHPUnit_Framework_MockObject_MockObject|Access
|
||||||
*/
|
*/
|
||||||
private function getAccessMock() {
|
private function getAccessMock() {
|
||||||
$lw = $this->getMock('\OCA\User_LDAP\ILDAPWrapper');
|
static $conMethods;
|
||||||
$connector = $this->getMockBuilder('\OCA\User_LDAP\Connection')
|
static $accMethods;
|
||||||
->setMethodsExcept(['getConnection'])
|
|
||||||
->setConstructorArgs([$lw, null, null])
|
if(is_null($conMethods) || is_null($accMethods)) {
|
||||||
->getMock();
|
$conMethods = get_class_methods('\OCA\User_LDAP\Connection');
|
||||||
|
$accMethods = get_class_methods('\OCA\User_LDAP\Access');
|
||||||
|
unset($accMethods[array_search('getConnection', $accMethods)]);
|
||||||
|
}
|
||||||
|
$lw = $this->getMock('\OCA\User_LDAP\ILDAPWrapper');
|
||||||
|
$connector = $this->getMock(
|
||||||
|
'\OCA\User_LDAP\Connection', $conMethods, array($lw, null, null)
|
||||||
|
);
|
||||||
|
|
||||||
$this->configMock = $this->getMock('\OCP\IConfig');
|
$this->configMock = $this->getMock('\OCP\IConfig');
|
||||||
|
|
||||||
|
@ -87,10 +94,10 @@ class User_LDAPTest extends TestCase {
|
||||||
|
|
||||||
$helper = new Helper();
|
$helper = new Helper();
|
||||||
|
|
||||||
$access = $this->getMockBuilder('OCA\User_LDAP\Access')
|
$access = $this->getMock('\OCA\User_LDAP\Access',
|
||||||
->setMethodsExcept(['getConnection'])
|
$accMethods,
|
||||||
->setConstructorArgs([$connector, $lw, $um, $helper])
|
array($connector, $lw, $um, $helper)
|
||||||
->getMock();
|
);
|
||||||
|
|
||||||
$um->setLdapAccess($access);
|
$um->setLdapAccess($access);
|
||||||
|
|
||||||
|
@ -863,7 +870,7 @@ class User_LDAPTest extends TestCase {
|
||||||
->method('writeToCache')
|
->method('writeToCache')
|
||||||
->with($this->equalTo('loginName2UserName-'.$loginName), $this->equalTo($username));
|
->with($this->equalTo('loginName2UserName-'.$loginName), $this->equalTo($username));
|
||||||
|
|
||||||
$backend = new UserLDAP($access, $this->createMock('\OCP\IConfig'));
|
$backend = new UserLDAP($access, $this->getMock('\OCP\IConfig'));
|
||||||
$name = $backend->loginName2UserName($loginName);
|
$name = $backend->loginName2UserName($loginName);
|
||||||
$this->assertSame($username, $name);
|
$this->assertSame($username, $name);
|
||||||
|
|
||||||
|
@ -892,7 +899,7 @@ class User_LDAPTest extends TestCase {
|
||||||
->method('writeToCache')
|
->method('writeToCache')
|
||||||
->with($this->equalTo('loginName2UserName-'.$loginName), false);
|
->with($this->equalTo('loginName2UserName-'.$loginName), false);
|
||||||
|
|
||||||
$backend = new UserLDAP($access, $this->createMock('\OCP\IConfig'));
|
$backend = new UserLDAP($access, $this->getMock('\OCP\IConfig'));
|
||||||
$name = $backend->loginName2UserName($loginName);
|
$name = $backend->loginName2UserName($loginName);
|
||||||
$this->assertSame(false, $name);
|
$this->assertSame(false, $name);
|
||||||
|
|
||||||
|
@ -937,7 +944,7 @@ class User_LDAPTest extends TestCase {
|
||||||
->method('getUserValue')
|
->method('getUserValue')
|
||||||
->willReturn(1);
|
->willReturn(1);
|
||||||
|
|
||||||
$backend = new UserLDAP($access, $this->createMock('\OCP\IConfig'));
|
$backend = new UserLDAP($access, $this->getMock('\OCP\IConfig'));
|
||||||
$name = $backend->loginName2UserName($loginName);
|
$name = $backend->loginName2UserName($loginName);
|
||||||
$this->assertSame(false, $name);
|
$this->assertSame(false, $name);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue