class ProcessFactory

Same name in this branch
  1. 11.x core/modules/package_manager/src/ProcessFactory.php \Drupal\package_manager\ProcessFactory

Process factory that always sets the COMPOSER_MIRROR_PATH_REPOS env variable.

This is necessary because the fake_site fixture is built from a Composer-type repository, which will normally try to symlink packages which are installed from local directories, which in turn will break Package Manager because it does not support symlinks pointing outside the main code base. The COMPOSER_MIRROR_PATH_REPOS environment variable forces Composer to mirror, rather than symlink, local directories when installing packages.

Hierarchy

Expanded class hierarchy of ProcessFactory

See also

\Drupal\fixture_manipulator\FixtureManipulator::setUpRepos()

File

core/modules/package_manager/tests/modules/fixture_manipulator/src/ProcessFactory.php, line 23

Namespace

Drupal\fixture_manipulator
View source
final class ProcessFactory implements ProcessFactoryInterface {
    
    /**
     * Constructs a ProcessFactory object.
     *
     * @param \PhpTuf\ComposerStager\API\Process\Factory\ProcessFactoryInterface $decorated
     *   The decorated process factory service.
     */
    public function __construct(ProcessFactoryInterface $decorated) {
    }
    
    /**
     * {@inheritdoc}
     */
    public function create(array $command, ?PathInterface $cwd = NULL, array $env = []) : ProcessInterface {
        $process = $this->decorated
            ->create($command, $cwd, $env);
        $env = $process->getEnv();
        $env['COMPOSER_MIRROR_PATH_REPOS'] = '1';
        $process->setEnv($env);
        return $process;
    }

}

Members

Title Sort descending Modifiers Object type Summary
ProcessFactory::create public function
ProcessFactory::__construct public function Constructs a ProcessFactory object.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.