protected function ScaffoldTest::assertAutoloadFileCorrect in Drupal 9
Same name and namespace in other branches
- 8 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.
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 412
Class
- ScaffoldTest
- Tests Composer Scaffold.
Namespace
Drupal\Tests\Composer\Plugin\Scaffold\FunctionalCode
protected function assertAutoloadFileCorrect($docroot, $relocated_docroot = FALSE) {
$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);
}