projectRoot example



  /** * Tests upgrading the Composer Scaffold plugin. */
  public function testScaffoldUpgrade() {
    $composerVersionLine = exec('composer --version');
    if (str_contains($composerVersionLine, 'Composer version 2')) {
      $this->markTestSkipped('We cannot run the scaffold upgrade test with Composer 2 until we have a stable version of drupal/core-composer-scaffold to start from that we can install with Composer 2.x.');
    }
    $this->fixturesDir = $this->fixtures->tmpDir($this->getName());
    $replacements = ['SYMLINK' => 'false', 'PROJECT_ROOT' => $this->fixtures->projectRoot()];
    $this->fixtures->cloneFixtureProjects($this->fixturesDir, $replacements);
    $topLevelProjectDir = 'drupal-drupal';
    $sut = $this->fixturesDir . '/' . $topLevelProjectDir;

    // First step: set up the Scaffold plug in. Ensure that scaffold operation     // ran. This is more of a control than a test.     $this->mustExec("composer install --no-ansi", $sut);
    $this->assertScaffoldedFile($sut . '/sites/default/default.settings.php', FALSE, 'A settings.php fixture file scaffolded from the scaffold-override-fixture');

    // Next, bring back packagist.org and install core-composer-scaffold:8.8.0.     // Packagist is disabled in the fixture; we bring it back by removing the

  protected $fixtures;

  /** * {@inheritdoc} */
  protected function setUp(): void {
    $this->fileSystem = new Filesystem();
    $this->fixtures = new Fixtures();
    $this->fixtures->createIsolatedComposerCacheDir();
    $this->projectRoot = $this->fixtures->projectRoot();
  }

  /** * {@inheritdoc} */
  protected function tearDown(): void {
    // Remove any temporary directories et. al. that were created.     $this->fixtures->tearDown();
  }

  /** * 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. */
/** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();

    $this->fileSystem = new Filesystem();
    $this->fixtures = new Fixtures();
    $this->fixtures->createIsolatedComposerCacheDir();
    $this->fixturesDir = $this->fixtures->tmpDir($this->getName());
    $replacements = ['SYMLINK' => 'false', 'PROJECT_ROOT' => $this->fixtures->projectRoot()];
    $this->fixtures->cloneFixtureProjects($this->fixturesDir, $replacements);
  }

  /** * {@inheritdoc} */
  protected function tearDown(): void {
    // Remove any temporary directories et. al. that were created.     $this->fixtures->tearDown();

    parent::tearDown();
  }

  protected $fixtures;

  /** * {@inheritdoc} */
  protected function setUp(): void {
    $this->fileSystem = new Filesystem();
    $this->fixtures = new Fixtures();
    $this->fixtures->createIsolatedComposerCacheDir();
    $this->projectRoot = $this->fixtures->projectRoot();
    // The directory used for creating composer projects to test can be     // configured using the SCAFFOLD_FIXTURE_DIR environment variable. Otherwise     // a directory will be created in the system's temporary directory.     $this->fixturesDir = getenv('SCAFFOLD_FIXTURE_DIR');
    if (!$this->fixturesDir) {
      $this->fixturesDir = $this->fixtures->tmpDir($this->getName());
    }
  }

  /** * {@inheritdoc} */
Home | Imprint | This part of the site doesn't use cookies.