Skip to content

Commit 3409b4b

Browse files
committed
MQE-1118: Handle XML merge failures gracefully
- Added Test and made error a tiny bit more specific (error is caught by child classes given context)
1 parent f1b41c9 commit 3409b4b

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

dev/tests/unit/Magento/FunctionalTestFramework/Test/Config/ActionGroupDomTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
namespace Tests\unit\Magento\FunctionalTestFramework\Test\Config;
77

88
use Magento\FunctionalTestingFramework\Exceptions\Collector\ExceptionCollector;
9+
use Magento\FunctionalTestingFramework\Config\Dom\ValidationException;
910
use Magento\FunctionalTestingFramework\Test\Config\ActionGroupDom;
1011
use Magento\FunctionalTestingFramework\Util\MagentoTestCase;
1112

@@ -29,4 +30,20 @@ public function testActionGroupDomStepKeyValidation()
2930
$this->expectException(\Exception::class);
3031
$exceptionCollector->throwException();
3132
}
33+
34+
/**
35+
* Test Action Group invalid XML
36+
*/
37+
public function testActionGroupDomInvalidXmlValidation()
38+
{
39+
$sampleXml = "<actionGroups>
40+
<actionGroup name=\"actionGroupWithoutArguments\">
41+
<wait>
42+
</actionGroup>
43+
</actionGroups>";
44+
45+
$exceptionCollector = new ExceptionCollector();
46+
$this->expectException(ValidationException::class);
47+
new ActionGroupDom($sampleXml, 'bad.xml', $exceptionCollector);
48+
}
3249
}

src/Magento/FunctionalTestingFramework/Config/Dom.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ protected function initDom($xml, $filename = null)
366366
try {
367367
$dom->loadXML($xml);
368368
} catch (\Exception $exception) {
369-
throw new ValidationException($filename . "\n");
369+
throw new ValidationException("XML Parse Error: $filename\n");
370370
}
371371
if ($this->schemaFile) {
372372
$errors = self::validateDomDocument($dom, $this->schemaFile, $this->errorFormat);

0 commit comments

Comments
 (0)