summaryrefslogtreecommitdiffstats
path: root/apps/provisioning_api/tests
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2021-04-26 14:34:03 +0200
committerJoas Schilling <coding@schilljs.com>2021-04-27 15:28:02 +0200
commit03b467bd237a2b7849092c3991a76ed1205bd583 (patch)
tree9ed1566fa3d3b471d8f7643faec02ad5d712ae11 /apps/provisioning_api/tests
parentf67a10e8d096ba859540e678857e2611e3b2cfd0 (diff)
downloadnextcloud-server-03b467bd237a2b7849092c3991a76ed1205bd583.tar.gz
nextcloud-server-03b467bd237a2b7849092c3991a76ed1205bd583.zip
Also check implementsAction method
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps/provisioning_api/tests')
-rw-r--r--apps/provisioning_api/tests/Controller/UsersControllerTest.php87
1 files changed, 85 insertions, 2 deletions
diff --git a/apps/provisioning_api/tests/Controller/UsersControllerTest.php b/apps/provisioning_api/tests/Controller/UsersControllerTest.php
index d4c2faba98b..1afe9be4319 100644
--- a/apps/provisioning_api/tests/Controller/UsersControllerTest.php
+++ b/apps/provisioning_api/tests/Controller/UsersControllerTest.php
@@ -66,7 +66,6 @@ use OCP\L10N\IFactory;
use OCP\Mail\IEMailTemplate;
use OCP\Security\Events\GenerateSecurePasswordEvent;
use OCP\Security\ISecureRandom;
-use OCP\User\Backend\IGetDisplayNameBackend;
use OCP\User\Backend\ISetDisplayNameBackend;
use OCP\UserInterface;
use PHPUnit\Framework\MockObject\MockObject;
@@ -1491,6 +1490,12 @@ class UsersControllerTest extends TestCase {
->method('getUID')
->willReturn('UID');
+ $backend = $this->createMock(UserInterface::class);
+ $targetUser
+ ->expects($this->any())
+ ->method('getBackend')
+ ->willReturn($backend);
+
$this->assertEquals([], $this->api->editUser('UserToEdit', 'email', 'demo@nextcloud.com')->getData());
}
@@ -1524,6 +1529,12 @@ class UsersControllerTest extends TestCase {
->method('getUID')
->willReturn('UID');
+ $backend = $this->createMock(UserInterface::class);
+ $targetUser
+ ->expects($this->any())
+ ->method('getBackend')
+ ->willReturn($backend);
+
$this->api->editUser('UserToEdit', 'email', 'demo.org');
}
@@ -1557,6 +1568,12 @@ class UsersControllerTest extends TestCase {
->with('UserToEdit')
->willReturn($loggedInUser);
+ $backend = $this->createMock(UserInterface::class);
+ $loggedInUser
+ ->expects($this->any())
+ ->method('getBackend')
+ ->willReturn($backend);
+
$this->accountManager->expects($this->once())
->method('getUser')
->with($loggedInUser)
@@ -1601,6 +1618,12 @@ class UsersControllerTest extends TestCase {
->with('UserToEdit')
->willReturn($loggedInUser);
+ $backend = $this->createMock(UserInterface::class);
+ $loggedInUser
+ ->expects($this->any())
+ ->method('getBackend')
+ ->willReturn($backend);
+
$this->accountManager->expects($this->once())
->method('getUser')
->with($loggedInUser)
@@ -1645,6 +1668,12 @@ class UsersControllerTest extends TestCase {
->method('getUID')
->willReturn('UID');
+ $backend = $this->createMock(UserInterface::class);
+ $targetUser
+ ->expects($this->any())
+ ->method('getBackend')
+ ->willReturn($backend);
+
$this->assertEquals([], $this->api->editUser('UserToEdit', 'password', 'NewPassword')->getData());
}
@@ -1678,6 +1707,12 @@ class UsersControllerTest extends TestCase {
->method('getUID')
->willReturn('UID');
+ $backend = $this->createMock(UserInterface::class);
+ $targetUser
+ ->expects($this->any())
+ ->method('getBackend')
+ ->willReturn($backend);
+
$this->api->editUser('UserToEdit', 'quota', 'NewQuota');
}
@@ -1710,6 +1745,12 @@ class UsersControllerTest extends TestCase {
->method('getUID')
->willReturn('UID');
+ $backend = $this->createMock(UserInterface::class);
+ $targetUser
+ ->expects($this->any())
+ ->method('getBackend')
+ ->willReturn($backend);
+
$this->assertEquals([], $this->api->editUser('UserToEdit', 'quota', '3042824')->getData());
}
@@ -1745,6 +1786,12 @@ class UsersControllerTest extends TestCase {
->method('getUID')
->willReturn('UID');
+ $backend = $this->createMock(UserInterface::class);
+ $targetUser
+ ->expects($this->any())
+ ->method('getBackend')
+ ->willReturn($backend);
+
$this->api->editUser('UserToEdit', 'quota', 'ABC');
}
@@ -1784,6 +1831,12 @@ class UsersControllerTest extends TestCase {
->method('getUID')
->willReturn('UID');
+ $backend = $this->createMock(UserInterface::class);
+ $targetUser
+ ->expects($this->any())
+ ->method('getBackend')
+ ->willReturn($backend);
+
$this->assertEquals([], $this->api->editUser('UserToEdit', 'quota', '3042824')->getData());
}
@@ -1826,6 +1879,12 @@ class UsersControllerTest extends TestCase {
->method('getUID')
->willReturn('UserToEdit');
+ $backend = $this->createMock(UserInterface::class);
+ $targetUser
+ ->expects($this->any())
+ ->method('getBackend')
+ ->willReturn($backend);
+
$this->assertEquals([], $this->api->editUser('UserToEdit', 'language', 'de')->getData());
}
@@ -1876,6 +1935,12 @@ class UsersControllerTest extends TestCase {
->method('getUID')
->willReturn('UserToEdit');
+ $backend = $this->createMock(UserInterface::class);
+ $targetUser
+ ->expects($this->any())
+ ->method('getBackend')
+ ->willReturn($backend);
+
$this->assertEquals([], $this->api->editUser('UserToEdit', 'language', 'de')->getData());
}
@@ -1917,6 +1982,12 @@ class UsersControllerTest extends TestCase {
->method('getUID')
->willReturn('UserToEdit');
+ $backend = $this->createMock(UserInterface::class);
+ $targetUser
+ ->expects($this->any())
+ ->method('getBackend')
+ ->willReturn($backend);
+
$this->assertEquals([], $this->api->editUser('UserToEdit', 'language', 'de')->getData());
}
@@ -1963,6 +2034,12 @@ class UsersControllerTest extends TestCase {
->method('getUID')
->willReturn('UserToEdit');
+ $backend = $this->createMock(UserInterface::class);
+ $targetUser
+ ->expects($this->any())
+ ->method('getBackend')
+ ->willReturn($backend);
+
$this->assertEquals([], $this->api->editUser('UserToEdit', 'language', 'ru')->getData());
}
@@ -2002,6 +2079,12 @@ class UsersControllerTest extends TestCase {
->method('getUID')
->willReturn('UID');
+ $backend = $this->createMock(UserInterface::class);
+ $targetUser
+ ->expects($this->any())
+ ->method('getBackend')
+ ->willReturn($backend);
+
$this->assertEquals([], $this->api->editUser('UserToEdit', 'quota', '3042824')->getData());
}
@@ -3737,7 +3820,7 @@ class UsersControllerTest extends TestCase {
IAccountManager::PROPERTY_WEBSITE,
IAccountManager::PROPERTY_TWITTER,
]],
- [true, IGetDisplayNameBackend::class, [
+ [true, UserInterface::class, [
IAccountManager::PROPERTY_EMAIL,
IAccountManager::PROPERTY_PHONE,
IAccountManager::PROPERTY_ADDRESS,