function ScaffoldUpgradeTest::createTmpRepo

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ScaffoldUpgradeTest.php \Drupal\Tests\Composer\Plugin\Scaffold\Functional\ScaffoldUpgradeTest::createTmpRepo()
  2. 8.9.x core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ScaffoldUpgradeTest.php \Drupal\Tests\Composer\Plugin\Scaffold\Functional\ScaffoldUpgradeTest::createTmpRepo()
  3. 11.x 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 119

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;
}

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