summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2017-08-23 16:49:57 +0200
committerGitHub <noreply@github.com>2017-08-23 16:49:57 +0200
commit9357cf735a2ffbbd1291cfd8480cbc2342c361f7 (patch)
tree86b13c65f99d2a7eaed795e9376a8ee5ceeac19d /tests
parent4225f938182a0b998d620d278b32a42660a6d032 (diff)
parented8a98eaa1e44d172b838c5c9caa74261ac27eb1 (diff)
downloadnextcloud-server-9357cf735a2ffbbd1291cfd8480cbc2342c361f7.tar.gz
nextcloud-server-9357cf735a2ffbbd1291cfd8480cbc2342c361f7.zip
Merge pull request #6164 from nextcloud/dont-show-error-message-when-sql-failed
Prevent SQL error message in case of error
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/User/ManagerTest.php21
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() {