]> source.dussan.org Git - nextcloud-server.git/commitdiff
Extract default test data to a helper getter
authorDaniel Calviño Sánchez <danxuliu@gmail.com>
Fri, 29 Jan 2021 19:34:10 +0000 (20:34 +0100)
committerDaniel Calviño Sánchez <danxuliu@gmail.com>
Fri, 23 Apr 2021 14:53:49 +0000 (16:53 +0200)
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
apps/settings/tests/Controller/UsersControllerTest.php

index ace07740901c9ad7ed418c86510d6ee8ad75b271..763226dd0a4b197fadad10123035f0137a7bbd37 100644 (file)
@@ -172,6 +172,51 @@ class UsersControllerTest extends \Test\TestCase {
                }
        }
 
+       protected function getDefaultAccountManagerUserData() {
+               return [
+                       IAccountManager::PROPERTY_DISPLAYNAME =>
+                               [
+                                       'value' => 'Display name',
+                                       'scope' => IAccountManager::VISIBILITY_CONTACTS_ONLY,
+                                       'verified' => IAccountManager::NOT_VERIFIED,
+                               ],
+                       IAccountManager::PROPERTY_ADDRESS =>
+                               [
+                                       'value' => '',
+                                       'scope' => IAccountManager::VISIBILITY_PRIVATE,
+                                       'verified' => IAccountManager::NOT_VERIFIED,
+                               ],
+                       IAccountManager::PROPERTY_WEBSITE =>
+                               [
+                                       'value' => '',
+                                       'scope' => IAccountManager::VISIBILITY_PRIVATE,
+                                       'verified' => IAccountManager::NOT_VERIFIED,
+                               ],
+                       IAccountManager::PROPERTY_EMAIL =>
+                               [
+                                       'value' => '',
+                                       'scope' => IAccountManager::VISIBILITY_CONTACTS_ONLY,
+                                       'verified' => IAccountManager::NOT_VERIFIED,
+                               ],
+                       IAccountManager::PROPERTY_AVATAR =>
+                               [
+                                       'scope' => IAccountManager::VISIBILITY_CONTACTS_ONLY
+                               ],
+                       IAccountManager::PROPERTY_PHONE =>
+                               [
+                                       'value' => '',
+                                       'scope' => IAccountManager::VISIBILITY_PRIVATE,
+                                       'verified' => IAccountManager::NOT_VERIFIED,
+                               ],
+                       IAccountManager::PROPERTY_TWITTER =>
+                               [
+                                       'value' => '',
+                                       'scope' => IAccountManager::VISIBILITY_PRIVATE,
+                                       'verified' => IAccountManager::NOT_VERIFIED,
+                               ],
+               ];
+       }
+
        /**
         * @dataProvider dataTestSetUserSettings
         *
@@ -196,48 +241,7 @@ class UsersControllerTest extends \Test\TestCase {
                        $this->accountManager->expects($this->once())
                                ->method('getUser')
                                ->with($user)
-                               ->willReturn([
-                                       IAccountManager::PROPERTY_DISPLAYNAME =>
-                                               [
-                                                       'value' => 'Display name',
-                                                       'scope' => IAccountManager::VISIBILITY_CONTACTS_ONLY,
-                                                       'verified' => IAccountManager::NOT_VERIFIED,
-                                               ],
-                                       IAccountManager::PROPERTY_ADDRESS =>
-                                               [
-                                                       'value' => '',
-                                                       'scope' => IAccountManager::VISIBILITY_PRIVATE,
-                                                       'verified' => IAccountManager::NOT_VERIFIED,
-                                               ],
-                                       IAccountManager::PROPERTY_WEBSITE =>
-                                               [
-                                                       'value' => '',
-                                                       'scope' => IAccountManager::VISIBILITY_PRIVATE,
-                                                       'verified' => IAccountManager::NOT_VERIFIED,
-                                               ],
-                                       IAccountManager::PROPERTY_EMAIL =>
-                                               [
-                                                       'value' => '',
-                                                       'scope' => IAccountManager::VISIBILITY_CONTACTS_ONLY,
-                                                       'verified' => IAccountManager::NOT_VERIFIED,
-                                               ],
-                                       IAccountManager::PROPERTY_AVATAR =>
-                                               [
-                                                       'scope' => IAccountManager::VISIBILITY_CONTACTS_ONLY
-                                               ],
-                                       IAccountManager::PROPERTY_PHONE =>
-                                               [
-                                                       'value' => '',
-                                                       'scope' => IAccountManager::VISIBILITY_PRIVATE,
-                                                       'verified' => IAccountManager::NOT_VERIFIED,
-                                               ],
-                                       IAccountManager::PROPERTY_TWITTER =>
-                                               [
-                                                       'value' => '',
-                                                       'scope' => IAccountManager::VISIBILITY_PRIVATE,
-                                                       'verified' => IAccountManager::NOT_VERIFIED,
-                                               ],
-                               ]);
+                               ->willReturn($this->getDefaultAccountManagerUserData());
 
                        $controller->expects($this->once())->method('saveUserSettings');
                } else {