aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorLukas Reschke <lukas@owncloud.com>2016-04-15 18:57:11 +0200
committerLukas Reschke <lukas@owncloud.com>2016-04-15 18:57:11 +0200
commit8a650a51be8e3c5c335e0aea9ff6b849e6ccc02f (patch)
treea74ee5f7f68994aa1340405c268f8ec3734f26e0 /tests
parent331e4efacb226f95551962f3a53030feced0b190 (diff)
downloadnextcloud-server-8a650a51be8e3c5c335e0aea9ff6b849e6ccc02f.tar.gz
nextcloud-server-8a650a51be8e3c5c335e0aea9ff6b849e6ccc02f.zip
Use !== instead of empty
Users can be named null
Diffstat (limited to 'tests')
-rw-r--r--tests/core/controller/LoginControllerTest.php38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/core/controller/LoginControllerTest.php b/tests/core/controller/LoginControllerTest.php
index 2c634d79fa1..186b8c4c5bb 100644
--- a/tests/core/controller/LoginControllerTest.php
+++ b/tests/core/controller/LoginControllerTest.php
@@ -173,4 +173,42 @@ class LoginControllerTest extends TestCase {
);
$this->assertEquals($expectedResponse, $this->loginController->showLoginForm('LdapUser', '', ''));
}
+
+ public function testShowLoginFormForUserNamedNull() {
+ $this->userSession
+ ->expects($this->once())
+ ->method('isLoggedIn')
+ ->willReturn(false);
+ $this->config
+ ->expects($this->once())
+ ->method('getSystemValue')
+ ->with('lost_password_link')
+ ->willReturn(false);
+ $user = $this->getMock('\\OCP\\IUser');
+ $user
+ ->expects($this->once())
+ ->method('canChangePassword')
+ ->willReturn(false);
+ $this->userManager
+ ->expects($this->once())
+ ->method('get')
+ ->with('0')
+ ->willReturn($user);
+
+ $expectedResponse = new TemplateResponse(
+ 'core',
+ 'login',
+ [
+ 'messages' => [],
+ 'username' => '0',
+ 'user_autofocus' => false,
+ 'canResetPassword' => false,
+ 'alt_login' => [],
+ 'rememberLoginAllowed' => \OC_Util::rememberLoginAllowed(),
+ 'rememberLoginState' => 0,
+ ],
+ 'guest'
+ );
+ $this->assertEquals($expectedResponse, $this->loginController->showLoginForm('0', '', ''));
+ }
}