17 use RecursiveArrayIterator;
18 use RecursiveIteratorIterator;
29 private $testNameToSize = [];
43 private $parallelGroupSorter;
60 $this->dirPath = dirname($testPath) . DIRECTORY_SEPARATOR .
'groups';
73 $this->testNameToSize[$testObject->getCodeceptionName()] = $testObject->getEstimatedDuration();
85 $this->testGroups = $this->parallelGroupSorter->getTestsGroupedBySize(
86 $this->getSuiteConfig(),
87 $this->testNameToSize,
91 $this->suiteConfiguration = $this->parallelGroupSorter->getResultingSuiteConfig();
102 $suites = $this->getFlattenedSuiteConfiguration($this->suiteConfiguration ?? []);
104 foreach ($this->testGroups as $groupNumber => $groupContents) {
105 $this->generateGroupFile($groupContents, $groupNumber, $suites);
116 return $this->parallelGroupSorter;
129 private function generateGroupFile($testGroup, $nodeNumber, $suites)
131 foreach ($testGroup as $entryName => $testValue) {
132 $fileResource =
fopen($this->dirPath . DIRECTORY_SEPARATOR .
"group{$nodeNumber}.txt",
'a');
135 if (array_key_exists($entryName, $suites)) {
136 $line =
"-g {$entryName}";
138 $line = $this->relativeDirPath . DIRECTORY_SEPARATOR . $entryName .
'.php';
140 fwrite($fileResource, $line . PHP_EOL);
141 fclose($fileResource);
152 private function getFlattenedSuiteConfiguration($multiDimensionalSuites)
155 foreach ($multiDimensionalSuites as $suiteName => $suiteContent) {
156 $value = array_values($suiteContent)[0];
158 $suites = array_merge($suites, $this->getFlattenedSuiteConfiguration($suiteContent));
162 $suites[$suiteName] = $suiteContent;
__construct($suiteConfiguration, $testPath)
static createGroupDir($fullPath)