Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2017-04-27 09:56:51 +0300
committerJoas Schilling <coding@schilljs.com>2017-04-27 09:56:51 +0300
commit9212089151e827b648033a4812a5dcac5058b715 (patch)
tree89ad1ee29e1a47239d6e5420f3145a43637e69fc /tests
parent9e6ac3de700ebf51e3677e752db4928afacbf7e6 (diff)
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.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);