/**
* Creates a system-under-test and initialize a git repository for it.
*
* @param string $fixture_name
* The name of the fixture to use from
* core/tests/Drupal/Tests/Component/Scaffold/fixtures.
*
* @return string
* The path to the fixture directory.
*/
protected function createSutWithGit($fixture_name) { $this->fixturesDir =
$this->fixtures->
tmpDir($this->
getName());
$sut =
$this->fixturesDir . '/' .
$fixture_name;
$replacements =
['SYMLINK' => 'false', 'PROJECT_ROOT' =>
$this->projectRoot
];
$this->fixtures->
cloneFixtureProjects($this->fixturesDir,
$replacements);
// .gitignore files will not be managed unless there is a git repository.
$this->
mustExec('git init',
$sut);
// Add some user info so git does not complain.
$this->
mustExec('git config user.email "test@example.com"',
$sut);
$this->
mustExec('git config user.name "Test User"',
$sut);
$this->
mustExec('git add .',
$sut);
$this->
mustExec('git commit -m "Initial commit."',
$sut);
// Run composer install, but suppress scaffolding.