]> source.dussan.org Git - nextcloud-server.git/commitdiff
extend tests for status quo
authorArthur Schiwon <blizzz@arthur-schiwon.de>
Fri, 22 Dec 2017 12:38:10 +0000 (13:38 +0100)
committerArthur Schiwon <blizzz@arthur-schiwon.de>
Thu, 4 Jan 2018 10:47:21 +0000 (11:47 +0100)
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
tests/lib/User/ManagerTest.php
tests/lib/Util/User/Dummy.php

index cf725aae6719be1af0ffdad0a56ff24b15706cdc..02200b05d0517fa2577c261b7362d6231a8396ff 100644 (file)
@@ -184,6 +184,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);
@@ -235,6 +238,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
@@ -244,6 +250,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);
index ea47f5d7d15944ee160d5f01fadf519a475ecf42..375a5f4b8e630f0ffa38c9a9d134ca2ca3d4a08b 100644 (file)
@@ -108,6 +108,13 @@ class Dummy extends Backend implements \OCP\IUserBackend {
                }
        }
 
+       public function loginName2UserName($loginName) {
+               if(isset($this->users[strtolower($loginName)])) {
+                       return strtolower($loginName);
+               }
+               return false;
+       }
+
        /**
         * Get a list of all users
         *