summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorVictor Dubiniuk <victor.dubiniuk@gmail.com>2016-09-27 23:54:37 +0300
committerArthur Schiwon <blizzz@arthur-schiwon.de>2016-10-13 01:06:45 +0200
commitc4fcd1f282132cdea2cb97c162b2b461e022390a (patch)
tree5ac3d78f541bebc375ec93d1ee447027c5d5689d /apps
parent011d5f554c1fcc2896c8798c9ef29b59af7b2692 (diff)
downloadnextcloud-server-c4fcd1f282132cdea2cb97c162b2b461e022390a.tar.gz
nextcloud-server-c4fcd1f282132cdea2cb97c162b2b461e022390a.zip
Update tests for phunit 5.5
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'apps')
-rw-r--r--apps/user_ldap/tests/AccessTest.php13
-rw-r--r--apps/user_ldap/tests/ConnectionTest.php6
-rw-r--r--apps/user_ldap/tests/Group_LDAPTest.php14
-rw-r--r--apps/user_ldap/tests/User/UserTest.php18
-rw-r--r--apps/user_ldap/tests/WizardTest.php26
5 files changed, 47 insertions, 30 deletions
diff --git a/apps/user_ldap/tests/AccessTest.php b/apps/user_ldap/tests/AccessTest.php
index eb660afee70..f7b6fa36334 100644
--- a/apps/user_ldap/tests/AccessTest.php
+++ b/apps/user_ldap/tests/AccessTest.php
@@ -55,11 +55,11 @@ class AccessTest extends \Test\TestCase {
$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),
@@ -68,6 +68,9 @@ class AccessTest extends \Test\TestCase {
$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);
}
diff --git a/apps/user_ldap/tests/ConnectionTest.php b/apps/user_ldap/tests/ConnectionTest.php
index fcff65efb33..e013773b7d9 100644
--- a/apps/user_ldap/tests/ConnectionTest.php
+++ b/apps/user_ldap/tests/ConnectionTest.php
@@ -47,9 +47,9 @@ class ConnectionTest extends \Test\TestCase {
$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')
diff --git a/apps/user_ldap/tests/Group_LDAPTest.php b/apps/user_ldap/tests/Group_LDAPTest.php
index 9bda3b8ceb5..906db6bb17b 100644
--- a/apps/user_ldap/tests/Group_LDAPTest.php
+++ b/apps/user_ldap/tests/Group_LDAPTest.php
@@ -48,16 +48,18 @@ class Group_LDAPTest extends \Test\TestCase {
$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')
diff --git a/apps/user_ldap/tests/User/UserTest.php b/apps/user_ldap/tests/User/UserTest.php
index 121b1102653..c261a2abaa2 100644
--- a/apps/user_ldap/tests/User/UserTest.php
+++ b/apps/user_ldap/tests/User/UserTest.php
@@ -77,13 +77,19 @@ class UserTest extends \Test\TestCase {
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);
}
diff --git a/apps/user_ldap/tests/WizardTest.php b/apps/user_ldap/tests/WizardTest.php
index af3b692c7dd..545d112338b 100644
--- a/apps/user_ldap/tests/WizardTest.php
+++ b/apps/user_ldap/tests/WizardTest.php
@@ -61,18 +61,24 @@ class WizardTest extends \Test\TestCase {
$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);
}