Skip to content

Commit c93cc72

Browse files
Ashish.Kumar18Ashish.Kumar18
authored andcommitted
ACQE-2580: extra validation added
1 parent fc3b3e4 commit c93cc72

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/Magento/FunctionalTestingFramework/Util/TestGenerator.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,12 +264,16 @@ public function assembleTestPhp($testObject)
264264
$fileToArr = explode("\n", file_get_contents($testObject->getFilename()));
265265
$argArr = [];
266266
foreach ($fileToArr as $key => $fileVal) {
267-
if (strpos($fileVal, "<argument name") == true) {
267+
if (!empty(strpos($fileVal, "<argument name"))) {
268268
$argArr[$key] = explode(" ", trim($fileVal))[1];
269269
}
270270
}
271271
foreach ($argArr as $key => $arrVal) {
272-
if (@$argArr[$key + 1] == $arrVal || @$argArr[$key - 1] == $arrVal) {
272+
if (!empty($argArr[$key + 1]) && $argArr[$key + 1] === $arrVal ) {
273+
$err[] = 'Duplicate argument name '.$arrVal.' not allowed in helper or actionGroup';
274+
throw new TestFrameworkException(implode(PHP_EOL, $err));
275+
}
276+
if (!empty($argArr[$key - 1]) && $argArr[$key - 1] === $arrVal) {
273277
$err[] = 'Duplicate argument name '.$arrVal.' not allowed in helper or actionGroup';
274278
throw new TestFrameworkException(implode(PHP_EOL, $err));
275279
}

0 commit comments

Comments
 (0)