protected function ManageGitIgnoreTest::createSutWithGit in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ManageGitIgnoreTest.php \Drupal\Tests\Composer\Plugin\Scaffold\Functional\ManageGitIgnoreTest::createSutWithGit()
- 9 core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ManageGitIgnoreTest.php \Drupal\Tests\Composer\Plugin\Scaffold\Functional\ManageGitIgnoreTest::createSutWithGit()
Creates a system-under-test and initialize a git repository for it.
Parameters
string $fixture_name: The name of the fixture to use from core/tests/Drupal/Tests/Component/Scaffold/fixtures.
Return value
string The path to the fixture directory.
4 calls to ManageGitIgnoreTest::createSutWithGit()
- ManageGitIgnoreTest::testAppendToEmptySettingsIsUnmanaged in core/
tests/ Drupal/ Tests/ Composer/ Plugin/ Scaffold/ Functional/ ManageGitIgnoreTest.php - Tests appending to an unmanaged file, and confirm it is not .gitignored.
- ManageGitIgnoreTest::testManageGitIgnore in core/
tests/ Drupal/ Tests/ Composer/ Plugin/ Scaffold/ Functional/ ManageGitIgnoreTest.php - Tests scaffold command correctly manages the .gitignore file.
- ManageGitIgnoreTest::testUnmanagedGitIgnoreWhenDisabled in core/
tests/ Drupal/ Tests/ Composer/ Plugin/ Scaffold/ Functional/ ManageGitIgnoreTest.php - Tests scaffold command does not manage the .gitignore file when disabled.
- ManageGitIgnoreTest::testUnmanagedGitIgnoreWhenGitNotAvailable in core/
tests/ Drupal/ Tests/ Composer/ Plugin/ Scaffold/ Functional/ ManageGitIgnoreTest.php - Tests scaffold command disables .gitignore management when git not present.
File
- core/
tests/ Drupal/ Tests/ Composer/ Plugin/ Scaffold/ Functional/ ManageGitIgnoreTest.php, line 83
Class
- ManageGitIgnoreTest
- Tests to see whether .gitignore files are correctly managed.
Namespace
Drupal\Tests\Composer\Plugin\Scaffold\FunctionalCode
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.
$this->fixtures
->runComposer("install --no-ansi --no-scripts --no-plugins", $sut);
return $sut;
}