Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2020-03-26 00:21:27 +0300
committerChristoph Wurst <christoph@winzerhof-wurst.at>2020-03-26 00:21:27 +0300
commit2ee65f177e4f7e09ad2287f14d564e7068d322fb (patch)
tree39075e87ea7927e20e8956824cb7c49bf626b178 /apps/user_ldap
parent3cf321fdfc4235a87015a9af2f59c63220016c65 (diff)
Use the shorter phpunit syntax for mocked return values
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'apps/user_ldap')
-rw-r--r--apps/user_ldap/tests/AccessTest.php28
-rw-r--r--apps/user_ldap/tests/ConnectionTest.php44
-rw-r--r--apps/user_ldap/tests/Group_LDAPTest.php116
-rw-r--r--apps/user_ldap/tests/HelperTest.php8
-rw-r--r--apps/user_ldap/tests/Jobs/CleanUpTest.php10
-rw-r--r--apps/user_ldap/tests/User/ManagerTest.php18
-rw-r--r--apps/user_ldap/tests/User/UserTest.php168
-rw-r--r--apps/user_ldap/tests/User_LDAPTest.php140
-rw-r--r--apps/user_ldap/tests/WizardTest.php120
9 files changed, 326 insertions, 326 deletions
diff --git a/apps/user_ldap/tests/AccessTest.php b/apps/user_ldap/tests/AccessTest.php
index 012a6831eb4..e8fa47c6ab9 100644
--- a/apps/user_ldap/tests/AccessTest.php
+++ b/apps/user_ldap/tests/AccessTest.php
@@ -187,7 +187,7 @@ class AccessTest extends TestCase {
$this->ldap->expects($this->once())
->method('explodeDN')
->with($inputDN, 0)
- ->will($this->returnValue(explode(',', $inputDN)));
+ ->willReturn(explode(',', $inputDN));
$this->assertSame($domainDN, $this->access->getDomainDNFromDN($inputDN));
}
@@ -199,7 +199,7 @@ class AccessTest extends TestCase {
$this->ldap->expects($this->once())
->method('explodeDN')
->with($inputDN, 0)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->assertSame($expected, $this->access->getDomainDNFromDN($inputDN));
}
@@ -236,12 +236,12 @@ class AccessTest extends TestCase {
$lw->expects($this->exactly(1))
->method('explodeDN')
- ->will($this->returnCallback(function ($dn) use ($case) {
+ ->willReturnCallback(function ($dn) use ($case) {
if($dn === $case['input']) {
return $case['interResult'];
}
return null;
- }));
+ });
$this->assertSame($case['expectedResult'], $access->stringResemblesDN($case['input']));
}
@@ -294,7 +294,7 @@ class AccessTest extends TestCase {
// also returns for userUuidAttribute
$this->access->connection->expects($this->any())
->method('__get')
- ->will($this->returnValue('displayName'));
+ ->willReturn('displayName');
$this->access->setUserMapper($mapperMock);
@@ -319,7 +319,7 @@ class AccessTest extends TestCase {
$this->userManager->expects($this->exactly(count($data) * 2))
->method('get')
- ->will($this->returnValue($userMock));
+ ->willReturn($userMock);
$this->access->batchApplyUserAttributes($data);
}
@@ -329,13 +329,13 @@ class AccessTest extends TestCase {
$mapperMock = $this->createMock(UserMapping::class);
$mapperMock->expects($this->any())
->method('getNameByDN')
- ->will($this->returnValue('a_username'));
+ ->willReturn('a_username');
$userMock = $this->createMock(User::class);
$this->access->connection->expects($this->any())
->method('__get')
- ->will($this->returnValue('displayName'));
+ ->willReturn('displayName');
$this->access->setUserMapper($mapperMock);
@@ -370,13 +370,13 @@ class AccessTest extends TestCase {
$mapperMock = $this->createMock(UserMapping::class);
$mapperMock->expects($this->any())
->method('getNameByDN')
- ->will($this->returnValue('a_username'));
+ ->willReturn('a_username');
$userMock = $this->createMock(User::class);
$this->access->connection->expects($this->any())
->method('__get')
- ->will($this->returnValue('displayName'));
+ ->willReturn('displayName');
$this->access->setUserMapper($mapperMock);
@@ -401,7 +401,7 @@ class AccessTest extends TestCase {
$this->userManager->expects($this->exactly(count($data) * 2))
->method('get')
- ->will($this->returnValue($userMock));
+ ->willReturn($userMock);
$this->access->batchApplyUserAttributes($data);
}
@@ -429,12 +429,12 @@ class AccessTest extends TestCase {
$lw->expects($this->any())
->method('isResource')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$lw->expects($this->any())
->method('getAttributes')
- ->will($this->returnValue(array(
+ ->willReturn(array(
$attribute => array('count' => 1, $dnFromServer)
- )));
+ ));
$access = new Access($con, $lw, $um, $helper, $config, $this->ncUserManager);
$values = $access->readAttribute('uid=whoever,dc=example,dc=org', $attribute);
diff --git a/apps/user_ldap/tests/ConnectionTest.php b/apps/user_ldap/tests/ConnectionTest.php
index 26921592405..82e6f85952d 100644
--- a/apps/user_ldap/tests/ConnectionTest.php
+++ b/apps/user_ldap/tests/ConnectionTest.php
@@ -57,7 +57,7 @@ class ConnectionTest extends \Test\TestCase {
$this->ldap->expects($this->any())
->method('areLDAPFunctionsAvailable')
- ->will($this->returnValue(true));
+ ->willReturn(true);
}
public function testOriginalAgentUnchangedOnClone() {
@@ -105,19 +105,19 @@ class ConnectionTest extends \Test\TestCase {
$this->ldap->expects($this->any())
->method('isResource')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->ldap->expects($this->any())
->method('setOption')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->ldap->expects($this->exactly(3))
->method('connect')
- ->will($this->returnValue('ldapResource'));
+ ->willReturn('ldapResource');
$this->ldap->expects($this->any())
->method('errno')
- ->will($this->returnValue(0));
+ ->willReturn(0);
// Not called often enough? Then, the fallback to the backup server is broken.
$this->connection->expects($this->exactly(4))
@@ -132,13 +132,13 @@ class ConnectionTest extends \Test\TestCase {
$isThrown = false;
$this->ldap->expects($this->exactly(3))
->method('bind')
- ->will($this->returnCallback(function () use (&$isThrown) {
+ ->willReturnCallback(function () use (&$isThrown) {
if(!$isThrown) {
$isThrown = true;
throw new \OC\ServerNotAvailableException();
}
return true;
- }));
+ });
$this->connection->init();
$this->connection->resetConnectionResource();
@@ -164,19 +164,19 @@ class ConnectionTest extends \Test\TestCase {
$this->ldap->expects($this->any())
->method('isResource')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->ldap->expects($this->any())
->method('setOption')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->ldap->expects($this->once())
->method('connect')
- ->will($this->returnValue('ldapResource'));
+ ->willReturn('ldapResource');
$this->ldap->expects($this->any())
->method('errno')
- ->will($this->returnValue(49));
+ ->willReturn(49);
$this->connection->expects($this->any())
->method('getFromCache')
@@ -212,24 +212,24 @@ class ConnectionTest extends \Test\TestCase {
$this->ldap->expects($this->any())
->method('isResource')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->ldap->expects($this->any())
->method('setOption')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->ldap->expects($this->any())
->method('connect')
- ->will($this->returnValue('ldapResource'));
+ ->willReturn('ldapResource');
$this->ldap->expects($this->once())
->method('bind')
- ->will($this->returnValue(false));
+ ->willReturn(false);
// LDAP_INVALID_CREDENTIALS
$this->ldap->expects($this->any())
->method('errno')
- ->will($this->returnValue(0x31));
+ ->willReturn(0x31);
try {
$this->assertFalse($this->connection->bind(), 'Connection::bind() should not return true with invalid credentials.');
@@ -259,27 +259,27 @@ class ConnectionTest extends \Test\TestCase {
$this->ldap->expects($this->any())
->method('isResource')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->ldap->expects($this->any())
->method('connect')
- ->will($this->returnValue('ldapResource'));
+ ->willReturn('ldapResource');
$this->ldap->expects($this->any())
->method('setOption')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->ldap->expects($this->any())
->method('bind')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->ldap->expects($this->any())
->method('errno')
- ->will($this->returnValue(0));
+ ->willReturn(0);
$this->ldap->expects($this->any())
->method('startTls')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->expectException(\OC\ServerNotAvailableException::class);
$this->expectExceptionMessage('Start TLS failed, when connecting to LDAP host ' . $host . '.');
diff --git a/apps/user_ldap/tests/Group_LDAPTest.php b/apps/user_ldap/tests/Group_LDAPTest.php
index 7ea4cb463d9..5fdc3c5862c 100644
--- a/apps/user_ldap/tests/Group_LDAPTest.php
+++ b/apps/user_ldap/tests/Group_LDAPTest.php
@@ -70,7 +70,7 @@ class Group_LDAPTest extends TestCase {
$access->expects($this->any())
->method('getConnection')
- ->will($this->returnValue($connector));
+ ->willReturn($connector);
return $access;
}
@@ -87,12 +87,12 @@ class Group_LDAPTest extends TestCase {
$access->connection->expects($this->any())
->method('__get')
- ->will($this->returnCallback(function($name) {
+ ->willReturnCallback(function($name) {
if($name === 'ldapDynamicGroupMemberURL') {
return '';
}
return 1;
- }));
+ });
}
public function testCountEmptySearchString() {
@@ -104,7 +104,7 @@ class Group_LDAPTest extends TestCase {
$access->expects($this->any())
->method('groupname2dn')
- ->will($this->returnValue($groupDN));
+ ->willReturn($groupDN);
$access->expects($this->any())
->method('readAttribute')
@@ -123,7 +123,7 @@ class Group_LDAPTest extends TestCase {
// for primary groups
$access->expects($this->once())
->method('countUsers')
- ->will($this->returnValue(2));
+ ->willReturn(2);
$groupBackend = new GroupLDAP($access, $pluginManager);
$users = $groupBackend->countUsersInGroup('group');
@@ -139,15 +139,15 @@ class Group_LDAPTest extends TestCase {
$access->expects($this->any())
->method('groupname2dn')
- ->will($this->returnValue('cn=group,dc=foo,dc=bar'));
+ ->willReturn('cn=group,dc=foo,dc=bar');
$access->expects($this->any())
->method('fetchListOfUsers')
- ->will($this->returnValue([]));
+ ->willReturn([]);
$access->expects($this->any())
->method('readAttribute')
- ->will($this->returnCallback(function($name) {
+ ->willReturnCallback(function($name) {
//the search operation will call readAttribute, thus we need
//to anaylze the "dn". All other times we just need to return
//something that is neither null or false, but once an array
@@ -157,13 +157,13 @@ class Group_LDAPTest extends TestCase {
return strpos($name, '3');
}
return ['u11', 'u22', 'u33', 'u34'];
- }));
+ });
$access->expects($this->any())
->method('dn2username')
- ->will($this->returnCallback(function() {
+ ->willReturnCallback(function() {
return 'foobar' . \OC::$server->getSecureRandom()->generate(7);
- }));
+ });
$groupBackend = new GroupLDAP($access,$pluginManager);
$users = $groupBackend->countUsersInGroup('group', '3');
@@ -205,12 +205,12 @@ class Group_LDAPTest extends TestCase {
$access->expects($this->once())
->method('searchGroups')
- ->will($this->returnValue([['dn' => ['cn=foo,dc=barfoo,dc=bar']]]));
+ ->willReturn([['dn' => ['cn=foo,dc=barfoo,dc=bar']]]);
$access->expects($this->once())
->method('dn2groupname')
->with('cn=foo,dc=barfoo,dc=bar')
- ->will($this->returnValue('MyGroup'));
+ ->willReturn('MyGroup');
$groupBackend = new GroupLDAP($access, $pluginManager);
@@ -229,7 +229,7 @@ class Group_LDAPTest extends TestCase {
$access->expects($this->once())
->method('searchGroups')
- ->will($this->returnValue(array()));
+ ->willReturn(array());
$access->expects($this->never())
->method('dn2groupname');
@@ -251,11 +251,11 @@ class Group_LDAPTest extends TestCase {
$access->expects($this->once())
->method('searchGroups')
- ->will($this->returnValue([['dn' => ['cn=foo,dc=barfoo,dc=bar']]]));
+ ->willReturn([['dn' => ['cn=foo,dc=barfoo,dc=bar']]]);
$access->expects($this->once())
->method('dn2groupname')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$groupBackend = new GroupLDAP($access, $pluginManager);
@@ -276,7 +276,7 @@ class Group_LDAPTest extends TestCase {
$access->expects($this->once())
->method('readAttribute')
->with($dn, $attr)
- ->will($this->returnValue(array('3117')));
+ ->willReturn(array('3117'));
$groupBackend = new GroupLDAP($access, $pluginManager);
@@ -297,7 +297,7 @@ class Group_LDAPTest extends TestCase {
$access->expects($this->once())
->method('readAttribute')
->with($dn, $attr)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$groupBackend = new GroupLDAP($access, $pluginManager);
@@ -317,16 +317,16 @@ class Group_LDAPTest extends TestCase {
$access->expects($this->once())
->method('getSID')
->with($userDN)
- ->will($this->returnValue('S-1-5-21-249921958-728525901-1594176202'));
+ ->willReturn('S-1-5-21-249921958-728525901-1594176202');
$access->expects($this->once())
->method('searchGroups')
- ->will($this->returnValue([['dn' => ['cn=foo,dc=barfoo,dc=bar']]]));
+ ->willReturn([['dn' => ['cn=foo,dc=barfoo,dc=bar']]]);
$access->expects($this->once())
->method('dn2groupname')
->with('cn=foo,dc=barfoo,dc=bar')
- ->will($this->returnValue('MyGroup'));
+ ->willReturn('MyGroup');
$groupBackend = new GroupLDAP($access, $pluginManager);
@@ -346,7 +346,7 @@ class Group_LDAPTest extends TestCase {
$access->expects($this->once())
->method('getSID')
->with($userDN)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$access->expects($this->never())
->method('searchGroups');
@@ -372,11 +372,11 @@ class Group_LDAPTest extends TestCase {
$access->expects($this->once())
->method('getSID')
->with($userDN)
- ->will($this->returnValue('S-1-5-21-249921958-728525901-1594176202'));
+ ->willReturn('S-1-5-21-249921958-728525901-1594176202');
$access->expects($this->once())
->method('searchGroups')
- ->will($this->returnValue(array()));
+ ->willReturn(array());
$access->expects($this->never())
->method('dn2groupname');
@@ -399,15 +399,15 @@ class Group_LDAPTest extends TestCase {
$access->expects($this->once())
->method('getSID')
->with($userDN)
- ->will($this->returnValue('S-1-5-21-249921958-728525901-1594176202'));
+ ->willReturn('S-1-5-21-249921958-728525901-1594176202');
$access->expects($this->once())
->method('searchGroups')
- ->will($this->returnValue([['dn' => ['cn=foo,dc=barfoo,dc=bar']]]));
+ ->willReturn([['dn' => ['cn=foo,dc=barfoo,dc=bar']]]);
$access->expects($this->once())
->method('dn2groupname')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$groupBackend = new GroupLDAP($access, $pluginManager);
@@ -430,7 +430,7 @@ class Group_LDAPTest extends TestCase {
$access->expects($this->once())
->method('readAttribute')
->with($dn, $attr)
- ->will($this->returnValue(array('3117')));
+ ->willReturn(array('3117'));
$groupBackend = new GroupLDAP($access, $pluginManager);
@@ -453,7 +453,7 @@ class Group_LDAPTest extends TestCase {
$access->expects($this->once())
->method('readAttribute')
->with($dn, $attr)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$groupBackend = new GroupLDAP($access, $pluginManager);
@@ -479,7 +479,7 @@ class Group_LDAPTest extends TestCase {
$access->connection->expects($this->once())
->method('getFromCache')
->with($cacheKey)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$access->expects($this->never())
->method('username2dn');
@@ -496,7 +496,7 @@ class Group_LDAPTest extends TestCase {
$access->expects($this->once())
->method('nextcloudGroupNames')
- ->will($this->returnValue(array('group1', 'group2')));
+ ->willReturn(array('group1', 'group2'));
$groupBackend = new GroupLDAP($access, $pluginManager);
$groups = $groupBackend->getGroups('', 2, 2);
@@ -516,20 +516,20 @@ class Group_LDAPTest extends TestCase {
$access->connection->expects($this->any())
->method('getFromCache')
- ->will($this->returnValue(null));
+ ->willReturn(null);
$access->expects($this->any())
->method('readAttribute')
- ->will($this->returnCallback(function($dn, $attr) {
+ ->willReturnCallback(function($dn, $attr) {
if($attr === 'primaryGroupToken') {
return array(1337);
} else if($attr === 'gidNumber') {
return [4211];
}
return array();
- }));
+ });
$access->expects($this->any())
->method('groupname2dn')
- ->will($this->returnValue('cn=foobar,dc=foo,dc=bar'));
+ ->willReturn('cn=foobar,dc=foo,dc=bar');
$access->expects($this->exactly(2))
->method('nextcloudUserNames')
->willReturnOnConsecutiveCalls(['lisa', 'bart', 'kira', 'brad'], ['walle', 'dino', 'xenia']);
@@ -553,21 +553,21 @@ class Group_LDAPTest extends TestCase {
$access->connection->expects($this->any())
->method('getFromCache')
- ->will($this->returnValue(null));
+ ->willReturn(null);
$access->expects($this->any())
->method('readAttribute')
- ->will($this->returnCallback(function($dn, $attr) {
+ ->willReturnCallback(function($dn, $attr) {
if($attr === 'primaryGroupToken') {
return array(1337);
}
return array();
- }));
+ });
$access->expects($this->any())
->method('groupname2dn')
- ->will($this->returnValue('cn=foobar,dc=foo,dc=bar'));
+ ->willReturn('cn=foobar,dc=foo,dc=bar');
$access->expects($this->once())
->method('nextcloudUserNames')
- ->will($this->returnValue(array('lisa', 'bart', 'kira', 'brad')));
+ ->willReturn(array('lisa', 'bart', 'kira', 'brad'));
$access->userManager = $this->createMock(Manager::class);
$groupBackend = new GroupLDAP($access, $pluginManager);
@@ -588,24 +588,24 @@ class Group_LDAPTest extends TestCase {
$access->connection->expects($this->any())
->method('getFromCache')
- ->will($this->returnValue(null));
+ ->willReturn(null);
$access->expects($this->any())
->method('readAttribute')
- ->will($this->returnCallback(function($dn, $attr) {
+ ->willReturnCallback(function($dn, $attr) {
if($attr === 'primaryGroupToken') {
return array(1337);
}
return array();
- }));
+ });
$access->expects($this->any())
->method('groupname2dn')
- ->will($this->returnValue('cn=foobar,dc=foo,dc=bar'));
+ ->willReturn('cn=foobar,dc=foo,dc=bar');
$access->expects($this->once())
->method('countUsers')
- ->will($this->returnValue(4));
+ ->willReturn(4);
$groupBackend = new GroupLDAP($access, $pluginManager);
$users = $groupBackend->countUsersInGroup('foobar');
@@ -626,7 +626,7 @@ class Group_LDAPTest extends TestCase {
$access->expects($this->any())
->method('username2dn')
- ->will($this->returnValue($dn));
+ ->willReturn($dn);
$access->expects($this->exactly(3))
->method('readAttribute')
@@ -634,11 +634,11 @@ class Group_LDAPTest extends TestCase {
$access->expects($this->exactly(2))
->method('dn2groupname')
- ->will($this->returnArgument(0));
+ ->willReturnArgument(0);
$access->expects($this->exactly(1))
->method('groupsMatchFilter')
- ->will($this->returnArgument(0));
+ ->willReturnArgument(0);
$groupBackend = new GroupLDAP($access, $pluginManager);
$groups = $groupBackend->getUserGroups('userX');
@@ -653,14 +653,14 @@ class Group_LDAPTest extends TestCase {
$access->connection = $this->createMock(Connection::class);
$access->connection->expects($this->any())
->method('__get')
- ->will($this->returnCallback(function($name) {
+ ->willReturnCallback(function($name) {
if($name === 'useMemberOfToDetectMembership') {
return 0;
} else if($name === 'ldapDynamicGroupMemberURL') {
return '';
}
return 1;
- }));
+ });
$dn = 'cn=userX,dc=foobar';
@@ -669,13 +669,13 @@ class Group_LDAPTest extends TestCase {
$access->expects($this->once())
->method('username2dn')
- ->will($this->returnValue($dn));
+ ->willReturn($dn);
$access->expects($this->never())
->method('readAttribute')
->with($dn, 'memberOf');
$access->expects($this->once())
->method('nextcloudGroupNames')
- ->will($this->returnValue([]));
+ ->willReturn([]);
$access->expects($this->any())
->method('groupsMatchFilter')
->willReturnArgument(0);
@@ -691,7 +691,7 @@ class Group_LDAPTest extends TestCase {
$access->connection = $this->createMock(Connection::class);
$access->connection->expects($this->any())
->method('__get')
- ->will($this->returnCallback(function($name) {
+ ->willReturnCallback(function($name) {
switch($name) {
case 'useMemberOfToDetectMembership':
return 0;
@@ -703,7 +703,7 @@ class Group_LDAPTest extends TestCase {
return 'member';
}
return 1;
- }));
+ });
$dn = 'cn=userX,dc=foobar';
@@ -712,7 +712,7 @@ class Group_LDAPTest extends TestCase {
$access->expects($this->exactly(2))
->method('username2dn')
- ->will($this->returnValue($dn));
+ ->willReturn($dn);
$access->expects($this->never())
->method('readAttribute')
@@ -730,10 +730,10 @@ class Group_LDAPTest extends TestCase {
$access->expects($this->once())
->method('nextcloudGroupNames')
->with([$group1, $group2])
- ->will($this->returnValue(['group1', 'group2']));
+ ->willReturn(['group1', 'group2']);
$access->expects($this->once())
->method('fetchListOfGroups')
- ->will($this->returnValue([$group1, $group2]));
+ ->willReturn([$group1, $group2]);
$access->expects($this->any())
->method('groupsMatchFilter')
->willReturnArgument(0);
@@ -816,7 +816,7 @@ class Group_LDAPTest extends TestCase {
$access = $this->getAccessMock();
$access->expects($this->any())
->method('getGroupMapper')
- ->will($this->returnValue($mapper));
+ ->willReturn($mapper);
$access->connection = $this->createMock(Connection::class);
diff --git a/apps/user_ldap/tests/HelperTest.php b/apps/user_ldap/tests/HelperTest.php
index af4d24739be..a9b889dbc55 100644
--- a/apps/user_ldap/tests/HelperTest.php
+++ b/apps/user_ldap/tests/HelperTest.php
@@ -67,7 +67,7 @@ class HelperTest extends \Test\TestCase {
]);
$this->config->method('getAppValue')
- ->will($this->returnCallback(function($app, $key, $default) {
+ ->willReturnCallback(function($app, $key, $default) {
if ($app !== 'user_ldap') {
$this->fail('wrong app');
}
@@ -75,7 +75,7 @@ class HelperTest extends \Test\TestCase {
return '1';
}
return $default;
- }));
+ });
$result = $this->helper->getServerConfigurationPrefixes(true);
@@ -93,7 +93,7 @@ class HelperTest extends \Test\TestCase {
]);
$this->config->method('getAppValue')
- ->will($this->returnCallback(function($app, $key, $default) {
+ ->willReturnCallback(function($app, $key, $default) {
if ($app !== 'user_ldap') {
$this->fail('wrong app');
}
@@ -104,7 +104,7 @@ class HelperTest extends \Test\TestCase {
return 'foo.bar.com';
}
return $default;
- }));
+ });
$result = $this->helper->getServerConfigurationHosts();
diff --git a/apps/user_ldap/tests/Jobs/CleanUpTest.php b/apps/user_ldap/tests/Jobs/CleanUpTest.php
index 2d8ab254257..22065d14b2c 100644
--- a/apps/user_ldap/tests/Jobs/CleanUpTest.php
+++ b/apps/user_ldap/tests/Jobs/CleanUpTest.php
@@ -54,7 +54,7 @@ class CleanUpTest extends \Test\TestCase {
$args = $this->getMocks();
$args['helper']->expects($this->once())
->method('haveDisabledConfigurations')
- ->will($this->returnValue(true) );
+ ->willReturn(true );
$args['ocConfig']->expects($this->never())
->method('getSystemValue');
@@ -93,11 +93,11 @@ class CleanUpTest extends \Test\TestCase {
$args = $this->getMocks();
$args['helper']->expects($this->once())
->method('haveDisabledConfigurations')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$args['ocConfig']->expects($this->once())
->method('getSystemValue')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$bgJob = new \OCA\User_LDAP\Jobs\CleanUp();
$bgJob->setArguments($args);
@@ -113,11 +113,11 @@ class CleanUpTest extends \Test\TestCase {
$args = $this->getMocks();
$args['helper']->expects($this->once())
->method('haveDisabledConfigurations')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$args['ocConfig']->expects($this->once())
->method('getSystemValue')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$bgJob = new \OCA\User_LDAP\Jobs\CleanUp();
$bgJob->setArguments($args);
diff --git a/apps/user_ldap/tests/User/ManagerTest.php b/apps/user_ldap/tests/User/ManagerTest.php
index 784719c3b90..ad73d096efd 100644
--- a/apps/user_ldap/tests/User/ManagerTest.php
+++ b/apps/user_ldap/tests/User/ManagerTest.php
@@ -104,7 +104,7 @@ class ManagerTest extends \Test\TestCase {
$this->access->expects($this->any())
->method('getConnection')
- ->will($this->returnValue($this->connection));
+ ->willReturn($this->connection);
/** @noinspection PhpUnhandledExceptionInspection */
$this->manager = new Manager(
@@ -138,11 +138,11 @@ class ManagerTest extends \Test\TestCase {
$this->access->expects($this->once())
->method('stringResemblesDN')
->with($this->equalTo($inputDN))
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->access->expects($this->once())
->method('dn2username')
->with($this->equalTo($inputDN))
- ->will($this->returnValue($uid));
+ ->willReturn($uid);
$this->access->expects($this->never())
->method('username2dn');
@@ -163,15 +163,15 @@ class ManagerTest extends \Test\TestCase {
$this->access->expects($this->once())
->method('stringResemblesDN')
->with($this->equalTo($inputDN))
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->access->expects($this->once())
->method('dn2username')
->with($this->equalTo($inputDN))
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->access->expects($this->once())
->method('username2dn')
->with($this->equalTo($inputDN))
- ->will($this->returnValue(false));
+ ->willReturn(false);
/** @noinspection PhpUnhandledExceptionInspection */
$user = $this->manager->get($inputDN);
@@ -188,11 +188,11 @@ class ManagerTest extends \Test\TestCase {
$this->access->expects($this->once())
->method('username2dn')
->with($this->equalTo($uid))
- ->will($this->returnValue($dn));
+ ->willReturn($dn);
$this->access->expects($this->once())
->method('stringResemblesDN')
->with($this->equalTo($uid))
- ->will($this->returnValue(false));
+ ->willReturn(false);
/** @noinspection PhpUnhandledExceptionInspection */
$this->manager->get($uid);
@@ -213,7 +213,7 @@ class ManagerTest extends \Test\TestCase {
$this->access->expects($this->exactly(1))
->method('username2dn')
->with($this->equalTo($uid))
- ->will($this->returnValue(false));
+ ->willReturn(false);
/** @noinspection PhpUnhandledExceptionInspection */
$user = $this->manager->get($uid);
diff --git a/apps/user_ldap/tests/User/UserTest.php b/apps/user_ldap/tests/User/UserTest.php
index 36a312172c1..cb9df7037b9 100644
--- a/apps/user_ldap/tests/User/UserTest.php
+++ b/apps/user_ldap/tests/User/UserTest.php
@@ -118,13 +118,13 @@ class UserTest extends \Test\TestCase {
$this->connection->expects($this->once())
->method('__get')
->with($this->equalTo('ldapEmailAttribute'))
- ->will($this->returnValue('email'));
+ ->willReturn('email');
$this->access->expects($this->once())
->method('readAttribute')
->with($this->equalTo($this->dn),
$this->equalTo('email'))
- ->will($this->returnValue(['alice@foo.bar']));
+ ->willReturn(['alice@foo.bar']);
$coreUser = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
@@ -144,13 +144,13 @@ class UserTest extends \Test\TestCase {
$this->connection->expects($this->once())
->method('__get')
->with($this->equalTo('ldapEmailAttribute'))
- ->will($this->returnValue('email'));
+ ->willReturn('email');
$this->access->expects($this->once())
->method('readAttribute')
->with($this->equalTo($this->dn),
$this->equalTo('email'))
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->config->expects($this->never())
->method('setUserValue');
@@ -162,7 +162,7 @@ class UserTest extends \Test\TestCase {
$this->connection->expects($this->once())
->method('__get')
->with($this->equalTo('ldapEmailAttribute'))
- ->will($this->returnValue(''));
+ ->willReturn('');
$this->access->expects($this->never())
->method('readAttribute');
@@ -185,7 +185,7 @@ class UserTest extends \Test\TestCase {
->method('readAttribute')
->with($this->equalTo($this->dn),
$this->equalTo('myquota'))
- ->will($this->returnValue(['42 GB']));
+ ->willReturn(['42 GB']);
$coreUser = $this->createMock(IUser::class);
$coreUser->expects($this->once())
@@ -195,7 +195,7 @@ class UserTest extends \Test\TestCase {
$this->userManager->expects($this->atLeastOnce())
->method('get')
->with($this->uid)
- ->will($this->returnValue($coreUser));
+ ->willReturn($coreUser);
$this->user->updateQuota();
}
@@ -212,7 +212,7 @@ class UserTest extends \Test\TestCase {
->method('readAttribute')
->with($this->equalTo($this->dn),
$this->equalTo('myquota'))
- ->will($this->returnValue(['default']));
+ ->willReturn(['default']);
$coreUser = $this->createMock(IUser::class);
$coreUser->expects($this->once())
@@ -222,7 +222,7 @@ class UserTest extends \Test\TestCase {
$this->userManager->expects($this->once())
->method('get')
->with($this->uid)
- ->will($this->returnValue($coreUser));
+ ->willReturn($coreUser);
$this->user->updateQuota();
}
@@ -239,7 +239,7 @@ class UserTest extends \Test\TestCase {
->method('readAttribute')
->with($this->equalTo($this->dn),
$this->equalTo('myquota'))
- ->will($this->returnValue(['none']));
+ ->willReturn(['none']);
$coreUser = $this->createMock(IUser::class);
$coreUser->expects($this->once())
@@ -249,7 +249,7 @@ class UserTest extends \Test\TestCase {
$this->userManager->expects($this->once())
->method('get')
->with($this->uid)
- ->will($this->returnValue($coreUser));
+ ->willReturn($coreUser);
$this->user->updateQuota();
}
@@ -258,11 +258,11 @@ class UserTest extends \Test\TestCase {
$this->connection->expects($this->at(0))
->method('__get')
->with($this->equalTo('ldapQuotaAttribute'))
- ->will($this->returnValue('myquota'));
+ ->willReturn('myquota');
$this->connection->expects($this->at(1))
->method('__get')
->with($this->equalTo('ldapQuotaDefault'))
- ->will($this->returnValue('25 GB'));
+ ->willReturn('25 GB');
$this->connection->expects($this->exactly(2))
->method('__get');
@@ -270,7 +270,7 @@ class UserTest extends \Test\TestCase {
->method('readAttribute')
->with($this->equalTo($this->dn),
$this->equalTo('myquota'))
- ->will($this->returnValue(false));
+ ->willReturn(false);
$coreUser = $this->createMock(IUser::class);
$coreUser->expects($this->once())
@@ -280,7 +280,7 @@ class UserTest extends \Test\TestCase {
$this->userManager->expects($this->once())
->method('get')
->with($this->uid)
- ->will($this->returnValue($coreUser));
+ ->willReturn($coreUser);
$this->user->updateQuota();
}
@@ -297,7 +297,7 @@ class UserTest extends \Test\TestCase {
->method('readAttribute')
->with($this->equalTo($this->dn),
$this->equalTo('myquota'))
- ->will($this->returnValue(['27 GB']));
+ ->willReturn(['27 GB']);
$coreUser = $this->createMock(IUser::class);
$coreUser->expects($this->once())
@@ -307,7 +307,7 @@ class UserTest extends \Test\TestCase {
$this->userManager->expects($this->once())
->method('get')
->with($this->uid)
- ->will($this->returnValue($coreUser));
+ ->willReturn($coreUser);
$this->user->updateQuota();
}
@@ -324,7 +324,7 @@ class UserTest extends \Test\TestCase {
->method('readAttribute')
->with($this->equalTo($this->dn),
$this->equalTo('myquota'))
- ->will($this->returnValue(false));
+ ->willReturn(false);
$coreUser = $this->createMock(IUser::class);
$coreUser->expects($this->never())
@@ -385,7 +385,7 @@ class UserTest extends \Test\TestCase {
$this->userManager->expects($this->once())
->method('get')
->with($this->uid)
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->user->updateQuota($readQuota);
}
@@ -405,7 +405,7 @@ class UserTest extends \Test\TestCase {
->method('readAttribute')
->with($this->equalTo($this->dn),
$this->equalTo('myquota'))
- ->will($this->returnValue(['42 GBwos']));
+ ->willReturn(['42 GBwos']);
$coreUser = $this->createMock(IUser::class);
$coreUser->expects($this->once())
@@ -415,7 +415,7 @@ class UserTest extends \Test\TestCase {
$this->userManager->expects($this->once())
->method('get')
->with($this->uid)
- ->will($this->returnValue($coreUser));
+ ->willReturn($coreUser);
$this->user->updateQuota();
}
@@ -435,7 +435,7 @@ class UserTest extends \Test\TestCase {
->method('readAttribute')
->with($this->equalTo($this->dn),
$this->equalTo('myquota'))
- ->will($this->returnValue(false));
+ ->willReturn(false);
$coreUser = $this->createMock(IUser::class);
$coreUser->expects($this->never())
@@ -462,7 +462,7 @@ class UserTest extends \Test\TestCase {
->method('readAttribute')
->with($this->equalTo($this->dn),
$this->equalTo('myquota'))
- ->will($this->returnValue(['23 flush']));
+ ->willReturn(['23 flush']);
$coreUser = $this->createMock(IUser::class);
$coreUser->expects($this->never())
@@ -504,26 +504,26 @@ class UserTest extends \Test\TestCase {
->method('readAttribute')
->with($this->equalTo($this->dn),
$this->equalTo('jpegphoto'))
- ->will($this->returnValue(['this is a photo']));
+ ->willReturn(['this is a photo']);
$this->image->expects($this->once())
->method('loadFromBase64')
->willReturn('imageResource');
$this->image->expects($this->once())
->method('valid')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->image->expects($this->once())
->method('width')
- ->will($this->returnValue(128));
+ ->willReturn(128);
$this->image->expects($this->once())
->method('height')
- ->will($this->returnValue(128));
+ ->willReturn(128);
$this->image->expects($this->once())
->method('centerCrop')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->image->expects($this->once())
->method('data')
- ->will($this->returnValue('this is a photo'));
+ ->willReturn('this is a photo');
$this->config->expects($this->once())
->method('getUserValue')
@@ -535,7 +535,7 @@ class UserTest extends \Test\TestCase {
$this->filesystemhelper->expects($this->once())
->method('isLoaded')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$avatar = $this->createMock(IAvatar::class);
$avatar->expects($this->once())
@@ -545,7 +545,7 @@ class UserTest extends \Test\TestCase {
$this->avatarManager->expects($this->once())
->method('getAvatar')
->with($this->equalTo($this->uid))
- ->will($this->returnValue($avatar));
+ ->willReturn($avatar);
$this->connection->expects($this->any())
->method('resolveRule')
@@ -560,7 +560,7 @@ class UserTest extends \Test\TestCase {
->method('readAttribute')
->with($this->equalTo($this->dn),
$this->equalTo('jpegphoto'))
- ->will($this->returnValue(['this is a photo']));
+ ->willReturn(['this is a photo']);
$this->image->expects($this->once())
->method('loadFromBase64')
@@ -575,7 +575,7 @@ class UserTest extends \Test\TestCase {
->method('centerCrop');
$this->image->expects($this->once())
->method('data')
- ->will($this->returnValue('this is a photo'));
+ ->willReturn('this is a photo');
$this->config->expects($this->once())
->method('getUserValue')
@@ -623,19 +623,19 @@ class UserTest extends \Test\TestCase {
->willReturn('imageResource');
$this->image->expects($this->once())
->method('valid')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->image->expects($this->once())
->method('width')
- ->will($this->returnValue(128));
+ ->willReturn(128);
$this->image->expects($this->once())
->method('height')
- ->will($this->returnValue(128));
+ ->willReturn(128);
$this->image->expects($this->once())
->method('centerCrop')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->image->expects($this->once())
->method('data')
- ->will($this->returnValue('this is a photo'));
+ ->willReturn('this is a photo');
$this->config->expects($this->once())
->method('getUserValue')
@@ -647,7 +647,7 @@ class UserTest extends \Test\TestCase {
$this->filesystemhelper->expects($this->once())
->method('isLoaded')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$avatar = $this->createMock(IAvatar::class);
$avatar->expects($this->once())
@@ -657,7 +657,7 @@ class UserTest extends \Test\TestCase {
$this->avatarManager->expects($this->once())
->method('getAvatar')
->with($this->equalTo($this->uid))
- ->will($this->returnValue($avatar));
+ ->willReturn($avatar);
$this->connection->expects($this->any())
->method('resolveRule')
@@ -741,19 +741,19 @@ class UserTest extends \Test\TestCase {
->willReturn('imageResource');
$this->image->expects($this->once())
->method('valid')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->image->expects($this->once())
->method('width')
- ->will($this->returnValue(128));
+ ->willReturn(128);
$this->image->expects($this->once())
->method('height')
- ->will($this->returnValue(128));
+ ->willReturn(128);
$this->image->expects($this->once())
->method('centerCrop')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->image->expects($this->once())
->method('data')
- ->will($this->returnValue('this is a photo'));
+ ->willReturn('this is a photo');
$this->config->expects($this->once())
->method('getUserValue')
@@ -764,7 +764,7 @@ class UserTest extends \Test\TestCase {
$this->filesystemhelper->expects($this->once())
->method('isLoaded')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$avatar = $this->createMock(IAvatar::class);
$avatar->expects($this->once())
@@ -775,7 +775,7 @@ class UserTest extends \Test\TestCase {
$this->avatarManager->expects($this->once())
->method('getAvatar')
->with($this->equalTo($this->uid))
- ->will($this->returnValue($avatar));
+ ->willReturn($avatar);
$this->connection->expects($this->any())
->method('resolveRule')
@@ -837,13 +837,13 @@ class UserTest extends \Test\TestCase {
->with($this->equalTo($this->uid), $this->equalTo('user_ldap'),
$this->equalTo(User::USER_PREFKEY_FIRSTLOGIN),
$this->equalTo(0))
- ->will($this->returnValue(0));
+ ->willReturn(0);
$this->config->expects($this->at(1))
->method('getUserValue')
->with($this->equalTo($this->uid), $this->equalTo('user_ldap'),
$this->equalTo(User::USER_PREFKEY_LASTREFRESH),
$this->equalTo(0))
- ->will($this->returnValue(0));
+ ->willReturn(0);
$this->config->expects($this->exactly(2))
->method('getUserValue');
$this->config->expects($this->never())
@@ -858,13 +858,13 @@ class UserTest extends \Test\TestCase {
->with($this->equalTo($this->uid), $this->equalTo('user_ldap'),
$this->equalTo(User::USER_PREFKEY_FIRSTLOGIN),
$this->equalTo(0))
- ->will($this->returnValue(1));
+ ->willReturn(1);
$this->config->expects($this->at(1))
->method('getUserValue')
->with($this->equalTo($this->uid), $this->equalTo('user_ldap'),
$this->equalTo(User::USER_PREFKEY_LASTREFRESH),
$this->equalTo(0))
- ->will($this->returnValue(0));
+ ->willReturn(0);
$this->config->expects($this->exactly(2))
->method('getUserValue');
$this->config->expects($this->once())
@@ -872,7 +872,7 @@ class UserTest extends \Test\TestCase {
->with($this->equalTo($this->uid), $this->equalTo('user_ldap'),
$this->equalTo(User::USER_PREFKEY_LASTREFRESH),
$this->anything())
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->connection->expects($this->any())
->method('resolveRule')
@@ -932,19 +932,19 @@ class UserTest extends \Test\TestCase {
->with($this->equalTo($this->uid), $this->equalTo('user_ldap'),
$this->equalTo(User::USER_PREFKEY_FIRSTLOGIN),
$this->equalTo(0))
- ->will($this->returnValue(1));
+ ->willReturn(1);
$this->config->expects($this->at(1))
->method('getUserValue')
->with($this->equalTo($this->uid), $this->equalTo('user_ldap'),
$this->equalTo(User::USER_PREFKEY_LASTREFRESH),
$this->equalTo(0))
- ->will($this->returnValue(time() - 10));
+ ->willReturn(time() - 10);
$this->config->expects($this->once())
->method('getAppValue')
->with($this->equalTo('user_ldap'),
$this->equalTo('updateAttributesInterval'),
$this->anything())
- ->will($this->returnValue(1800));
+ ->willReturn(1800);
$this->config->expects($this->exactly(2))
->method('getUserValue');
$this->config->expects($this->never())
@@ -960,7 +960,7 @@ class UserTest extends \Test\TestCase {
$this->equalTo('user_ldap'),
$this->equalTo(User::USER_PREFKEY_FIRSTLOGIN),
$this->equalTo(1))
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->user->markLogin();
}
@@ -970,7 +970,7 @@ class UserTest extends \Test\TestCase {
->method('readAttribute')
->with($this->equalTo($this->dn),
$this->equalTo('jpegphoto'))
- ->will($this->returnValue(['this is a photo']));
+ ->willReturn(['this is a photo']);
$this->connection->expects($this->any())
->method('resolveRule')
->with('avatar')
@@ -1037,12 +1037,12 @@ class UserTest extends \Test\TestCase {
));
$this->connection->expects($this->any())
->method('__get')
- ->will($this->returnCallback(function($name) {
+ ->willReturnCallback(function($name) {
if($name === 'homeFolderNamingRule') {
return 'attr:homeDirectory';
}
return $name;
- }));
+ });
$this->connection->expects($this->any())
->method('resolveRule')
->with('avatar')
@@ -1083,7 +1083,7 @@ class UserTest extends \Test\TestCase {
$this->connection->expects($this->any())
->method('__get')
->with($this->equalTo('homeFolderNamingRule'))
- ->will($this->returnValue($attributeValue));
+ ->willReturn($attributeValue);
$this->access->expects($this->never())
->method('readAttribute');
@@ -1099,16 +1099,16 @@ class UserTest extends \Test\TestCase {
$this->connection->expects($this->any())
->method('__get')
->with($this->equalTo('homeFolderNamingRule'))
- ->will($this->returnValue('attr:foobar'));
+ ->willReturn('attr:foobar');
$this->access->expects($this->once())
->method('readAttribute')
- ->will($this->returnValue(false));
+ ->willReturn(false);
// asks for "enforce_home_folder_naming_rule"
$this->config->expects($this->once())
->method('getAppValue')
- ->will($this->returnValue(false));
+ ->willReturn(false);
/** @noinspection PhpUnhandledExceptionInspection */
$this->assertFalse($this->user->getHomePath());
@@ -1121,16 +1121,16 @@ class UserTest extends \Test\TestCase {
$this->connection->expects($this->any())
->method('__get')
->with($this->equalTo('homeFolderNamingRule'))
- ->will($this->returnValue('attr:foobar'));
+ ->willReturn('attr:foobar');
$this->access->expects($this->once())
->method('readAttribute')
- ->will($this->returnValue(false));
+ ->willReturn(false);
// asks for "enforce_home_folder_naming_rule"
$this->config->expects($this->once())
->method('getAppValue')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->user->getHomePath();
}
@@ -1192,7 +1192,7 @@ class UserTest extends \Test\TestCase {
public function testHandlePasswordExpiryWarningDefaultPolicy() {
$this->connection->expects($this->any())
->method('__get')
- ->will($this->returnCallback(function($name) {
+ ->willReturnCallback(function($name) {
if($name === 'ldapDefaultPPolicyDN') {
return 'cn=default,ou=policies,dc=foo,dc=bar';
}
@@ -1200,11 +1200,11 @@ class UserTest extends \Test\TestCase {
return '1';
}
return $name;
- }));
+ });
$this->access->expects($this->any())
->method('search')
- ->will($this->returnCallback(function($filter, $base) {
+ ->willReturnCallback(function($filter, $base) {
if($base === [$this->dn]) {
return [
[
@@ -1222,27 +1222,27 @@ class UserTest extends \Test\TestCase {
];
}
return [];
- }));
+ });
$notification = $this->getMockBuilder(INotification::class)
->disableOriginalConstructor()
->getMock();
$notification->expects($this->any())
->method('setApp')
- ->will($this->returnValue($notification));
+ ->willReturn($notification);
$notification->expects($this->any())
->method('setUser')
- ->will($this->returnValue($notification));
+ ->willReturn($notification);
$notification->expects($this->any())
->method('setObject')
- ->will($this->returnValue($notification));
+ ->willReturn($notification);
$notification->expects($this->any())
->method('setDateTime')
- ->will($this->returnValue($notification));
+ ->willReturn($notification);
$this->notificationManager->expects($this->exactly(2))
->method('createNotification')
- ->will($this->returnValue($notification));
+ ->willReturn($notification);
$this->notificationManager->expects($this->exactly(1))
->method('notify');
@@ -1255,7 +1255,7 @@ class UserTest extends \Test\TestCase {
public function testHandlePasswordExpiryWarningCustomPolicy() {
$this->connection->expects($this->any())
->method('__get')
- ->will($this->returnCallback(function($name) {
+ ->willReturnCallback(function($name) {
if($name === 'ldapDefaultPPolicyDN') {
return 'cn=default,ou=policies,dc=foo,dc=bar';
}
@@ -1263,11 +1263,11 @@ class UserTest extends \Test\TestCase {
return '1';
}
return $name;
- }));
+ });
$this->access->expects($this->any())
->method('search')
- ->will($this->returnCallback(function($filter, $base) {
+ ->willReturnCallback(function($filter, $base) {
if($base === [$this->dn]) {
return [
[
@@ -1286,27 +1286,27 @@ class UserTest extends \Test\TestCase {
];
}
return [];
- }));
+ });
$notification = $this->getMockBuilder(INotification::class)
->disableOriginalConstructor()
->getMock();
$notification->expects($this->any())
->method('setApp')
- ->will($this->returnValue($notification));
+ ->willReturn($notification);
$notification->expects($this->any())
->method('setUser')
- ->will($this->returnValue($notification));
+ ->willReturn($notification);
$notification->expects($this->any())
->method('setObject')
- ->will($this->returnValue($notification));
+ ->willReturn($notification);
$notification->expects($this->any())
->method('setDateTime')
- ->will($this->returnValue($notification));
+ ->willReturn($notification);
$this->notificationManager->expects($this->exactly(2))
->method('createNotification')
- ->will($this->returnValue($notification));
+ ->willReturn($notification);
$this->notificationManager->expects($this->exactly(1))
->method('notify');
diff --git a/apps/user_ldap/tests/User_LDAPTest.php b/apps/user_ldap/tests/User_LDAPTest.php
index e4a105b2bd6..f3052b19327 100644
--- a/apps/user_ldap/tests/User_LDAPTest.php
+++ b/apps/user_ldap/tests/User_LDAPTest.php
@@ -107,7 +107,7 @@ class User_LDAPTest extends TestCase {
private function prepareMockForUserExists() {
$this->access->expects($this->any())
->method('username2dn')
- ->will($this->returnCallback(function($uid) {
+ ->willReturnCallback(function($uid) {
switch ($uid) {
case 'gunslinger':
return 'dnOfRoland,dc=test';
@@ -124,7 +124,7 @@ class User_LDAPTest extends TestCase {
default:
return false;
}
- }));
+ });
$this->access->method('fetchUsersByLoginName')
->willReturn([]);
@@ -138,29 +138,29 @@ class User_LDAPTest extends TestCase {
private function prepareAccessForCheckPassword($noDisplayName = false) {
$this->connection->expects($this->any())
->method('__get')
- ->will($this->returnCallback(function($name) {
+ ->willReturnCallback(function($name) {
if($name === 'ldapLoginFilter') {
return '%uid';
}
return null;
- }));
+ });
$this->access->expects($this->any())
->method('fetchListOfUsers')
- ->will($this->returnCallback(function($filter) {
+ ->willReturnCallback(function($filter) {
if($filter === 'roland') {
return array(array('dn' => ['dnOfRoland,dc=test']));
}
return array();
- }));
+ });
$this->access->expects($this->any())
->method('fetchUsersByLoginName')
- ->will($this->returnCallback(function($uid) {
+ ->willReturnCallback(function($uid) {
if($uid === 'roland') {
return array(array('dn' => ['dnOfRoland,dc=test']));
}
return array();
- }));
+ });
$retVal = 'gunslinger';
if($noDisplayName === true) {
@@ -169,19 +169,19 @@ class User_LDAPTest extends TestCase {
$this->access->expects($this->any())
->method('dn2username')
->with($this->equalTo('dnOfRoland,dc=test'))
- ->will($this->returnValue($retVal));
+ ->willReturn($retVal);
$this->access->expects($this->any())
->method('stringResemblesDN')
->with($this->equalTo('dnOfRoland,dc=test'))
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->access->expects($this->any())
->method('areCredentialsValid')
- ->will($this->returnCallback(function($dn, $pwd) {
+ ->willReturnCallback(function($dn, $pwd) {
if($pwd === 'dt19') {
return true;
}
return false;
- }));
+ });
}
public function testCheckPasswordUidReturn() {
@@ -297,10 +297,10 @@ class User_LDAPTest extends TestCase {
$mapping = $this->createMock(UserMapping::class);
$mapping->expects($this->once())
->method('unmap')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->access->expects($this->once())
->method('getUserMapper')
- ->will($this->returnValue($mapping));
+ ->willReturn($mapping);
$this->connection->expects($this->any())
->method('getConnectionResource')
->willReturn('this is an ldap link');
@@ -362,22 +362,22 @@ class User_LDAPTest extends TestCase {
private function prepareAccessForGetUsers() {
$this->access->expects($this->once())
->method('escapeFilterPart')
- ->will($this->returnCallback(function($search) {
+ ->willReturnCallback(function($search) {
return $search;
- }));
+ });
$this->access->expects($this->any())
->method('getFilterPartForUserSearch')
- ->will($this->returnCallback(function($search) {
+ ->willReturnCallback(function($search) {
return $search;
- }));
+ });
$this->access->expects($this->any())
->method('combineFilterWithAnd')
- ->will($this->returnCallback(function($param) {
+ ->willReturnCallback(function($param) {
return $param[2];
- }));
+ });
$this->access->expects($this->any())
->method('fetchListOfUsers')
- ->will($this->returnCallback(function($search, $a, $l, $o) {
+ ->willReturnCallback(function($search, $a, $l, $o) {
$users = array('gunslinger', 'newyorker', 'ladyofshadows');
if(empty($search)) {
$result = $users;
@@ -393,10 +393,10 @@ class User_LDAPTest extends TestCase {
$result = array_slice($result, $o, $l);
}
return $result;
- }));
+ });
$this->access->expects($this->any())
->method('nextcloudUserNames')
- ->will($this->returnArgument(0));
+ ->willReturnArgument(0);
$this->access->method('fetchUsersByLoginName')
->willReturn([]);
}
@@ -543,12 +543,12 @@ class User_LDAPTest extends TestCase {
$this->access->expects($this->any())
->method('readAttribute')
- ->will($this->returnCallback(function($dn) {
+ ->willReturnCallback(function($dn) {
if($dn === 'dnOfRoland,dc=test') {
return array();
}
return false;
- }));
+ });
//test for never-existing user
/** @noinspection PhpUnhandledExceptionInspection */
@@ -568,12 +568,12 @@ class User_LDAPTest extends TestCase {
$this->access->expects($this->any())
->method('readAttribute')
- ->will($this->returnCallback(function($dn) {
+ ->willReturnCallback(function($dn) {
if($dn === 'dnOfRoland,dc=test') {
return array();
}
return false;
- }));
+ });
$this->userManager->expects($this->atLeastOnce())
->method('get')
->willReturn($user);
@@ -600,16 +600,16 @@ class User_LDAPTest extends TestCase {
$this->connection->expects($this->any())
->method('__get')
- ->will($this->returnCallback(function($name) {
+ ->willReturnCallback(function($name) {
if($name === 'homeFolderNamingRule') {
return 'attr:testAttribute';
}
return null;
- }));
+ });
$this->access->expects($this->any())
->method('readAttribute')
- ->will($this->returnCallback(function($dn, $attr) {
+ ->willReturnCallback(function($dn, $attr) {
switch ($dn) {
case 'dnOfRoland,dc=test':
if($attr === 'testAttribute') {
@@ -620,7 +620,7 @@ class User_LDAPTest extends TestCase {
default:
return false;
}
- }));
+ });
$user = $this->createMock(User::class);
$user->expects($this->any())
@@ -652,16 +652,16 @@ class User_LDAPTest extends TestCase {
$this->connection->expects($this->any())
->method('__get')
- ->will($this->returnCallback(function($name) {
+ ->willReturnCallback(function($name) {
if($name === 'homeFolderNamingRule') {
return 'attr:testAttribute';
}
return null;
- }));
+ });
$this->access->expects($this->any())
->method('readAttribute')
- ->will($this->returnCallback(function($dn, $attr) {
+ ->willReturnCallback(function($dn, $attr) {
switch ($dn) {
case 'dnOfLadyOfShadows,dc=test':
if($attr === 'testAttribute') {
@@ -672,7 +672,7 @@ class User_LDAPTest extends TestCase {
default:
return false;
}
- }));
+ });
$user = $this->createMock(User::class);
$user->expects($this->any())
@@ -703,20 +703,20 @@ class User_LDAPTest extends TestCase {
$this->connection->expects($this->any())
->method('__get')
- ->will($this->returnCallback(function($name) {
+ ->willReturnCallback(function($name) {
if($name === 'homeFolderNamingRule') {
return 'attr:testAttribute';
}
return null;
- }));
+ });
$this->access->expects($this->any())
->method('readAttribute')
- ->will($this->returnCallback(function($dn, $attr) {
+ ->willReturnCallback(function($dn, $attr) {
switch ($dn) {
default:
return false;
}
- }));
+ });
$this->access->connection->expects($this->any())
->method('getFromCache')
->willReturnCallback(function($key) {
@@ -751,26 +751,26 @@ class User_LDAPTest extends TestCase {
$this->connection->expects($this->any())
->method('__get')
- ->will($this->returnCallback(function($name) {
+ ->willReturnCallback(function($name) {
if($name === 'homeFolderNamingRule') {
return 'attr:testAttribute';
}
return null;
- }));
+ });
$this->access->expects($this->any())
->method('readAttribute')
- ->will($this->returnValue([]));
+ ->willReturn([]);
$userMapper = $this->createMock(UserMapping::class);
$this->access->expects($this->any())
->method('getUserMapper')
- ->will($this->returnValue($userMapper));
+ ->willReturn($userMapper);
$this->config->expects($this->any())
->method('getUserValue')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$offlineUser = $this->createMock(OfflineUser::class);
$offlineUser->expects($this->atLeastOnce())
@@ -797,9 +797,9 @@ class User_LDAPTest extends TestCase {
$this->connection->expects($this->any())
->method('getFromCache')
- ->will($this->returnCallback(function($uid) {
+ ->willReturnCallback(function($uid) {
return true;
- }));
+ });
/** @noinspection PhpUnhandledExceptionInspection */
$this->assertEquals($this->backend->getHome('uid'),'result');
@@ -808,16 +808,16 @@ class User_LDAPTest extends TestCase {
private function prepareAccessForGetDisplayName() {
$this->connection->expects($this->any())
->method('__get')
- ->will($this->returnCallback(function($name) {
+ ->willReturnCallback(function($name) {
if($name === 'ldapUserDisplayName') {
return 'displayname';
}
return null;
- }));
+ });
$this->access->expects($this->any())
->method('readAttribute')
- ->will($this->returnCallback(function($dn, $attr) {
+ ->willReturnCallback(function($dn, $attr) {
switch ($dn) {
case 'dnOfRoland,dc=test':
if($attr === 'displayname') {
@@ -829,7 +829,7 @@ class User_LDAPTest extends TestCase {
default:
return false;
}
- }));
+ });
$this->access->method('fetchUsersByLoginName')
->willReturn([]);
}
@@ -841,9 +841,9 @@ class User_LDAPTest extends TestCase {
$this->connection->expects($this->any())
->method('getConnectionResource')
- ->will($this->returnCallback(function() {
+ ->willReturnCallback(function() {
return true;
- }));
+ });
$user1 = $this->createMock(User::class);
$user1->expects($this->once())
@@ -894,7 +894,7 @@ class User_LDAPTest extends TestCase {
public function testGetDisplayNamePublicAPI() {
$this->access->expects($this->any())
->method('username2dn')
- ->will($this->returnCallback(function($uid) {
+ ->willReturnCallback(function($uid) {
switch ($uid) {
case 'gunslinger':
return 'dnOfRoland,dc=test';
@@ -911,16 +911,16 @@ class User_LDAPTest extends TestCase {
default:
return false;
}
- }));
+ });
$this->prepareAccessForGetDisplayName();
$backend = new UserLDAP($this->access, $this->config, $this->notificationManager, $this->session, $this->pluginManager);
$this->prepareMockForUserExists();
$this->connection->expects($this->any())
->method('getConnectionResource')
- ->will($this->returnCallback(function() {
+ ->willReturnCallback(function() {
return true;
- }));
+ });
\OC_User::useBackend($backend);
@@ -989,7 +989,7 @@ class User_LDAPTest extends TestCase {
public function testCountUsers() {
$this->access->expects($this->once())
->method('countUsers')
- ->will($this->returnValue(5));
+ ->willReturn(5);
$backend = new UserLDAP($this->access, $this->config, $this->notificationManager, $this->session, $this->pluginManager);
@@ -1000,7 +1000,7 @@ class User_LDAPTest extends TestCase {
public function testCountUsersFailing() {
$this->access->expects($this->once())
->method('countUsers')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$backend = new UserLDAP($this->access, $this->config, $this->notificationManager, $this->session, $this->pluginManager);
@@ -1134,7 +1134,7 @@ class User_LDAPTest extends TestCase {
private function prepareAccessForSetPassword($enablePasswordChange = true) {
$this->connection->expects($this->any())
->method('__get')
- ->will($this->returnCallback(function($name) use (&$enablePasswordChange) {
+ ->willReturnCallback(function($name) use (&$enablePasswordChange) {
if($name === 'ldapLoginFilter') {
return '%uid';
}
@@ -1142,48 +1142,48 @@ class User_LDAPTest extends TestCase {
return $enablePasswordChange?1:0;
}
return null;
- }));
+ });
$this->connection->expects($this->any())
->method('getFromCache')
- ->will($this->returnCallback(function($uid) {
+ ->willReturnCallback(function($uid) {
if($uid === 'userExists'.'roland') {
return true;
}
return null;
- }));
+ });
$this->access->expects($this->any())
->method('fetchListOfUsers')
- ->will($this->returnCallback(function($filter) {
+ ->willReturnCallback(function($filter) {
if($filter === 'roland') {
return array(array('dn' => ['dnOfRoland,dc=test']));
}
return array();
- }));
+ });
$this->access->expects($this->any())
->method('fetchUsersByLoginName')
- ->will($this->returnCallback(function($uid) {
+ ->willReturnCallback(function($uid) {
if($uid === 'roland') {
return array(array('dn' => ['dnOfRoland,dc=test']));
}
return array();
- }));
+ });
$this->access->expects($this->any())
->method('dn2username')
->with($this->equalTo('dnOfRoland,dc=test'))
- ->will($this->returnValue('roland'));
+ ->willReturn('roland');
$this->access->expects($this->any())
->method('stringResemblesDN')
->with($this->equalTo('dnOfRoland,dc=test'))
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->access->expects($this->any())
->method('setPassword')
- ->will($this->returnCallback(function($uid, $password) {
+ ->willReturnCallback(function($uid, $password) {
if(strlen($password) <= 5) {
throw new HintException('Password fails quality checking policy', '', 19);
}
return true;
- }));
+ });
}
diff --git a/apps/user_ldap/tests/WizardTest.php b/apps/user_ldap/tests/WizardTest.php
index 5535a28f44c..db23fc1ed40 100644
--- a/apps/user_ldap/tests/WizardTest.php
+++ b/apps/user_ldap/tests/WizardTest.php
@@ -85,15 +85,15 @@ class WizardTest extends TestCase {
$ldap->expects($this->once())
->method('connect')
//dummy value, usually invalid
- ->will($this->returnValue(true));
+ ->willReturn(true);
$ldap->expects($this->exactly(3))
->method('setOption')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$ldap->expects($this->once())
->method('bind')
- ->will($this->returnValue(true));
+ ->willReturn(true);
}
@@ -102,54 +102,54 @@ class WizardTest extends TestCase {
$configuration->expects($this->any())
->method('__get')
- ->will($this->returnCallback(function($name) {
+ ->willReturnCallback(function($name) {
if($name === 'ldapBase') {
return array('base');
}
return null;
- }));
+ });
$this->prepareLdapWrapperForConnections($ldap);
$ldap->expects($this->any())
->method('isResource')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$ldap->expects($this->exactly(2))
->method('search')
//dummy value, usually invalid
- ->will($this->returnValue(true));
+ ->willReturn(true);
$ldap->expects($this->exactly(2))
->method('countEntries')
//an is_resource check will follow, so we need to return a dummy resource
- ->will($this->returnValue(23));
+ ->willReturn(23);
//5 DNs per filter means 2x firstEntry and 8x nextEntry
$ldap->expects($this->exactly(2))
->method('firstEntry')
//dummy value, usually invalid
- ->will($this->returnValue(true));
+ ->willReturn(true);
$ldap->expects($this->exactly(8))
->method('nextEntry')
//dummy value, usually invalid
- ->will($this->returnValue(true));
+ ->willReturn(true);
$ldap->expects($this->exactly(10))
->method('getAttributes')
//dummy value, usually invalid
- ->will($this->returnValue(array('cn' => array('foo'), 'count' => 1)));
+ ->willReturn(array('cn' => array('foo'), 'count' => 1));
global $uidnumber;
$uidnumber = 1;
$ldap->expects($this->exactly(10))
->method('getDN')
//dummy value, usually invalid
- ->will($this->returnCallback(function($a, $b) {
+ ->willReturnCallback(function($a, $b) {
global $uidnumber;
return $uidnumber++;
- }));
+ });
// The following expectations are the real test
$filters = array('f1', 'f2', '*');
@@ -162,18 +162,18 @@ class WizardTest extends TestCase {
$configuration->expects($this->any())
->method('__get')
- ->will($this->returnCallback(function($name) {
+ ->willReturnCallback(function($name) {
if($name === 'ldapBase') {
return array('base');
}
return null;
- }));
+ });
$this->prepareLdapWrapperForConnections($ldap);
$ldap->expects($this->any())
->method('isResource')
- ->will($this->returnCallback(function($r) {
+ ->willReturnCallback(function($r) {
if($r === true) {
return true;
}
@@ -183,49 +183,49 @@ class WizardTest extends TestCase {
return false;
}
return true;
- }));
+ });
$ldap->expects($this->exactly(2))
->method('search')
//dummy value, usually invalid
- ->will($this->returnValue(true));
+ ->willReturn(true);
$ldap->expects($this->exactly(2))
->method('countEntries')
//an is_resource check will follow, so we need to return a dummy resource
- ->will($this->returnValue(23));
+ ->willReturn(23);
//5 DNs per filter means 2x firstEntry and 8x nextEntry
$ldap->expects($this->exactly(2))
->method('firstEntry')
//dummy value, usually invalid
- ->will($this->returnCallback(function($r) {
+ ->willReturnCallback(function($r) {
global $uidnumber;
return $uidnumber;
- }));
+ });
$ldap->expects($this->exactly(46))
->method('nextEntry')
//dummy value, usually invalid
- ->will($this->returnCallback(function($r) {
+ ->willReturnCallback(function($r) {
global $uidnumber;
return $uidnumber;
- }));
+ });
$ldap->expects($this->exactly(46))
->method('getAttributes')
//dummy value, usually invalid
- ->will($this->returnValue(array('cn' => array('foo'), 'count' => 1)));
+ ->willReturn(array('cn' => array('foo'), 'count' => 1));
global $uidnumber;
$uidnumber = 1;
$ldap->expects($this->exactly(46))
->method('getDN')
//dummy value, usually invalid
- ->will($this->returnCallback(function($a, $b) {
+ ->willReturnCallback(function($a, $b) {
global $uidnumber;
return $uidnumber++;
- }));
+ });
// The following expectations are the real test
$filters = array('f1', 'f2', '*');
@@ -239,18 +239,18 @@ class WizardTest extends TestCase {
$configuration->expects($this->any())
->method('__get')
- ->will($this->returnCallback(function ($name) {
+ ->willReturnCallback(function ($name) {
if($name === 'ldapEmailAttribute') {
return 'myEmailAttribute';
} else {
//for requirement checks
return 'let me pass';
}
- }));
+ });
$access->expects($this->once())
->method('countUsers')
- ->will($this->returnValue(42));
+ ->willReturn(42);
$wizard->detectEmailAttribute();
}
@@ -261,24 +261,24 @@ class WizardTest extends TestCase {
$configuration->expects($this->any())
->method('__get')
- ->will($this->returnCallback(function ($name) {
+ ->willReturnCallback(function ($name) {
if($name === 'ldapEmailAttribute') {
return 'myEmailAttribute';
} else {
//for requirement checks
return 'let me pass';
}
- }));
+ });
$access->expects($this->exactly(3))
->method('combineFilterWithAnd')
- ->will($this->returnCallback(function ($filterParts) {
+ ->willReturnCallback(function ($filterParts) {
return str_replace('=*', '', array_pop($filterParts));
- }));
+ });
$access->expects($this->exactly(3))
->method('countUsers')
- ->will($this->returnCallback(function ($filter) {
+ ->willReturnCallback(function ($filter) {
if($filter === 'myEmailAttribute') {
return 0;
} else if($filter === 'mail') {
@@ -287,7 +287,7 @@ class WizardTest extends TestCase {
return 17;
}
throw new \Exception('Untested filter: ' . $filter);
- }));
+ });
$result = $wizard->detectEmailAttribute()->getResultArray();
$this->assertSame('mailPrimaryAddress',
@@ -300,24 +300,24 @@ class WizardTest extends TestCase {
$configuration->expects($this->any())
->method('__get')
- ->will($this->returnCallback(function ($name) {
+ ->willReturnCallback(function ($name) {
if($name === 'ldapEmailAttribute') {
return '';
} else {
//for requirement checks
return 'let me pass';
}
- }));
+ });
$access->expects($this->exactly(2))
->method('combineFilterWithAnd')
- ->will($this->returnCallback(function ($filterParts) {
+ ->willReturnCallback(function ($filterParts) {
return str_replace('=*', '', array_pop($filterParts));
- }));
+ });
$access->expects($this->exactly(2))
->method('countUsers')
- ->will($this->returnCallback(function ($filter) {
+ ->willReturnCallback(function ($filter) {
if($filter === 'myEmailAttribute') {
return 0;
} else if($filter === 'mail') {
@@ -326,7 +326,7 @@ class WizardTest extends TestCase {
return 17;
}
throw new \Exception('Untested filter: ' . $filter);
- }));
+ });
$result = $wizard->detectEmailAttribute()->getResultArray();
$this->assertSame('mailPrimaryAddress',
@@ -339,24 +339,24 @@ class WizardTest extends TestCase {
$configuration->expects($this->any())
->method('__get')
- ->will($this->returnCallback(function ($name) {
+ ->willReturnCallback(function ($name) {
if($name === 'ldapEmailAttribute') {
return 'myEmailAttribute';
} else {
//for requirement checks
return 'let me pass';
}
- }));
+ });
$access->expects($this->exactly(3))
->method('combineFilterWithAnd')
- ->will($this->returnCallback(function ($filterParts) {
+ ->willReturnCallback(function ($filterParts) {
return str_replace('=*', '', array_pop($filterParts));
- }));
+ });
$access->expects($this->exactly(3))
->method('countUsers')
- ->will($this->returnCallback(function ($filter) {
+ ->willReturnCallback(function ($filter) {
if($filter === 'myEmailAttribute') {
return 0;
} else if($filter === 'mail') {
@@ -365,7 +365,7 @@ class WizardTest extends TestCase {
return 0;
}
throw new \Exception('Untested filter: ' . $filter);
- }));
+ });
$result = $wizard->detectEmailAttribute();
$this->assertSame(false, $result->hasChanges());
@@ -378,36 +378,36 @@ class WizardTest extends TestCase {
$configuration->expects($this->any())
->method('__get')
- ->will($this->returnCallback(function($name) {
+ ->willReturnCallback(function($name) {
if($name === 'ldapBase') {
return array('base');
}
return null;
- }));
+ });
$this->prepareLdapWrapperForConnections($ldap);
$ldap->expects($this->any())
->method('isResource')
- ->will($this->returnCallback(function($res) {
+ ->willReturnCallback(function($res) {
return (bool)$res;
- }));
+ });
$ldap->expects($this->any())
->method('search')
//dummy value, usually invalid
- ->will($this->returnValue(true));
+ ->willReturn(true);
$ldap->expects($this->any())
->method('countEntries')
//an is_resource check will follow, so we need to return a dummy resource
- ->will($this->returnValue(7));
+ ->willReturn(7);
//5 DNs per filter means 2x firstEntry and 8x nextEntry
$ldap->expects($this->any())
->method('firstEntry')
//dummy value, usually invalid
- ->will($this->returnValue(1));
+ ->willReturn(1);
global $mark;
$mark = false;
@@ -415,7 +415,7 @@ class WizardTest extends TestCase {
$ldap->expects($this->any())
->method('nextEntry')
//dummy value, usually invalid
- ->will($this->returnCallback(function($a, $prev){
+ ->willReturnCallback(function($a, $prev){
$current = $prev + 1;
if($current === 7) {
return false;
@@ -426,21 +426,21 @@ class WizardTest extends TestCase {
return 4;
}
return $current;
- }));
+ });
$ldap->expects($this->any())
->method('getAttributes')
//dummy value, usually invalid
- ->will($this->returnCallback(function($a, $entry) {
+ ->willReturnCallback(function($a, $entry) {
return array('cn' => array($entry), 'count' => 1);
- }));
+ });
$ldap->expects($this->any())
->method('getDN')
//dummy value, usually invalid
- ->will($this->returnCallback(function($a, $b) {
+ ->willReturnCallback(function($a, $b) {
return $b;
- }));
+ });
// The following expectations are the real test
$filters = array('f1', 'f2', '*');