Skip to content

Commit

Permalink
Improve test readability: array access instead of array_map
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Rothuis committed Feb 13, 2017
1 parent b366acd commit 3b423b5
Showing 1 changed file with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -259,11 +259,10 @@ public function allowed_second_factor_list_is_changed_if_its_values_are_differen
$originalAllowedSecondFactorList = AllowedSecondFactorList::blank();

$secondFactorsToAllow = ['sms', 'yubikey'];

$allowedSecondFactors = array_map(function ($secondFactorType) {
return new SecondFactorType($secondFactorType);
}, $secondFactorsToAllow);
$allowedSecondFactorList = AllowedSecondFactorList::ofTypes($allowedSecondFactors);
$updatedAllowedSecondFactorList = AllowedSecondFactorList::ofTypes([
new SecondFactorType($secondFactorsToAllow[0]),
new SecondFactorType($secondFactorsToAllow[1])
]);

$command = new ReconfigureInstitutionConfigurationOptionsCommand();
$command->institution = $institution->getInstitution();
Expand Down Expand Up @@ -291,7 +290,7 @@ public function allowed_second_factor_list_is_changed_if_its_values_are_differen
new AllowedSecondFactorListUpdatedEvent(
$institutionConfigurationId,
$institution,
$allowedSecondFactorList
$updatedAllowedSecondFactorList
)
]);
}
Expand All @@ -303,15 +302,16 @@ public function allowed_second_factor_list_is_changed_if_its_values_are_differen
public function allowed_second_factor_list_is_not_changed_if_its_values_are_the_same_as_the_current_list()
{
$secondFactorsToAllow = ['sms', 'yubikey'];
$allowedSecondFactors = array_map(function ($secondFactorType) {
return new SecondFactorType($secondFactorType);
}, $secondFactorsToAllow);
$allowedSecondFactorList = AllowedSecondFactorList::ofTypes([
new SecondFactorType($secondFactorsToAllow[0]),
new SecondFactorType($secondFactorsToAllow[1])
]);

$institution = new Institution('Institution');
$institutionConfigurationId = InstitutionConfigurationId::normalizedFrom($institution);
$useRaLocationsOption = UseRaLocationsOption::getDefault();
$showRaaContactInformationOption = ShowRaaContactInformationOption::getDefault();
$originalAllowedSecondFactorList = AllowedSecondFactorList::ofTypes($allowedSecondFactors);
$originalAllowedSecondFactorList = $allowedSecondFactorList;

$command = new ReconfigureInstitutionConfigurationOptionsCommand();
$command->institution = $institution->getInstitution();
Expand Down

0 comments on commit 3b423b5

Please sign in to comment.