function FixtureManipulator::addDotGitFolder

Creates an empty .git folder after being provided a path.

File

core/modules/package_manager/tests/modules/fixture_manipulator/src/FixtureManipulator.php, line 385

Class

FixtureManipulator
Manipulates a test fixture using Composer commands.

Namespace

Drupal\fixture_manipulator

Code

public function addDotGitFolder(string $path) : self {
    if (!$this->committingChanges) {
        $this->queueManipulation('addDotGitFolder', func_get_args());
        return $this;
    }
    if (!is_dir($path)) {
        throw new \LogicException("No directory exists at {$path}.");
    }
    $fs = new SymfonyFileSystem();
    $git_directory_path = $path . "/.git";
    if (is_dir($git_directory_path)) {
        throw new \LogicException("A .git directory already exists at {$path}.");
    }
    $fs->mkdir($git_directory_path);
    return $this;
}

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