diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/User/ManagerTest.php | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/tests/lib/User/ManagerTest.php b/tests/lib/User/ManagerTest.php index cf725aae671..9520cd640fd 100644 --- a/tests/lib/User/ManagerTest.php +++ b/tests/lib/User/ManagerTest.php @@ -9,6 +9,7 @@ namespace Test\User; use OC\User\Database; +use OC\User\Manager; use OCP\IConfig; use OCP\IUser; use Test\TestCase; @@ -304,7 +305,6 @@ class ManagerTest extends TestCase { $this->setExpectedException(\InvalidArgumentException::class, $exception); $manager->createUser($uid, $password); - } public function testCreateUserSingleBackendNotExists() { @@ -386,6 +386,25 @@ class ManagerTest extends TestCase { } /** + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage Could not create user + */ + public function testCreateUserFromBackendWithBackendError() { + /** @var IConfig|\PHPUnit_Framework_MockObject_MockObject $config */ + $config = $this->createMock(IConfig::class); + /** @var \Test\Util\User\Dummy|\PHPUnit_Framework_MockObject_MockObject $backend */ + $backend = $this->createMock(\Test\Util\User\Dummy::class); + $backend + ->expects($this->once()) + ->method('createUser') + ->with('MyUid', 'MyPassword') + ->willReturn(false); + + $manager = new Manager($config); + $manager->createUserFromBackend('MyUid', 'MyPassword', $backend); + } + + /** * @expectedException \Exception */ public function testCreateUserTwoBackendExists() { |