Skip to content

Commit ed06797

Browse files
authored
Update TestGenerator.php
1 parent c5751c6 commit ed06797

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

src/Magento/FunctionalTestingFramework/Util/TestGenerator.php

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -261,32 +261,32 @@ public function throwExceptionIfDuplicateArgumentsFound(string $fileName): void
261261
$argumentArray = [];
262262
$actionGroupStart = false;
263263
foreach ($fileToArr as $fileVal) {
264-
$fileVal = trim($fileVal);
265-
if (str_starts_with($fileVal, '<actionGroup') && !str_ends_with($fileVal, '/>')) {
266-
$actionGroupStart = true;
267-
continue;
268-
}
269-
if ($fileVal === '</actionGroup>') {
270-
$argumentNameArray = [];
271-
foreach ($argumentArray as $argument) {
272-
$subtringStart = strpos($argument, 'name=');
273-
$subtringStart += strlen('name=');
274-
$size = strpos($argument, ' ', $subtringStart) - $subtringStart;
275-
$argumentName = substr($argument, $subtringStart, $size);
276-
if (in_array($argumentName, $argumentNameArray)) {
277-
$err[] = sprintf('Duplicate argument name: %s in test file: %s', $argumentName, $fileName);
278-
throw new TestFrameworkException(implode(PHP_EOL, $err));
279-
}
280-
$argumentNameArray[] = $argumentName;
281-
}
282-
$argumentArray = [];
283-
$actionGroupStart = false;
284-
continue;
285-
}
286-
if ($actionGroupStart) {
287-
$argumentArray[] = $fileVal;
288-
}
289-
}
264+
$fileVal = trim($fileVal);
265+
if ((str_starts_with($fileVal, '<actionGroup') || str_starts_with($fileVal, '<helper')) && !str_ends_with($fileVal, '/>')) {
266+
$actionGroupStart = true;
267+
continue;
268+
}
269+
if ($fileVal === '</actionGroup>' || $fileVal === '</helper>') {
270+
$argumentNameArray = [];
271+
foreach ($argumentArray as $argument) {
272+
$subtringStart = strpos($argument, 'name=');
273+
$subtringStart += strlen('name=');
274+
$size = strpos($argument, ' ', $subtringStart) - $subtringStart;
275+
$argumentName = substr($argument, $subtringStart, $size);
276+
if (in_array($argumentName, $argumentNameArray)) {
277+
$err[] = sprintf('Duplicate argument for actiongroup or helper with name: %s in test file: %s', $argumentName, $fileName);
278+
throw new TestFrameworkException(implode(PHP_EOL, $err));
279+
}
280+
$argumentNameArray[] = $argumentName;
281+
}
282+
$argumentArray = [];
283+
$actionGroupStart = false;
284+
continue;
285+
}
286+
if ($actionGroupStart) {
287+
$argumentArray[] = $fileVal;
288+
}
289+
}
290290
}
291291

292292
/**

0 commit comments

Comments
 (0)