|
15 | 15 | define('TESTS_TEMP_DIR', $testsBaseDir . '/tmp');
|
16 | 16 | }
|
17 | 17 |
|
| 18 | +/** Copy test modules to app/code/Magento to make them visible for Magento instance */ |
| 19 | +$pathToCommittedTestModules = __DIR__ . '/../_files/Magento'; |
| 20 | +$pathToInstalledMagentoInstanceModules = __DIR__ . '/../../../../app/code/Magento'; |
| 21 | +$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($pathToCommittedTestModules)); |
| 22 | +/** @var SplFileInfo $file */ |
| 23 | +foreach ($iterator as $file) { |
| 24 | + if (!$file->isDir()) { |
| 25 | + $source = $file->getPathname(); |
| 26 | + $relativePath = substr($source, strlen($pathToCommittedTestModules)); |
| 27 | + $destination = $pathToInstalledMagentoInstanceModules . $relativePath; |
| 28 | + $targetDir = dirname($destination); |
| 29 | + if (!is_dir($targetDir)) { |
| 30 | + mkdir($targetDir, 0755, true); |
| 31 | + } |
| 32 | + copy($source, $destination); |
| 33 | + } |
| 34 | +} |
| 35 | +unset($iterator, $file); |
| 36 | + |
| 37 | +// Register the modules under '_files/' |
| 38 | +$pathPattern = $pathToInstalledMagentoInstanceModules . '/TestModule*/registration.php'; |
| 39 | +$files = glob($pathPattern, GLOB_NOSORT); |
| 40 | +if ($files === false) { |
| 41 | + throw new \RuntimeException('glob() returned error while searching in \'' . $pathPattern . '\''); |
| 42 | +} |
| 43 | +foreach ($files as $file) { |
| 44 | + include $file; |
| 45 | +} |
| 46 | + |
18 | 47 | try {
|
19 | 48 | /* Bootstrap the application */
|
20 | 49 | $settings = new \Magento\TestFramework\Bootstrap\Settings($testsBaseDir, get_defined_constants());
|
|
0 commit comments