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
8cae515daa
commit
ef5d538448
|
@ -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
|
* @dataProvider dataTestSetUserSettings
|
||||||
*
|
*
|
||||||
|
@ -205,48 +250,7 @@ class UsersControllerTest extends \Test\TestCase {
|
||||||
$this->accountManager->expects($this->once())
|
$this->accountManager->expects($this->once())
|
||||||
->method('getUser')
|
->method('getUser')
|
||||||
->with($user)
|
->with($user)
|
||||||
->willReturn([
|
->willReturn($this->getDefaultAccountManagerUserData());
|
||||||
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,
|
|
||||||
],
|
|
||||||
]);
|
|
||||||
|
|
||||||
$controller->expects($this->once())
|
$controller->expects($this->once())
|
||||||
->method('saveUserSettings')
|
->method('saveUserSettings')
|
||||||
|
|
Loading…
Reference in New Issue