diff options
Diffstat (limited to 'apps/user_ldap/tests/User_ProxyTest.php')
-rw-r--r-- | apps/user_ldap/tests/User_ProxyTest.php | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/apps/user_ldap/tests/User_ProxyTest.php b/apps/user_ldap/tests/User_ProxyTest.php index 68b1e4428ca..f6aaa01cb8d 100644 --- a/apps/user_ldap/tests/User_ProxyTest.php +++ b/apps/user_ldap/tests/User_ProxyTest.php @@ -2,6 +2,9 @@ /** * @copyright Copyright (c) 2016 Lukas Reschke <lukas@statuscode.ch> * + * @author Lukas Reschke <lukas@statuscode.ch> + * @author Vinicius Brand <vinicius@eita.org.br> + * * @license GNU AGPL version 3 or any later version * * This program is free software: you can redistribute it and/or modify @@ -21,8 +24,10 @@ namespace OCA\User_LDAP\Tests; +use OCA\User_LDAP\ILDAPUserPlugin; use OCA\User_LDAP\ILDAPWrapper; use OCA\User_LDAP\User_Proxy; +use OCA\User_LDAP\UserPluginManager; use OCP\IConfig; use OCP\IUserSession; use OCP\Notification\IManager as INotificationManager; @@ -39,6 +44,8 @@ class User_ProxyTest extends TestCase { private $userSession; /** @var User_Proxy|\PHPUnit_Framework_MockObject_MockObject */ private $proxy; + /** @var UserPluginManager|\PHPUnit_Framework_MockObject_MockObject */ + private $userPluginManager; public function setUp() { parent::setUp(); @@ -47,6 +54,7 @@ class User_ProxyTest extends TestCase { $this->config = $this->createMock(IConfig::class); $this->notificationManager = $this->createMock(INotificationManager::class); $this->userSession = $this->createMock(IUserSession::class); + $this->userPluginManager = $this->createMock(UserPluginManager::class); $this->proxy = $this->getMockBuilder(User_Proxy::class) ->setConstructorArgs([ [], @@ -54,6 +62,7 @@ class User_ProxyTest extends TestCase { $this->config, $this->notificationManager, $this->userSession, + $this->userPluginManager ]) ->setMethods(['handleRequest']) ->getMock(); @@ -68,4 +77,23 @@ class User_ProxyTest extends TestCase { $this->assertTrue($this->proxy->setPassword('MyUid', 'MyPassword')); } + + public function testSetDisplayName() { + $this->proxy + ->expects($this->once()) + ->method('handleRequest') + ->with('MyUid', 'setDisplayName', ['MyUid', 'MyPassword']) + ->willReturn(true); + + $this->assertTrue($this->proxy->setDisplayName('MyUid', 'MyPassword')); } + + public function testCreateUser() { + $this->proxy + ->expects($this->once()) + ->method('handleRequest') + ->with('MyUid', 'createUser', ['MyUid', 'MyPassword']) + ->willReturn(true); + + $this->assertTrue($this->proxy->createUser('MyUid', 'MyPassword')); + } } |