13 private static $specialGroups = [
15 'recommended_solutions',
16 'other_paypal_payment_solutions',
17 'other_payment_methods',
28 $modifiedStructure = $modifier->modify($structure);
29 $presentSpecialGroups = array_intersect(
31 array_keys($modifiedStructure)
36 $presentSpecialGroups,
37 sprintf(
'All special groups must be present in %s case',
$case)
49 $modifiedStructure = $modifier->modify($structure);
50 $presentNotSpecialGroups = array_diff(
51 array_keys($modifiedStructure),
57 $presentNotSpecialGroups,
58 sprintf(
'Only special groups should be present at top level in "%s" case',
$case)
70 $modifiedStructure = $modifier->modify($structure);
72 $removedGroups = array_diff(
73 $this->fetchAllAvailableGroups($structure),
74 $this->fetchAllAvailableGroups($modifiedStructure)
80 sprintf(
'Groups should not be removed after modification in "%s" case',
$case)
87 'some_payment_method1' => [
88 'id' =>
'some_payment_method1',
89 'displayIn' =>
'recommended_solutions',
94 'some_payment_method2' => [
95 'id' =>
'some_payment_method2',
96 'displayIn' =>
'recommended_solutions' 98 'some_payment_method3' => [
99 'id' =>
'some_payment_method3',
100 'displayIn' =>
'other_payment_methods' 102 'some_payment_method4' => [
103 'id' =>
'some_payment_method4',
104 'displayIn' =>
'recommended_solutions' 106 'some_payment_method5' => [
107 'id' =>
'some_payment_method5',
114 $modifiedStructure = $modifier->modify($structure);
119 'recommended_solutions' => [
121 'some_payment_method1' => [
122 'id' =>
'some_payment_method1',
124 'some_payment_method2' => [
125 'id' =>
'some_payment_method2',
127 'some_payment_method4' => [
128 'id' =>
'some_payment_method4',
132 'other_paypal_payment_solutions' => [],
133 'other_payment_methods' => [
135 'some_payment_method3' => [
136 'id' =>
'some_payment_method3',
139 'id' =>
'some_group',
141 'some_payment_method5' => [
142 'id' =>
'some_payment_method5',
150 'Some group is not moved correctly' 161 private function fetchAllAvailableGroups($structure)
163 $availableGroups = [];
165 $availableGroups[] =
$group;
166 if (isset(
$data[
'children'])) {
167 $availableGroups = array_merge(
169 $this->fetchAllAvailableGroups(
$data[
'children'])
173 $availableGroups = array_values(array_unique($availableGroups));
174 sort($availableGroups);
175 return $availableGroups;
183 return include
__DIR__ .
'/_files/payment_section_structure_variations.php';
testOnlySpecialGroupsPresent($case, $structure)
testMovedToTargetSpecialGroup()
testSpecialGroupsPresent($case, $structure)
defined('TESTS_BP')||define('TESTS_BP' __DIR__
testGroupsNotRemovedAfterModification($case, $structure)