function ScaffoldTest::assertAutoloadFileCorrect

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ScaffoldTest.php \Drupal\Tests\Composer\Plugin\Scaffold\Functional\ScaffoldTest::assertAutoloadFileCorrect()
  2. 8.9.x core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ScaffoldTest.php \Drupal\Tests\Composer\Plugin\Scaffold\Functional\ScaffoldTest::assertAutoloadFileCorrect()
  3. 11.x core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ScaffoldTest.php \Drupal\Tests\Composer\Plugin\Scaffold\Functional\ScaffoldTest::assertAutoloadFileCorrect()

Assert that the autoload file was scaffolded and contains correct path.

@internal

Parameters

string $docroot: Location of the doc root, where autoload.php should be written.

bool $relocated_docroot: Whether the document root is relocated or now.

4 calls to ScaffoldTest::assertAutoloadFileCorrect()
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::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.

File

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

Class

ScaffoldTest
Tests Composer Scaffold.

Namespace

Drupal\Tests\Composer\Plugin\Scaffold\Functional

Code

protected function assertAutoloadFileCorrect(string $docroot, bool $relocated_docroot = FALSE) : void {
    $autoload_path = $docroot . '/autoload.php';
    // Ensure that the autoload.php file was written.
    $this->assertFileExists($autoload_path);
    $contents = file_get_contents($autoload_path);
    $expected = "return require __DIR__ . '/vendor/autoload.php';";
    if ($relocated_docroot) {
        $expected = "return require __DIR__ . '/../vendor/autoload.php';";
    }
    $this->assertStringContainsString($expected, $contents);
}

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