You are here

public function ScaffoldTest::scaffoldSut in Drupal 8

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ScaffoldTest.php \Drupal\Tests\Composer\Plugin\Scaffold\Functional\ScaffoldTest::scaffoldSut()
  2. 10 core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ScaffoldTest.php \Drupal\Tests\Composer\Plugin\Scaffold\Functional\ScaffoldTest::scaffoldSut()

Creates the system-under-test and runs a scaffold operation on it.

Parameters

string $fixture_name: The name of the fixture to use from core/tests/Drupal/Tests/Component/Scaffold/fixtures.

bool $is_link: Whether to use symlinks for 'replace' operations.

bool $relocated_docroot: Whether the named fixture has a relocated document root.

6 calls to ScaffoldTest::scaffoldSut()
ScaffoldTest::testDrupalDrupalFileWasAppended in core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ScaffoldTest.php
Tests a fixture where the robots.txt file is prepended / appended to.
ScaffoldTest::testDrupalDrupalFileWasReplaced in core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ScaffoldTest.php
Asserts that the appropriate file was replaced.
ScaffoldTest::testEmptyProject in core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ScaffoldTest.php
Try to scaffold a project that does not scaffold anything.
ScaffoldTest::testProjectThatScaffoldsEmptyProject in core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ScaffoldTest.php
Try to scaffold a project that allows a project with no scaffold files.
ScaffoldTest::testScaffoldOverridingSettingsExcludingHtaccess in core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ScaffoldTest.php
Asserts that the drupal/assets scaffold files correct for sut.

... See full list

File

core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ScaffoldTest.php, line 113

Class

ScaffoldTest
Tests Composer Scaffold.

Namespace

Drupal\Tests\Composer\Plugin\Scaffold\Functional

Code

public function scaffoldSut($fixture_name, $is_link = FALSE, $relocated_docroot = TRUE) {
  $sut = $this
    ->createSut($fixture_name, [
    'SYMLINK' => $is_link ? 'true' : 'false',
  ]);

  // Run composer install to get the dependencies we need to test.
  $this->fixtures
    ->runComposer("install --no-ansi --no-scripts", $sut);

  // Test drupal:scaffold.
  $scaffoldOutput = $this->fixtures
    ->runScaffold($sut);

  // Calculate the docroot directory and assert that our fixture layout
  // matches what was stipulated in $relocated_docroot. Fail fast if
  // the caller provided the wrong value.
  $docroot = $sut;
  if ($relocated_docroot) {
    $docroot .= '/docroot';
    $this
      ->assertFileExists($docroot);
  }
  else {
    $this
      ->assertFileNotExists($sut . '/docroot');
  }
  return new ScaffoldTestResult($docroot, $scaffoldOutput);
}