aboutsummaryrefslogtreecommitdiffstats
path: root/apps/settings/tests/Controller/UsersControllerTest.php
diff options
context:
space:
mode:
authorDaniel Calviño Sánchez <danxuliu@gmail.com>2021-01-29 20:34:10 +0100
committerDaniel Calviño Sánchez <danxuliu@gmail.com>2021-04-23 11:44:40 +0200
commitef5d538448cc2322bff0762df417d6ac110bded2 (patch)
treea5afa304c00f86cfc1a553b29d456ef44bc07385 /apps/settings/tests/Controller/UsersControllerTest.php
parent8cae515daa8397e047456a7ae223fabf6e3bf360 (diff)
downloadnextcloud-server-ef5d538448cc2322bff0762df417d6ac110bded2.tar.gz
nextcloud-server-ef5d538448cc2322bff0762df417d6ac110bded2.zip
Extract default test data to a helper getter
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'apps/settings/tests/Controller/UsersControllerTest.php')
-rw-r--r--apps/settings/tests/Controller/UsersControllerTest.php88
1 files changed, 46 insertions, 42 deletions
diff --git a/apps/settings/tests/Controller/UsersControllerTest.php b/apps/settings/tests/Controller/UsersControllerTest.php
index b3e8937821a..fd536a399e2 100644
--- a/apps/settings/tests/Controller/UsersControllerTest.php
+++ b/apps/settings/tests/Controller/UsersControllerTest.php
@@ -180,6 +180,51 @@ class UsersControllerTest extends \Test\TestCase {
}
}
+ protected function getDefaultAccountManagerUserData() {
+ return [
+ IAccountManager::PROPERTY_DISPLAYNAME =>
+ [
+ 'value' => 'Display name',
+ 'scope' => IAccountManager::SCOPE_FEDERATED,
+ 'verified' => IAccountManager::NOT_VERIFIED,
+ ],
+ IAccountManager::PROPERTY_ADDRESS =>
+ [
+ 'value' => '',
+ 'scope' => IAccountManager::SCOPE_LOCAL,
+ 'verified' => IAccountManager::NOT_VERIFIED,
+ ],
+ IAccountManager::PROPERTY_WEBSITE =>
+ [
+ 'value' => '',
+ 'scope' => IAccountManager::SCOPE_LOCAL,
+ 'verified' => IAccountManager::NOT_VERIFIED,
+ ],
+ IAccountManager::PROPERTY_EMAIL =>
+ [
+ 'value' => '',
+ 'scope' => IAccountManager::SCOPE_FEDERATED,
+ 'verified' => IAccountManager::NOT_VERIFIED,
+ ],
+ IAccountManager::PROPERTY_AVATAR =>
+ [
+ 'scope' => IAccountManager::SCOPE_FEDERATED
+ ],
+ IAccountManager::PROPERTY_PHONE =>
+ [
+ 'value' => '',
+ 'scope' => IAccountManager::SCOPE_LOCAL,
+ 'verified' => IAccountManager::NOT_VERIFIED,
+ ],
+ IAccountManager::PROPERTY_TWITTER =>
+ [
+ 'value' => '',
+ 'scope' => IAccountManager::SCOPE_LOCAL,
+ 'verified' => IAccountManager::NOT_VERIFIED,
+ ],
+ ];
+ }
+
/**
* @dataProvider dataTestSetUserSettings
*
@@ -205,48 +250,7 @@ class UsersControllerTest extends \Test\TestCase {
$this->accountManager->expects($this->once())
->method('getUser')
->with($user)
- ->willReturn([
- IAccountManager::PROPERTY_DISPLAYNAME =>
- [
- 'value' => 'Display name',
- 'scope' => IAccountManager::SCOPE_FEDERATED,
- 'verified' => IAccountManager::NOT_VERIFIED,
- ],
- IAccountManager::PROPERTY_ADDRESS =>
- [
- 'value' => '',
- 'scope' => IAccountManager::SCOPE_LOCAL,
- 'verified' => IAccountManager::NOT_VERIFIED,
- ],
- IAccountManager::PROPERTY_WEBSITE =>
- [
- 'value' => '',
- 'scope' => IAccountManager::SCOPE_LOCAL,
- 'verified' => IAccountManager::NOT_VERIFIED,
- ],
- IAccountManager::PROPERTY_EMAIL =>
- [
- 'value' => '',
- 'scope' => IAccountManager::SCOPE_FEDERATED,
- 'verified' => IAccountManager::NOT_VERIFIED,
- ],
- IAccountManager::PROPERTY_AVATAR =>
- [
- 'scope' => IAccountManager::SCOPE_FEDERATED
- ],
- IAccountManager::PROPERTY_PHONE =>
- [
- 'value' => '',
- 'scope' => IAccountManager::SCOPE_LOCAL,
- 'verified' => IAccountManager::NOT_VERIFIED,
- ],
- IAccountManager::PROPERTY_TWITTER =>
- [
- 'value' => '',
- 'scope' => IAccountManager::SCOPE_LOCAL,
- 'verified' => IAccountManager::NOT_VERIFIED,
- ],
- ]);
+ ->willReturn($this->getDefaultAccountManagerUserData());
$controller->expects($this->once())
->method('saveUserSettings')