aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2017-12-22 13:38:10 +0100
committerArthur Schiwon <blizzz@arthur-schiwon.de>2018-01-03 13:24:56 +0100
commit2fde21e318e021d48a4880ff9cc10f0e45f5e1e9 (patch)
tree5753fac44c1bb8842fc932c36e275239e319c00c
parenta8ab67ff48aa425edd1d86b4a3b5855150bb2ac1 (diff)
downloadnextcloud-server-2fde21e318e021d48a4880ff9cc10f0e45f5e1e9.tar.gz
nextcloud-server-2fde21e318e021d48a4880ff9cc10f0e45f5e1e9.zip
extend tests for status quo
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
-rw-r--r--tests/lib/User/ManagerTest.php12
-rw-r--r--tests/lib/Util/User/Dummy.php7
2 files changed, 19 insertions, 0 deletions
diff --git a/tests/lib/User/ManagerTest.php b/tests/lib/User/ManagerTest.php
index 0d98a9825de..ac54d27d324 100644
--- a/tests/lib/User/ManagerTest.php
+++ b/tests/lib/User/ManagerTest.php
@@ -185,6 +185,9 @@ class ManagerTest extends TestCase {
->method('userExists')
->with($this->equalTo('foo'))
->will($this->returnValue(true));
+ $backend->expects($this->once())
+ ->method('loginName2UserName')
+ ->willReturn(false);
$manager = new \OC\User\Manager($this->config);
$manager->registerBackend($backend);
@@ -236,6 +239,9 @@ class ManagerTest extends TestCase {
->method('getUsers')
->with($this->equalTo('fo'), $this->equalTo(3), $this->equalTo(1))
->will($this->returnValue(array('foo1', 'foo2')));
+ $backend1->expects($this->exactly(2))
+ ->method('loginName2UserName')
+ ->willReturn(false);
/**
* @var \Test\Util\User\Dummy | \PHPUnit_Framework_MockObject_MockObject $backend2
@@ -245,6 +251,9 @@ class ManagerTest extends TestCase {
->method('getUsers')
->with($this->equalTo('fo'), $this->equalTo(3), $this->equalTo(1))
->will($this->returnValue(array('foo3')));
+ $backend2->expects($this->once())
+ ->method('loginName2UserName')
+ ->willReturn(false);
$manager = new \OC\User\Manager($this->config);
$manager->registerBackend($backend1);
@@ -324,6 +333,9 @@ class ManagerTest extends TestCase {
->method('userExists')
->with($this->equalTo('foo'))
->will($this->returnValue(false));
+ $backend->expects($this->once())
+ ->method('loginName2UserName')
+ ->willReturn(false);
$manager = new \OC\User\Manager($this->config);
$manager->registerBackend($backend);
diff --git a/tests/lib/Util/User/Dummy.php b/tests/lib/Util/User/Dummy.php
index 806a97bacba..e77902d6f4e 100644
--- a/tests/lib/Util/User/Dummy.php
+++ b/tests/lib/Util/User/Dummy.php
@@ -108,6 +108,13 @@ class Dummy extends Backend implements \OCP\IUserBackend {
return false;
}
+ public function loginName2UserName($loginName) {
+ if(isset($this->users[strtolower($loginName)])) {
+ return strtolower($loginName);
+ }
+ return false;
+ }
+
/**
* Get a list of all users
*