From 26b0a89874dc1a3279471b9fbf35420d63fd45dd Mon Sep 17 00:00:00 2001 From: Lukas Reschke Date: Fri, 12 Dec 2014 12:39:31 +0100 Subject: Add test for user without backend --- tests/settings/controller/userscontrollertest.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'tests') diff --git a/tests/settings/controller/userscontrollertest.php b/tests/settings/controller/userscontrollertest.php index 42d91c7731a..78b855fd3f1 100644 --- a/tests/settings/controller/userscontrollertest.php +++ b/tests/settings/controller/userscontrollertest.php @@ -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... -- cgit v1.2.3