init
This commit is contained in:
@@ -0,0 +1,360 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
|
||||
// @codingStandardsIgnoreStart
|
||||
/**
|
||||
* Script to operate on a test suite defined in a phpunit configuration xml or xml.dist file; split the tests
|
||||
* in the suite into groups by required size; return total number of groups or generate phpunit_<index>.xml file
|
||||
* that defines a new test suite named group_<index> with tests in group <index>
|
||||
*
|
||||
* Common scenario:
|
||||
*
|
||||
* 1. Query how many groups in a test suite with a given size --group-size=<size>
|
||||
* php phpunitGroupConfig.php --get-total --configuration=<path-to-phpunit-xml-dist-file> --test-suite=<name> --group-size=<size> --isolate-tests=<path-to-isolate-tests-file>
|
||||
*
|
||||
* 2a. Generate the configuration file for group <index>. <index> must be in range of [1, total number of groups])
|
||||
* php phpunitGroupConfig.php --get-group=<index> --configuration=<path-to-phpunit-xml-dist-file> --test-suite=<name> --group-size=<size> --isolate-tests=<path-to-isolate-tests-file>
|
||||
*
|
||||
* 2b. Or generate configuration files for all test groups at once
|
||||
* php phpunitGroupConfig.php --get-group=all --configuration=<path-to-phpunit-xml-dist-file> --test-suite=<name> --group-size=<size> --isolate-tests=<path-to-isolate-tests-file>
|
||||
*
|
||||
* 3. PHPUnit command to run tests for group at <index>
|
||||
* phpunit --configuration <path_to_phpunit_<index>.xml> --testsuite group_<index>
|
||||
*/
|
||||
|
||||
$scriptName = basename(__FILE__);
|
||||
|
||||
define(
|
||||
'USAGE',
|
||||
<<<USAGE
|
||||
Usage:
|
||||
php -f $scriptName
|
||||
[--get-total]
|
||||
Option takes no value, when specified, script will return total number of groups for the test suite specified in --test-suite.
|
||||
It's the default if both --get-total and --get-group are specified or both --get-total and --get-group are not specified.
|
||||
[--get-group="<positive integer>|all"]
|
||||
When option takes a positive integer value <i>, script will generate phpunit_<i>.xml file in the same location as the config
|
||||
file specified in --configuration with a test suite named "group_<i>" which contains the i-th group of tests from the test
|
||||
suite specified in --test-suite.
|
||||
When option takes value "all", script will generate config files for all groups at once.
|
||||
--test-suite="<name>"
|
||||
Name of test suite to be splitted into groups.
|
||||
--group-size="<positive integer>"
|
||||
Number of tests per group.
|
||||
--configuration="<path>"
|
||||
Path to phpunit configuration xml or xml.dist file.
|
||||
[--isolate-tests="<path>"]
|
||||
Path to a text file containing tests that require group isolation. One test path per line.
|
||||
|
||||
Note:
|
||||
Script uses getopt() which does not accept " "(space) as a separator for optional values. Use "=" for [--get-group] and [--isolate-tests] instead.
|
||||
See https://www.php.net/manual/en/function.getopt.php
|
||||
|
||||
USAGE
|
||||
);
|
||||
// @codingStandardsIgnoreEnd
|
||||
|
||||
$options = getopt(
|
||||
'',
|
||||
[
|
||||
'get-total',
|
||||
'get-group::',
|
||||
'test-suite:',
|
||||
'group-size:',
|
||||
'configuration:',
|
||||
'isolate-tests::'
|
||||
]
|
||||
);
|
||||
$requiredOpts = ['test-suite', 'group-size', 'configuration'];
|
||||
|
||||
try {
|
||||
foreach ($requiredOpts as $opt) {
|
||||
assertUsage(empty($options[$opt]), "Option --$opt: cannot be empty\n");
|
||||
}
|
||||
|
||||
assertUsage(!ctype_digit($options['group-size']), "Option --group-size: must be positive integer\n");
|
||||
assertUsage(!realpath($options['configuration']), "Option --configuration: file doesn't exist\n");
|
||||
assertUsage(
|
||||
isset($options['isolate-tests']) && !realpath($options['isolate-tests']),
|
||||
"Option --isolate-tests: file doesn't exist\n"
|
||||
);
|
||||
$isolateTests = isset($options['isolate-tests']) ? readIsolateTests(realpath($options['isolate-tests'])) : [];
|
||||
|
||||
$generateConfig = null;
|
||||
$groupIndex = null;
|
||||
if (isset($options['get-total']) || !isset($options['get-group'])) {
|
||||
$generateConfig = false;
|
||||
} else {
|
||||
assertUsage(
|
||||
(empty($options['get-group']) || !(is_string($options['get-group']) && ctype_digit($options['get-group'])))
|
||||
&& strtolower($options['get-group']) != 'all',
|
||||
"Option --get-group: must be a positive integer or 'all'\n"
|
||||
);
|
||||
$generateConfig = true;
|
||||
$groupIndex = strtolower($options['get-group']);
|
||||
}
|
||||
|
||||
$testSuite = $options['test-suite'];
|
||||
$groupSize = $options['group-size'];
|
||||
$configFile = realpath($options['configuration']);
|
||||
$workingDir = dirname($configFile) . DIRECTORY_SEPARATOR;
|
||||
|
||||
$savedCwd = getcwd();
|
||||
chdir($workingDir);
|
||||
$allTests = getTestList($configFile, $testSuite);
|
||||
chdir($savedCwd);
|
||||
list($allRegularTests, $isolateTests) = fuzzyArrayDiff($allTests, $isolateTests); // diff to separate isolated tests
|
||||
|
||||
$totalRegularTests = count($allRegularTests);
|
||||
if (($totalRegularTests % $groupSize) === 0) {
|
||||
$totalRegularGroups = $totalRegularTests / $groupSize;
|
||||
} else {
|
||||
$totalRegularGroups = (int)($totalRegularTests / $groupSize) + 1;
|
||||
}
|
||||
$totalGroups = $totalRegularGroups + count($isolateTests);
|
||||
assertUsage(
|
||||
$totalGroups == 0,
|
||||
"Option --test-suite: no test found for test suite '{$testSuite}'\n"
|
||||
);
|
||||
|
||||
if (!$generateConfig) {
|
||||
//phpcs:ignore Magento2.Security.LanguageConstruct
|
||||
print $totalGroups;
|
||||
//phpcs:ignore Magento2.Security.LanguageConstruct
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if ($groupIndex == 'all') {
|
||||
$sIndex = 1;
|
||||
$eIndex = $totalGroups;
|
||||
} else {
|
||||
assertUsage(
|
||||
(int)$groupIndex > $totalGroups,
|
||||
"Option --get-group: can not be greater than $totalGroups\n"
|
||||
);
|
||||
$sIndex = (int)$groupIndex;
|
||||
$eIndex = $sIndex;
|
||||
}
|
||||
|
||||
$successMsg = "PHPUnit configuration files created:\n";
|
||||
for ($index = $sIndex; $index < $eIndex + 1; $index++) {
|
||||
$groupTests = [];
|
||||
if ($index <= $totalRegularGroups) {
|
||||
$groupTests = array_chunk($allRegularTests, $groupSize)[$index - 1];
|
||||
} else {
|
||||
$groupTests[] = $isolateTests[$index - $totalRegularGroups - 1];
|
||||
}
|
||||
|
||||
$groupConfigFile = $workingDir . 'phpunit_' . $index . '.xml';
|
||||
createGroupConfig($configFile, $groupConfigFile, $groupTests, $index);
|
||||
$successMsg .= "{$groupConfigFile}, group: {$index}, test suite: group_{$index}\n";
|
||||
}
|
||||
//phpcs:ignore Magento2.Security.LanguageConstruct
|
||||
print $successMsg;
|
||||
|
||||
} catch (Exception $e) {
|
||||
//phpcs:ignore Magento2.Security.LanguageConstruct
|
||||
print $e->getMessage();
|
||||
//phpcs:ignore Magento2.Security.LanguageConstruct
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a phpunit configuration file for a given group
|
||||
*
|
||||
* @param string $in
|
||||
* @param string $out
|
||||
* @param array $group
|
||||
* @param integer $index
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
||||
*/
|
||||
function createGroupConfig($in, $out, $group, $index)
|
||||
{
|
||||
$beforeTestSuites = true;
|
||||
$afterTestSuites = false;
|
||||
$outLines = '';
|
||||
$inLines = explode("\n", file_get_contents($in));
|
||||
foreach ($inLines as $inLine) {
|
||||
if ($beforeTestSuites) {
|
||||
// Replacing existing <testsuites> node with new <testsuites> node
|
||||
preg_match('/<testsuites/', $inLine, $bMatch);
|
||||
if (isset($bMatch[0])) {
|
||||
$beforeTestSuites = false;
|
||||
$outLines .= getFormattedGroup($group, $index);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (!$afterTestSuites) {
|
||||
preg_match('/<\/\s*testsuites/', $inLine, $aMatch);
|
||||
if (isset($aMatch[0])) {
|
||||
$afterTestSuites = true;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ($beforeTestSuites) {
|
||||
// Adding new <testsuites> node right before </phpunit> if there is no existing <testsuites> node
|
||||
preg_match('/<\/\s*phpunit/', $inLine, $lMatch);
|
||||
if (isset($lMatch[0])) {
|
||||
$outLines .= getFormattedGroup($group, $index);
|
||||
$outLines .= $inLine . "\n";
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($beforeTestSuites || $afterTestSuites) {
|
||||
$outLines .= $inLine . "\n";
|
||||
}
|
||||
}
|
||||
file_put_contents($out, $outLines);
|
||||
}
|
||||
|
||||
/**
|
||||
* Format tests in an array into <testsuite> node defined by phpunit xml schema
|
||||
*
|
||||
* @param array $group
|
||||
* @param integer $index
|
||||
* @return string
|
||||
*/
|
||||
function getFormattedGroup($group, $index)
|
||||
{
|
||||
$output = "\t<testsuites>\n";
|
||||
$output .= "\t\t<testsuite name=\"group_{$index}\">\n";
|
||||
foreach ($group as $ch) {
|
||||
$output .= "\t\t\t<file>{$ch}</file>\n";
|
||||
}
|
||||
$output .= "\t\t</testsuite>\n";
|
||||
$output .= "\t</testsuites>\n";
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return paths for all tests as an array for a given test suite in a phpunit.xml(.dist) file
|
||||
*
|
||||
* @param string $configFile
|
||||
* @param string $suiteName
|
||||
*
|
||||
* @return array
|
||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
||||
* @SuppressWarnings(PHPMD.NPathComplexity)
|
||||
* @phpcs:disable Generic.Metrics.NestingLevel
|
||||
* @phpcs:disable Generic.Metrics.CyclomaticComplexity
|
||||
*/
|
||||
function getTestList($configFile, $suiteName)
|
||||
{
|
||||
$testCases = [];
|
||||
$config = simplexml_load_file($configFile);
|
||||
foreach ($config->xpath('//testsuite') as $testsuite) {
|
||||
if (strtolower((string)$testsuite['name']) != strtolower($suiteName)) {
|
||||
continue;
|
||||
}
|
||||
foreach ($testsuite->file as $file) {
|
||||
$testCases[(string)$file] = true;
|
||||
}
|
||||
$excludeFiles = [];
|
||||
foreach ($testsuite->exclude as $excludeFile) {
|
||||
$excludeFiles[] = (string)$excludeFile;
|
||||
}
|
||||
foreach ($testsuite->directory as $directoryPattern) {
|
||||
foreach (glob($directoryPattern, GLOB_ONLYDIR) as $directory) {
|
||||
if (!file_exists((string)$directory)) {
|
||||
continue;
|
||||
}
|
||||
$suffix = isset($directory['suffix']) ? (string)$directory['suffix'] : 'Test.php';
|
||||
$fileIterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator((string)$directory));
|
||||
foreach ($fileIterator as $fileInfo) {
|
||||
$pathToTestCase = (string)$fileInfo;
|
||||
if (substr_compare($pathToTestCase, $suffix, -strlen($suffix)) === 0
|
||||
&& !isTestClassAbstract($pathToTestCase)
|
||||
) {
|
||||
$inExclude = false;
|
||||
foreach ($excludeFiles as $excludeFile) {
|
||||
if (strpos($pathToTestCase, $excludeFile) !== false) {
|
||||
$inExclude = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!$inExclude) {
|
||||
$testCases[$pathToTestCase] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$testCases = array_keys($testCases); // automatically avoid file duplications
|
||||
sort($testCases);
|
||||
return $testCases;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if a file contains an abstract class
|
||||
*
|
||||
* @param string $testClassPath
|
||||
* @return bool
|
||||
*/
|
||||
function isTestClassAbstract($testClassPath)
|
||||
{
|
||||
return strpos(file_get_contents($testClassPath), "\nabstract class") !== false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return isolation tests as an array by reading from a file
|
||||
*
|
||||
* @param string $file
|
||||
* @return array
|
||||
*/
|
||||
function readIsolateTests($file)
|
||||
{
|
||||
$tests = [];
|
||||
$lines = explode("\n", file_get_contents($file));
|
||||
foreach ($lines as $line) {
|
||||
if (!empty(trim($line)) && substr_compare(trim($line), '#', 0, 1) !== 0) {
|
||||
$tests[] = trim($line);
|
||||
}
|
||||
}
|
||||
return $tests;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array diff based on partial match
|
||||
*
|
||||
* @param array $oArray
|
||||
* @param array $dArray
|
||||
* @return array
|
||||
*/
|
||||
function fuzzyArrayDiff($oArray, $dArray)
|
||||
{
|
||||
$ret1 = [];
|
||||
$ret2 = [];
|
||||
foreach ($oArray as $obj) {
|
||||
$ret1[] = $obj;
|
||||
foreach ($dArray as $diff) {
|
||||
if (stripos($obj, $diff) !== false) {
|
||||
$ret2[] = $obj;
|
||||
array_pop($ret1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return [$ret1, $ret2];
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert usage by throwing exception on condition evaluating to true
|
||||
*
|
||||
* @param bool $condition
|
||||
* @param string $error
|
||||
* @throws Exception
|
||||
*/
|
||||
function assertUsage($condition, $error)
|
||||
{
|
||||
if ($condition) {
|
||||
$error .= "\n" . USAGE;
|
||||
throw new Exception($error);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,246 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
use Magento\Framework\Component\ComponentRegistrar;
|
||||
|
||||
require_once __DIR__ . '/../../../app/autoload.php';
|
||||
|
||||
$scriptName = basename(__FILE__);
|
||||
|
||||
define(
|
||||
'USAGE',
|
||||
<<<USAGE
|
||||
Usage:
|
||||
php -f $scriptName path_to_phpunit.xml(.dist) rest|soap|graphql|integration
|
||||
USAGE
|
||||
);
|
||||
|
||||
try {
|
||||
assertUsage(empty($argv[1]) || !file_exists($argv[1]), 'Invalid $argv[1]: must be a phpunit.xml(.dist) file');
|
||||
$xmlDom = new DOMDocument();
|
||||
$xmlDom->preserveWhiteSpace = true;
|
||||
$xmlDom->formatOutput = true;
|
||||
assertUsage($xmlDom->load($argv[1]) == false, 'Invalid $argv[1]: must be a phpunit.xml(.dist) file');
|
||||
$testType = !empty($argv[2]) ? getTestType($argv[2]) : null;
|
||||
assertUsage(empty($testType), 'Invalid $argv[2]: must be a value from "rest", "soap", "graphql" or "integration"');
|
||||
|
||||
// This flag allows the user to skip generating default test suite directory in result <testsuite> node.
|
||||
// This is desired for internal api-functional builds.
|
||||
$skipDefaultDir = !empty($argv[3]);
|
||||
|
||||
// Update testsuite based on magento installation
|
||||
$xmlDom = updateTestSuite($xmlDom, $testType);
|
||||
$xmlDom->save($argv[1]);
|
||||
//phpcs:ignore Magento2.Security.LanguageConstruct
|
||||
print("{$testType} " . basename($argv[1]) . " is updated.");
|
||||
//phpcs:ignore Magento2.Security.LanguageConstruct
|
||||
} catch (Exception $e) {
|
||||
//phpcs:ignore Magento2.Security.LanguageConstruct
|
||||
print($e->getMessage());
|
||||
//phpcs:ignore Magento2.Security.LanguageConstruct
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse input string to get test type.
|
||||
*
|
||||
* @param String $arg
|
||||
* @return string
|
||||
*/
|
||||
function getTestType(String $arg): string
|
||||
{
|
||||
$testType = null;
|
||||
switch (strtolower(trim($arg))) {
|
||||
case 'rest':
|
||||
$testType = 'REST';
|
||||
break;
|
||||
case 'soap':
|
||||
$testType = 'SOAP';
|
||||
break;
|
||||
case 'graphql':
|
||||
$testType = 'GraphQl';
|
||||
break;
|
||||
case 'integration':
|
||||
$testType = 'Integration';
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return $testType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find magento modules directories patterns through magento ComponentRegistrar.
|
||||
*
|
||||
* @param string $testType
|
||||
* @return array
|
||||
*/
|
||||
function findMagentoModuleDirs(string $testType): array
|
||||
{
|
||||
$patterns = [
|
||||
'Integration' => 'Integration',
|
||||
'REST' => 'Api',
|
||||
'SOAP' => 'Api',
|
||||
'GraphQl' => 'GraphQl'
|
||||
];
|
||||
$magentoBaseDir = realpath(__DIR__ . '/../../..') . DIRECTORY_SEPARATOR;
|
||||
$magentoBaseDirPattern = preg_quote($magentoBaseDir, '/');
|
||||
$componentRegistrar = new ComponentRegistrar();
|
||||
$modulePaths = $componentRegistrar->getPaths(ComponentRegistrar::MODULE);
|
||||
$directoryPatterns = [];
|
||||
$excludePatterns = [];
|
||||
foreach ($modulePaths as $modulePath) {
|
||||
preg_match('~' . $magentoBaseDirPattern . '(.+)\/[^\/]+~', $modulePath, $match);
|
||||
if (isset($match[1]) && isset($patterns[$testType])) {
|
||||
$directoryPatterns[] = '../../../' . $match[1] . '/*/Test/' . $patterns[$testType];
|
||||
if ($testType == 'GraphQl') {
|
||||
$directoryPatterns[] = '../../../' . $match[1] . '/*GraphQl/Test/Api';
|
||||
$directoryPatterns[] = '../../../' . $match[1] . '/*graph-ql/Test/Api';
|
||||
} elseif ($testType == 'REST' || $testType == 'SOAP') {
|
||||
$excludePatterns[] = '../../../' . $match[1] . '/*/Test/' . $patterns['GraphQl'];
|
||||
$excludePatterns[] = '../../../' . $match[1] . '/*GraphQl/Test/Api';
|
||||
$excludePatterns[] = '../../../' . $match[1] . '/*graph-ql/Test/Api';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
'directory' => array_unique($directoryPatterns),
|
||||
'exclude' => array_unique($excludePatterns)
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new testsuite DOMDocument based on installed magento module directories.
|
||||
*
|
||||
* @param string $testType
|
||||
* @param string $attribute
|
||||
* @param array $excludes
|
||||
* @return DOMDocument
|
||||
* @throws DOMException
|
||||
*/
|
||||
function createNewDomElement(string $testType, string $attribute, array $excludes): DOMDocument
|
||||
{
|
||||
$defTestSuite = getDefaultSuites($testType);
|
||||
|
||||
// Create the new element
|
||||
$newTestSuite = new DomDocument();
|
||||
$newTestSuite->formatOutput = true;
|
||||
$newTestSuiteElement = $newTestSuite->createElement('testsuite');
|
||||
$newTestSuiteElement->setAttribute('name', $attribute);
|
||||
foreach ($defTestSuite['directory'] as $directory) {
|
||||
$newTestSuiteElement->appendChild($newTestSuite->createElement('directory', $directory));
|
||||
}
|
||||
|
||||
$moduleDirs = findMagentoModuleDirs($testType);
|
||||
foreach ($moduleDirs['directory'] as $directory) {
|
||||
$newTestSuiteElement->appendChild($newTestSuite->createElement('directory', $directory));
|
||||
}
|
||||
foreach ($defTestSuite['exclude'] as $defExclude) {
|
||||
$newTestSuiteElement->appendChild($newTestSuite->createElement('exclude', $defExclude));
|
||||
}
|
||||
foreach ($moduleDirs['exclude'] as $modExclude) {
|
||||
$newTestSuiteElement->appendChild($newTestSuite->createElement('exclude', $modExclude));
|
||||
}
|
||||
foreach ($excludes as $exclude) {
|
||||
$newTestSuiteElement->appendChild($newTestSuite->createElement('exclude', $exclude));
|
||||
}
|
||||
$newTestSuite->appendChild($newTestSuiteElement);
|
||||
return $newTestSuite;
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace testsuite node with created new testsuite node in dom document passed in.
|
||||
*
|
||||
* @param DOMDocument $dom
|
||||
* @param string $testType
|
||||
* @return DOMDocument
|
||||
* @throws DOMException
|
||||
*/
|
||||
function updateTestSuite(DOMDocument $dom, string $testType): DOMDocument
|
||||
{
|
||||
// Locate the old node
|
||||
$xpath = new DOMXpath($dom);
|
||||
$nodelist = $xpath->query('/phpunit/testsuites/testsuite');
|
||||
/** @var DOMNode $node */
|
||||
foreach ($nodelist as $node) {
|
||||
$attribute = $node->getAttribute('name');
|
||||
if (stripos($attribute, 'real') !== false) {
|
||||
$excludes = [];
|
||||
$excludeList = $node->getElementsByTagName('exclude');
|
||||
/** @var DOMNode $excludeNode */
|
||||
foreach ($excludeList as $excludeNode) {
|
||||
$excludes[] = $excludeNode->textContent;
|
||||
}
|
||||
// Load the $parent document fragment into the current document
|
||||
$newNode = $dom->importNode(
|
||||
createNewDomElement($testType, $attribute, $excludes)->documentElement,
|
||||
true
|
||||
);
|
||||
// Replace
|
||||
$node->parentNode->replaceChild($newNode, $node);
|
||||
}
|
||||
}
|
||||
return $dom;
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert usage by throwing exception on condition evaluating to true
|
||||
*
|
||||
* @param bool $condition
|
||||
* @param string $error
|
||||
* @throws Exception
|
||||
*/
|
||||
function assertUsage(bool $condition, string $error): void
|
||||
{
|
||||
if ($condition) {
|
||||
$error .= "\n" . USAGE;
|
||||
throw new Exception($error);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return suite default directories and excludes for a given test type.
|
||||
*
|
||||
* @param string $testType
|
||||
* @return array
|
||||
*/
|
||||
function getDefaultSuites(string $testType): array
|
||||
{
|
||||
global $skipDefaultDir;
|
||||
|
||||
$suites = [];
|
||||
switch ($testType) {
|
||||
case 'Integration':
|
||||
$suites = [
|
||||
'directory' => [
|
||||
'testsuite'
|
||||
],
|
||||
'exclude' => [
|
||||
'testsuite/Magento/MemoryUsageTest.php',
|
||||
'testsuite/Magento/IntegrationTest.php'
|
||||
]
|
||||
];
|
||||
break;
|
||||
case 'REST':
|
||||
case 'SOAP':
|
||||
$suites = [
|
||||
'directory' => $skipDefaultDir ? [] : ['testsuite'],
|
||||
'exclude' => [
|
||||
'testsuite/Magento/GraphQl'
|
||||
]
|
||||
];
|
||||
break;
|
||||
case 'GraphQl':
|
||||
$suites = [
|
||||
'directory' => $skipDefaultDir ? [] : ['testsuite/Magento/GraphQl'],
|
||||
'exclude' => [
|
||||
]
|
||||
];
|
||||
}
|
||||
return $suites;
|
||||
}
|
||||
Reference in New Issue
Block a user