Skip to content

Commit 089c0c7

Browse files
committed
ACP2E-3038: improve integration test and role fixture, allow all stores for all websites admin restricted user
1 parent 6b2f6fb commit 089c0c7

File tree

1 file changed

+21
-2
lines changed
  • app/code/Magento/Authorization/Test/Fixture

1 file changed

+21
-2
lines changed

app/code/Magento/Authorization/Test/Fixture/Role.php

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ public function apply(array $data = []): ?DataObject
9191
{
9292
$data = $this->prepareData($data);
9393

94-
$websites = isset($data['gws_websites']) ? implode(',', $data['gws_websites']) : implode(',', []);
95-
$storeGroups = isset($data['gws_store_groups']) ? implode(',', $data['gws_store_groups']) : implode(',', []);
94+
$websites = $this->convertGwsWebsiteStoreGroups($data['gws_websites']);
95+
$storeGroups = $this->convertGwsWebsiteStoreGroups($data['gws_store_groups']);
9696

9797
$role = $this->roleFactory->create();
9898
$role->setRoleName($data['role_name'])
@@ -137,4 +137,23 @@ private function prepareData(array $data): array
137137
$data = $this->dataMerger->merge(self::DEFAULT_DATA, $data);
138138
return $this->dataProcessor->process($this, $data);
139139
}
140+
141+
/**
142+
* Convert GWS websites and store groups to string
143+
*
144+
* @param $data
145+
* @return string|null
146+
*/
147+
private function convertGwsWebsiteStoreGroups($data): ?string
148+
{
149+
if (isset($data)) {
150+
if (is_array($data)) {
151+
return implode(',',$data);
152+
}
153+
if (is_string($data)) {
154+
return $data;
155+
}
156+
}
157+
return null;
158+
}
140159
}

0 commit comments

Comments
 (0)