aboutsummaryrefslogtreecommitdiffstats
path: root/apps/provisioning_api/tests/Controller/UsersControllerTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/provisioning_api/tests/Controller/UsersControllerTest.php')
-rw-r--r--apps/provisioning_api/tests/Controller/UsersControllerTest.php35
1 files changed, 11 insertions, 24 deletions
diff --git a/apps/provisioning_api/tests/Controller/UsersControllerTest.php b/apps/provisioning_api/tests/Controller/UsersControllerTest.php
index 3f8c1566b5d..cf35a4fb324 100644
--- a/apps/provisioning_api/tests/Controller/UsersControllerTest.php
+++ b/apps/provisioning_api/tests/Controller/UsersControllerTest.php
@@ -199,8 +199,7 @@ class UsersControllerTest extends TestCase {
->willReturn($subAdminManager);
$this->groupManager
->expects($this->any())
- ->method('displayNamesInGroup')
- ->will($this->onConsecutiveCalls(['AnotherUserInTheFirstGroup' => []], ['UserInTheSecondGroup' => []]));
+ ->method('displayNamesInGroup')->willReturnOnConsecutiveCalls(['AnotherUserInTheFirstGroup' => []], ['UserInTheSecondGroup' => []]);
$expected = [
'users' => [
@@ -790,7 +789,7 @@ class UsersControllerTest extends TestCase {
$this->logger
->expects($this->exactly(2))
->method('info')
- ->willReturnCallback(function () use (&$calls) {
+ ->willReturnCallback(function () use (&$calls): void {
$expected = array_shift($calls);
$this->assertEquals($expected, func_get_args());
});
@@ -814,7 +813,7 @@ class UsersControllerTest extends TestCase {
->expects($this->once())
->method('createUser')
->with('NewUser', 'PasswordOfTheNewUser')
- ->will($this->throwException($exception));
+ ->willThrowException($exception);
$this->logger
->expects($this->once())
->method('error')
@@ -994,7 +993,7 @@ class UsersControllerTest extends TestCase {
$this->logger
->expects($this->exactly(3))
->method('info')
- ->willReturnCallback(function () use (&$calls) {
+ ->willReturnCallback(function () use (&$calls): void {
$expected = array_shift($calls);
$this->assertEquals($expected, func_get_args());
});
@@ -1534,9 +1533,7 @@ class UsersControllerTest extends TestCase {
];
}
- /**
- * @dataProvider dataSearchByPhoneNumbers
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSearchByPhoneNumbers')]
public function testSearchByPhoneNumbers(string $location, array $search, int $status, ?array $searchUsers, ?array $userMatches, array $expected): void {
$knownTo = 'knownTo';
$user = $this->createMock(IUser::class);
@@ -1862,9 +1859,7 @@ class UsersControllerTest extends TestCase {
];
}
- /**
- * @dataProvider selfEditChangePropertyProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('selfEditChangePropertyProvider')]
public function testEditUserRegularUserSelfEditChangeProperty($propertyName, $oldValue, $newValue): void {
$loggedInUser = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
@@ -1940,9 +1935,7 @@ class UsersControllerTest extends TestCase {
];
}
- /**
- * @dataProvider selfEditChangePropertyProvider
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('selfEditChangePropertyProvider')]
public function testEditUserRegularUserSelfEditChangePropertyScope($propertyName, $oldScope, $newScope): void {
$loggedInUser = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
@@ -2277,9 +2270,7 @@ class UsersControllerTest extends TestCase {
];
}
- /**
- * @dataProvider dataEditUserSelfEditChangeLanguageButForced
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataEditUserSelfEditChangeLanguageButForced')]
public function testEditUserSelfEditChangeLanguageButForced($forced): void {
$this->expectException(OCSException::class);
@@ -2373,9 +2364,7 @@ class UsersControllerTest extends TestCase {
$this->assertEquals([], $this->api->editUser('UserToEdit', 'language', 'de')->getData());
}
- /**
- * @dataProvider dataEditUserSelfEditChangeLanguageButForced
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataEditUserSelfEditChangeLanguageButForced')]
public function testEditUserAdminEditChangeLanguageInvalidLanguage(): void {
$this->expectException(OCSException::class);
@@ -4363,9 +4352,7 @@ class UsersControllerTest extends TestCase {
];
}
- /**
- * @dataProvider dataGetEditableFields
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataGetEditableFields')]
public function testGetEditableFields(bool $allowedToChangeDisplayName, bool $allowedToChangeEmail, string $userBackend, array $expected): void {
$this->config->method('getSystemValue')->willReturnCallback(fn (string $key, mixed $default) => match ($key) {
'allow_user_to_change_display_name' => $allowedToChangeDisplayName,
@@ -4400,7 +4387,7 @@ class UsersControllerTest extends TestCase {
$account = $this->createMock(IAccount::class);
$account->method('getProperty')
- ->will($this->returnValueMap($mockedProperties));
+ ->willReturnMap($mockedProperties);
$this->accountManager->expects($this->any())->method('getAccount')
->with($targetUser)