aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/Accounts
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib/Accounts')
-rw-r--r--tests/lib/Accounts/AccountManagerTest.php23
-rw-r--r--tests/lib/Accounts/AccountPropertyTest.php7
-rw-r--r--tests/lib/Accounts/HooksTest.php12
3 files changed, 19 insertions, 23 deletions
diff --git a/tests/lib/Accounts/AccountManagerTest.php b/tests/lib/Accounts/AccountManagerTest.php
index fab3aaf5fdd..05c7efd08fb 100644
--- a/tests/lib/Accounts/AccountManagerTest.php
+++ b/tests/lib/Accounts/AccountManagerTest.php
@@ -499,7 +499,7 @@ class AccountManagerTest extends TestCase {
$this->invokePrivate($accountManager, 'updateUser', [$user, $newData, $oldData]);
}
- public function dataTrueFalse(): array {
+ public static function dataTrueFalse(): array {
return [
#$newData | $oldData | $insertNew | $updateExisting
[['myProperty' => ['value' => 'newData']], ['myProperty' => ['value' => 'oldData']], false, true],
@@ -896,7 +896,7 @@ class AccountManagerTest extends TestCase {
}
}
- public function searchDataProvider(): array {
+ public static function searchDataProvider(): array {
return [
[ #0 Search for an existing name
IAccountManager::PROPERTY_DISPLAYNAME,
@@ -948,21 +948,22 @@ class AccountManagerTest extends TestCase {
];
}
- public function dataCheckEmailVerification(): array {
+ public static function dataCheckEmailVerification(): array {
return [
- [$this->makeUser('steve', 'Steve Smith', 'steve@steve.steve'), null],
- [$this->makeUser('emma', 'Emma Morales', 'emma@emma.com'), 'emma@morales.com'],
- [$this->makeUser('sarah@web.org', 'Sarah Foster', 'sarah@web.org'), null],
- [$this->makeUser('cole@web.org', 'Cole Harrison', 'cole@web.org'), 'cole@example.com'],
- [$this->makeUser('8d29e358-cf69-4849-bbf9-28076c0b908b', 'Alice McPherson', 'alice@example.com'), 'alice@mcpherson.com'],
- [$this->makeUser('11da2744-3f4d-4c17-8c13-4c057a379237', 'James Loranger', 'james@example.com'), ''],
+ [['steve', 'Steve Smith', 'steve@steve.steve'], null],
+ [['emma', 'Emma Morales', 'emma@emma.com'], 'emma@morales.com'],
+ [['sarah@web.org', 'Sarah Foster', 'sarah@web.org'], null],
+ [['cole@web.org', 'Cole Harrison', 'cole@web.org'], 'cole@example.com'],
+ [['8d29e358-cf69-4849-bbf9-28076c0b908b', 'Alice McPherson', 'alice@example.com'], 'alice@mcpherson.com'],
+ [['11da2744-3f4d-4c17-8c13-4c057a379237', 'James Loranger', 'james@example.com'], ''],
];
}
/**
* @dataProvider dataCheckEmailVerification
*/
- public function testCheckEmailVerification(IUser $user, ?string $newEmail): void {
+ public function testCheckEmailVerification(array $userData, ?string $newEmail): void {
+ $user = $this->makeUser(...$userData);
// Once because of getAccount, once because of getUser
$this->config->expects($this->exactly(2))->method('getSystemValue')->with('account_manager.default_property_scope', [])->willReturn([]);
$account = $this->accountManager->getAccount($user);
@@ -988,7 +989,7 @@ class AccountManagerTest extends TestCase {
$this->invokePrivate($this->accountManager, 'checkEmailVerification', [$account, $oldData]);
}
- public function dataSetDefaultPropertyScopes(): array {
+ public static function dataSetDefaultPropertyScopes(): array {
return [
[
[],
diff --git a/tests/lib/Accounts/AccountPropertyTest.php b/tests/lib/Accounts/AccountPropertyTest.php
index 5df66eaa117..68e1da41557 100644
--- a/tests/lib/Accounts/AccountPropertyTest.php
+++ b/tests/lib/Accounts/AccountPropertyTest.php
@@ -56,18 +56,13 @@ class AccountPropertyTest extends TestCase {
$this->assertEquals(IAccountManager::SCOPE_LOCAL, $actualReturn->getScope());
}
- public function scopesProvider() {
+ public static function scopesProvider(): array {
return [
// current values
[IAccountManager::SCOPE_PRIVATE, IAccountManager::SCOPE_PRIVATE],
[IAccountManager::SCOPE_LOCAL, IAccountManager::SCOPE_LOCAL],
[IAccountManager::SCOPE_FEDERATED, IAccountManager::SCOPE_FEDERATED],
[IAccountManager::SCOPE_PUBLISHED, IAccountManager::SCOPE_PUBLISHED],
- // legacy values
- [IAccountManager::VISIBILITY_PRIVATE, IAccountManager::SCOPE_LOCAL],
- [IAccountManager::VISIBILITY_CONTACTS_ONLY, IAccountManager::SCOPE_FEDERATED],
- [IAccountManager::VISIBILITY_PUBLIC, IAccountManager::SCOPE_PUBLISHED],
- ['', IAccountManager::SCOPE_LOCAL],
// invalid values
['unknown', null],
['v2-unknown', null],
diff --git a/tests/lib/Accounts/HooksTest.php b/tests/lib/Accounts/HooksTest.php
index 75772089f43..73cef2e2c65 100644
--- a/tests/lib/Accounts/HooksTest.php
+++ b/tests/lib/Accounts/HooksTest.php
@@ -96,14 +96,14 @@ class HooksTest extends TestCase {
}
}
+ $params['user'] = $this->createMock(IUser::class);
$this->hooks->changeUserHook($params['user'], $params['feature'], $params['value']);
}
- public function dataTestChangeUserHook() {
- $user = $this->createMock(IUser::class);
+ public static function dataTestChangeUserHook(): array {
return [
[
- ['user' => $user, 'feature' => '', 'value' => ''],
+ ['feature' => '', 'value' => ''],
[
IAccountManager::PROPERTY_EMAIL => ['value' => ''],
IAccountManager::PROPERTY_DISPLAYNAME => ['value' => '']
@@ -111,7 +111,7 @@ class HooksTest extends TestCase {
false, false, true
],
[
- ['user' => $user, 'feature' => 'foo', 'value' => 'bar'],
+ ['feature' => 'foo', 'value' => 'bar'],
[
IAccountManager::PROPERTY_EMAIL => ['value' => 'oldMail@example.com'],
IAccountManager::PROPERTY_DISPLAYNAME => ['value' => 'oldDisplayName']
@@ -119,7 +119,7 @@ class HooksTest extends TestCase {
false, false, false
],
[
- ['user' => $user, 'feature' => 'eMailAddress', 'value' => 'newMail@example.com'],
+ ['feature' => 'eMailAddress', 'value' => 'newMail@example.com'],
[
IAccountManager::PROPERTY_EMAIL => ['value' => 'oldMail@example.com'],
IAccountManager::PROPERTY_DISPLAYNAME => ['value' => 'oldDisplayName']
@@ -127,7 +127,7 @@ class HooksTest extends TestCase {
true, false, false
],
[
- ['user' => $user, 'feature' => 'displayName', 'value' => 'newDisplayName'],
+ ['feature' => 'displayName', 'value' => 'newDisplayName'],
[
IAccountManager::PROPERTY_EMAIL => ['value' => 'oldMail@example.com'],
IAccountManager::PROPERTY_DISPLAYNAME => ['value' => 'oldDisplayName']