diff options
Diffstat (limited to 'tests/lib/User/ManagerTest.php')
-rw-r--r-- | tests/lib/User/ManagerTest.php | 16 |
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); |