Created
January 3, 2023 13:46
-
-
Save Tjitse-E/a7a7400d77a17075c5778355a1943101 to your computer and use it in GitHub Desktop.
Update PHPUnit config from 6.2 to 9.5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$doc1 = new DOMDocument(); | |
$doc1->load('dev/tests/integration/phpunit.xml'); | |
$xmlToAdd = new DOMDocument(); | |
$xmlToAdd->loadXML('<coverage> | |
<exclude> | |
<directory suffix=".php">../../../app/code/Magento</directory> | |
<directory>../../../app/code/*/*/Test</directory> | |
<directory>../../../app/code/*/*/Setup</directory> | |
<directory suffix="registration.php">../../../app/code</directory> | |
</exclude> | |
<include> | |
<directory>../../../app/code</directory> | |
</include> | |
</coverage>'); | |
/** @var DOMElement $phpunit */ | |
$phpunit = $doc1->getElementsByTagName('phpunit')->item(0); | |
// Add code coverage section | |
$coverage = $xmlToAdd->getElementsByTagName('coverage')->item(0); | |
$copiedItem = $doc1->importNode($coverage, true); | |
$phpunit->appendChild($copiedItem); | |
// Remove filter section | |
$filterSection = $doc1->getElementsByTagName('filter')->item(0); | |
$phpunit->removeChild($filterSection); | |
// Attribute | |
$phpunit->removeAttribute('xsi:noNamespaceSchemaLocation'); | |
$phpunit->setAttribute('xsi:noNamespaceSchemaLocation', 'http://schema.phpunit.de/9.5/phpunit.xsd'); | |
$doc1->save('output.xml'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment