Skip to content

Commit 9e42a4c

Browse files
committed
ACQE-5171: Implement a script to update Integration or WebAPI phpunit.xml file to support tests under vendor directory
1 parent fc543db commit 9e42a4c

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

dev/tests/utils/update-test-paths.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@
2626
$testType = getTestType($xmlDom);
2727
// Update testsuite based on magento installation
2828
$xmlDom = updateTestSuite($xmlDom, $testType);
29-
//$xmlDom->save($argv[1]); //Uncomment after review
30-
$xmlDom->save($argv[1] . '.new');
29+
$xmlDom->save($argv[1]);
3130
echo "{$testType} " . basename($argv[1]) . " is updated.";
3231

3332
/**
@@ -40,7 +39,6 @@ function getTestType(DOMDocument $dom): string
4039
{
4140
$testType = null;
4241
/** @var DOMElement $testsuite */
43-
//$testsuite = null;
4442
foreach ($dom->getElementsByTagName('testsuite') as $testsuite) {
4543
if (stripos($testsuite->getAttribute('name'), 'real suite') === false) {
4644
continue;
@@ -76,7 +74,7 @@ function findMagentoModuleDirs(string $testType): array
7674
'Integration' => 'Integration',
7775
'REST' => 'Api',
7876
'SOAP' => 'Api',
79-
// Is there a path pattern for 'GraphQL'?
77+
'GraphQL' => 'GraphQl'
8078
];
8179
$magentoBaseDir = realpath(__DIR__ . '/../../..') . DIRECTORY_SEPARATOR;
8280
$magentoBaseDirPattern = preg_quote($magentoBaseDir, '/');
@@ -140,7 +138,7 @@ function updateTestSuite(DOMDocument $dom, string $testType): DOMDocument
140138
// Locate the old node
141139
$xpath = new DOMXpath($dom);
142140
$nodelist = $xpath->query('/phpunit/testsuites/testsuite');
143-
for ( $index = 0; $index < $nodelist->count(); $index++) {
141+
for ($index = 0; $index < $nodelist->count(); $index++) {
144142
$oldNode = $nodelist->item($index);
145143
if (stripos($oldNode->getAttribute('name'), 'real suite') !== false) {
146144
// Load the $parent document fragment into the current document

0 commit comments

Comments
 (0)