diff --git a/drupalci.yml b/drupalci.yml index 093eebe8cf8bd25da3316e971ba54ca5a5023fcf..81ef61fd37db846975ec52ffdba220e4fd939cfc 100644 --- a/drupalci.yml +++ b/drupalci.yml @@ -47,28 +47,29 @@ build: # halt-on-fail can be set on the run_tests tasks in order to fail fast. # suppress-deprecations is false in order to be alerted to usages of # deprecated code. - run_tests.phpunit: - types: 'PHPUnit-Unit' - testgroups: '--all' - suppress-deprecations: false - halt-on-fail: false +# run_tests.phpunit: +# types: 'PHPUnit-Unit' +# testgroups: '--all' +# suppress-deprecations: false +# halt-on-fail: false run_tests.kernel: types: 'PHPUnit-Kernel' testgroups: '--all' suppress-deprecations: false - halt-on-fail: false - run_tests.build: - # Limit concurrency due to disk space concerns. - concurrency: 15 - types: 'PHPUnit-Build' - testgroups: '--all' - suppress-deprecations: false - halt-on-fail: false - run_tests.functional: - types: 'PHPUnit-Functional' - testgroups: '--all' - suppress-deprecations: false - halt-on-fail: false + halt-on-fail: falses + repeat: 100 +# run_tests.build: +# # Limit concurrency due to disk space concerns. +# concurrency: 15 +# types: 'PHPUnit-Build' +# testgroups: '--all' +# suppress-deprecations: false +# halt-on-fail: false +# run_tests.functional: +# types: 'PHPUnit-Functional' +# testgroups: '--all' +# suppress-deprecations: false +# halt-on-fail: false # Functional JavaScript tests require a concurrency of 1 because there is # only one instance of PhantomJS on the testbot machine. #run_tests.javascript: diff --git a/package_manager/package_manager.services.yml b/package_manager/package_manager.services.yml index 2b4c19f733f5340bf3cf0348da40be44154b1456..cf9e87c8b0954aed4eae208bb7ebe926404485d9 100644 --- a/package_manager/package_manager.services.yml +++ b/package_manager/package_manager.services.yml @@ -10,6 +10,9 @@ services: # Basic infrastructure services. package_manager.process_factory: class: Drupal\package_manager\ProcessFactory + arguments: + - '@file_system' + - '@config.factory' package_manager.file_system: class: PhpTuf\ComposerStager\Infrastructure\Filesystem\Filesystem arguments: diff --git a/package_manager/src/ProcessFactory.php b/package_manager/src/ProcessFactory.php index 6fc84dc9864e3e851e282a2baf32066f32d4a397..63d3d0d8eb29bc4e770dc12480c426e9e18c3a85 100644 --- a/package_manager/src/ProcessFactory.php +++ b/package_manager/src/ProcessFactory.php @@ -2,6 +2,8 @@ namespace Drupal\package_manager; +use Drupal\Core\Config\ConfigFactoryInterface; +use Drupal\Core\File\FileSystemInterface; use PhpTuf\ComposerStager\Infrastructure\Process\ProcessFactory as StagerProcessFactory; use PhpTuf\ComposerStager\Infrastructure\Process\ProcessFactoryInterface; use Symfony\Component\Process\Process; @@ -20,11 +22,32 @@ final class ProcessFactory implements ProcessFactoryInterface { */ private $decorated; + /** + * The file system service. + * + * @var \Drupal\Core\File\FileSystemInterface + */ + private $fileSystem; + + /** + * The config factory service. + * + * @var \Drupal\Core\Config\ConfigFactoryInterface + */ + private $configFactory; + /** * Constructs a ProcessFactory object. + * + * @param \Drupal\Core\File\FileSystemInterface $file_system + * The file system service. + * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory + * The config factory service. */ - public function __construct() { + public function __construct(FileSystemInterface $file_system, ConfigFactoryInterface $config_factory) { $this->decorated = new StagerProcessFactory(); + $this->fileSystem = $file_system; + $this->configFactory = $config_factory; } /** @@ -65,12 +88,11 @@ final class ProcessFactory implements ProcessFactoryInterface { * The path which should be used as COMPOSER_HOME. */ private function getComposerHomePath(): string { - /** @var \Drupal\Core\File\FileSystemInterface $file_system */ - $file_system = \Drupal::service('file_system'); - $home_path = $file_system->getTempDirectory() . '/automatic_updates_composer_home'; - if (!is_dir($home_path)) { - mkdir($home_path); - } + $home_path = $this->fileSystem->getTempDirectory(); + $home_path .= '/automatic_updates_composer_home-'; + $home_path .= $this->configFactory->get('system.site')->get('uuid'); + $this->fileSystem->prepareDirectory($home_path, FileSystemInterface::CREATE_DIRECTORY | FileSystemInterface::MODIFY_PERMISSIONS); + return $home_path; }