function TemplateProjectTestBase::addRepository

Adds a path repository to the test site.

Parameters

string $name: An arbitrary name for the repository.

string $path: The path of the repository. Must exist in the file system.

string $working_directory: (optional) The Composer working directory. Defaults to 'project'.

3 calls to TemplateProjectTestBase::addRepository()
PackageInstallTest::testPackageInstall in core/modules/package_manager/tests/src/Build/PackageInstallTest.php
Tests installing packages in a stage directory.
PackageInstallTest::testSubModules in core/modules/package_manager/tests/src/Build/PackageInstallTest.php
Tests installing a Drupal submodule.
PackageUpdateTest::testPackageUpdate in core/modules/package_manager/tests/src/Build/PackageUpdateTest.php
Tests updating packages in a stage directory.

File

core/modules/package_manager/tests/src/Build/TemplateProjectTestBase.php, line 222

Class

TemplateProjectTestBase
Base class for tests which create a test site from a core project template.

Namespace

Drupal\Tests\package_manager\Build

Code

protected function addRepository(string $name, string $path, $working_directory = 'project') : void {
    $this->assertDirectoryExists($path);
    $repository = json_encode([
        'type' => 'path',
        'url' => $path,
        'options' => [
            'symlink' => FALSE,
        ],
    ], JSON_UNESCAPED_SLASHES);
    $this->runComposer("composer config repo.{$name} '{$repository}'", $working_directory);
}

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