aboutsummaryrefslogtreecommitdiffstats
path: root/apps/user_ldap/tests
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2018-10-25 23:41:12 +0200
committerArthur Schiwon <blizzz@arthur-schiwon.de>2018-10-25 23:41:12 +0200
commitbbe44108b5661d0c3935fa76e27abbc433fd458e (patch)
tree284cdd42a8f097448216296e8d96af5ff4d44ff8 /apps/user_ldap/tests
parent6ad7f329385f73a731f69d9f00cf5b038f3eac04 (diff)
downloadnextcloud-server-bbe44108b5661d0c3935fa76e27abbc433fd458e.tar.gz
nextcloud-server-bbe44108b5661d0c3935fa76e27abbc433fd458e.zip
only write when the displayname differs, but then announce it
refs #5212 and fixes #9112 Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'apps/user_ldap/tests')
-rw-r--r--apps/user_ldap/tests/User/UserTest.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/apps/user_ldap/tests/User/UserTest.php b/apps/user_ldap/tests/User/UserTest.php
index 837c72a3a31..63c90c6ac72 100644
--- a/apps/user_ldap/tests/User/UserTest.php
+++ b/apps/user_ldap/tests/User/UserTest.php
@@ -1010,11 +1010,36 @@ class UserTest extends \Test\TestCase {
public function testComposeAndStoreDisplayName($part1, $part2, $expected) {
$this->config->expects($this->once())
->method('setUserValue');
+ $this->config->expects($this->once())
+ ->method('getUserValue');
+
+ $ncUserObj = $this->createMock(\OC\User\User::class);
+ $ncUserObj->expects($this->once())
+ ->method('triggerChange')
+ ->with('displayName', $expected);
+ $this->userManager->expects($this->once())
+ ->method('get')
+ ->willReturn($ncUserObj);
$displayName = $this->user->composeAndStoreDisplayName($part1, $part2);
$this->assertSame($expected, $displayName);
}
+ public function testComposeAndStoreDisplayNameNoOverwrite() {
+ $displayName = 'Randall Flagg';
+ $this->config->expects($this->never())
+ ->method('setUserValue');
+ $this->config->expects($this->once())
+ ->method('getUserValue')
+ ->willReturn($displayName);
+
+ $this->userManager->expects($this->never())
+ ->method('get'); // Implicit: no triggerChange can be called
+
+ $composedDisplayName = $this->user->composeAndStoreDisplayName($displayName);
+ $this->assertSame($composedDisplayName, $displayName);
+ }
+
public function testHandlePasswordExpiryWarningDefaultPolicy() {
$this->connection->expects($this->any())
->method('__get')