You are here

protected function ScaffoldUpgradeTest::createTmpRepo in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ScaffoldUpgradeTest.php \Drupal\Tests\Composer\Plugin\Scaffold\Functional\ScaffoldUpgradeTest::createTmpRepo()

Copy the provided source directory and create a temporary git repository.

Parameters

string $source: Path to directory to copy.

string $destParent: Path to location to create git repository.

string $version: Version to tag the repository with.

Return value

string Path to temporary git repository.

1 call to ScaffoldUpgradeTest::createTmpRepo()
ScaffoldUpgradeTest::testScaffoldUpgrade in core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ScaffoldUpgradeTest.php
Tests upgrading the Composer Scaffold plugin.

File

core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ScaffoldUpgradeTest.php, line 108

Class

ScaffoldUpgradeTest
Tests Upgrading the Composer Scaffold plugin.

Namespace

Drupal\Tests\Composer\Plugin\Scaffold\Functional

Code

protected function createTmpRepo($source, $destParent, $version) {
  $target = $destParent . '/' . basename($source);
  $filesystem = new Filesystem();
  $filesystem
    ->copy($source, $target);
  $this
    ->mustExec("git init", $target);
  $this
    ->mustExec('git config user.email "scaffoldtest@example.com"', $target);
  $this
    ->mustExec('git config user.name "Scaffold Test"', $target);
  $this
    ->mustExec("git add .", $target);
  $this
    ->mustExec("git commit -m 'Initial commit'", $target);
  $this
    ->mustExec("git tag {$version}", $target);
  return $target;
}