]> source.dussan.org Git - nextcloud-server.git/commitdiff
Add test for user without backend
authorLukas Reschke <lukas@owncloud.com>
Fri, 12 Dec 2014 11:39:31 +0000 (12:39 +0100)
committerLukas Reschke <lukas@owncloud.com>
Fri, 12 Dec 2014 11:39:31 +0000 (12:39 +0100)
tests/settings/controller/userscontrollertest.php

index 42d91c7731a5e3b3c3c2a973146f81c0e27095a0..78b855fd3f163b58f4b90d9ceb83fac5e27eb47d 100644 (file)
@@ -228,6 +228,22 @@ class UsersControllerTest extends \Test\TestCase {
                $this->assertEquals($expectedResponse, $response);
        }
 
+       public function testIndexWithBackendNoUser() {
+               $this->container['UserManager']
+                       ->expects($this->once())
+                       ->method('getBackends')
+                       ->will($this->returnValue([new \OC_User_Dummy(), new \OC_User_Database()]));
+               $this->container['UserManager']
+                       ->expects($this->once())
+                       ->method('search')
+                       ->with('')
+                       ->will($this->returnValue([]));
+
+               $expectedResponse = new DataResponse([]);
+               $response = $this->usersController->index(0, 10, '','', 'OC_User_Dummy');
+               $this->assertEquals($expectedResponse, $response);
+       }
+
        /**
         * TODO: Since the function uses the static OC_Subadmin class it can't be mocked
         * to test for subadmins. Thus the test always assumes you have admin permissions...