diff options
author | Joas Schilling <coding@schilljs.com> | 2017-04-27 08:56:51 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2017-04-27 08:56:51 +0200 |
commit | 9212089151e827b648033a4812a5dcac5058b715 (patch) | |
tree | 89ad1ee29e1a47239d6e5420f3145a43637e69fc /tests | |
parent | 9e6ac3de700ebf51e3677e752db4928afacbf7e6 (diff) | |
download | nextcloud-server-9212089151e827b648033a4812a5dcac5058b715.tar.gz nextcloud-server-9212089151e827b648033a4812a5dcac5058b715.zip |
Use the new method in the old one to remove duplicate code
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests')
-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); |