summaryrefslogtreecommitdiffstats
path: root/apps/user_ldap/tests/User/UserTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/user_ldap/tests/User/UserTest.php')
-rw-r--r--apps/user_ldap/tests/User/UserTest.php168
1 files changed, 84 insertions, 84 deletions
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');