removeTestModules.php 971 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. /**
  7. * @var $testFrameworkDir string - Must be defined in parent script.
  8. */
  9. /**
  10. * Copy test modules to app/code/Magento to make them visible for Magento instance.
  11. */
  12. $pathToCommittedTestModules = $testFrameworkDir . '/../_files/Magento';
  13. $pathToInstalledMagentoInstanceModules = $testFrameworkDir . '/../../../../app/code/Magento';
  14. $iterator = new RecursiveIteratorIterator(
  15. new RecursiveDirectoryIterator($pathToCommittedTestModules, RecursiveDirectoryIterator::FOLLOW_SYMLINKS)
  16. );
  17. //collect test modules dirs name
  18. $testModuleNames = array_diff(scandir($pathToCommittedTestModules), ['..', '.']);
  19. //remove test modules from magento codebase
  20. foreach ($testModuleNames as $name) {
  21. $folder = $pathToInstalledMagentoInstanceModules . '/' . $name;
  22. if (is_dir($folder)) {
  23. \Magento\Framework\Filesystem\Io\File::rmdirRecursive($folder);
  24. }
  25. }