summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2017-04-27 16:41:08 -0300
committerGitHub <noreply@github.com>2017-04-27 16:41:08 -0300
commitf000e22a97b9bae756cc5977badeffbc7a6852e9 (patch)
tree570c1d983747c92d4d5c396a92bfce9a311bd5bb /tests
parent2be212d179302d25e53b41a3d36b651fbc12014e (diff)
parent9212089151e827b648033a4812a5dcac5058b715 (diff)
downloadnextcloud-server-f000e22a97b9bae756cc5977badeffbc7a6852e9.tar.gz
nextcloud-server-f000e22a97b9bae756cc5977badeffbc7a6852e9.zip
Merge pull request #4522 from nextcloud/downstream-27596
Allow to create a user for a specific backend
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/User/ManagerTest.php16
1 files changed, 11 insertions, 5 deletions
diff --git a/tests/lib/User/ManagerTest.php b/tests/lib/User/ManagerTest.php
index 671b2ac57c1..aaee64f1863 100644
--- a/tests/lib/User/ManagerTest.php
+++ b/tests/lib/User/ManagerTest.php
@@ -291,10 +291,18 @@ class ManagerTest extends TestCase {
* @dataProvider dataCreateUserInvalid
*/
public function testCreateUserInvalid($uid, $password, $exception) {
+ /** @var \Test\Util\User\Dummy|\PHPUnit_Framework_MockObject_MockObject $backend */
+ $backend = $this->createMock(\Test\Util\User\Dummy::class);
+ $backend->expects($this->once())
+ ->method('implementsActions')
+ ->with(\OC\User\Backend::CREATE_USER)
+ ->willReturn(true);
- $this->setExpectedException(\Exception::class, $exception);
$manager = new \OC\User\Manager($this->config);
+ $manager->registerBackend($backend);
+
+ $this->setExpectedException(\InvalidArgumentException::class, $exception);
$manager->createUser($uid, $password);
}
@@ -362,10 +370,8 @@ class ManagerTest extends TestCase {
$backend->expects($this->never())
->method('createUser');
- $backend->expects($this->once())
- ->method('userExists')
- ->with($this->equalTo('foo'))
- ->will($this->returnValue(false));
+ $backend->expects($this->never())
+ ->method('userExists');
$manager = new \OC\User\Manager($this->config);
$manager->registerBackend($backend);