Extract default test data to a helper getter
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
parent
eaedf5fcd9
commit
5a497841be
|
@ -166,6 +166,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
|
||||
*
|
||||
|
@ -190,48 +235,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 {
|
||||
|
|
Loading…
Reference in New Issue