function LegacyScriptsTest::getPathReposForType

Get Composer items that we want to be path repos, from within a directory.

Parameters

string $workspace_directory: The full path to the workspace directory.

string $subdir: The subdirectory to search under composer/.

Return value

string[] Array of paths, indexed by package name.

1 call to LegacyScriptsTest::getPathReposForType()
LegacyScriptsTest::testVendorTestCodeCleanup in core/tests/Drupal/BuildTests/Composer/LegacyScriptsTest.php
@covers ::vendorTestCodeCleanup

File

core/tests/Drupal/BuildTests/Composer/LegacyScriptsTest.php, line 77

Class

LegacyScriptsTest
@group Composer @group legacy @requires externalCommand composer @coversDefaultClass \Drupal\Core\Composer\Composer

Namespace

Drupal\BuildTests\Composer

Code

public function getPathReposForType($workspace_directory, $subdir) {
    // Find the Composer items that we want to be path repos.
    
    /** @var \SplFileInfo[] $path_repos */
    $path_repos = Composer::composerSubprojectPaths($workspace_directory, $subdir);
    $data = [];
    foreach ($path_repos as $path_repo) {
        $json_file = new JsonFile($path_repo->getPathname());
        $json = $json_file->read();
        $data[$json['name']] = $path_repo->getPath();
    }
    return $data;
}

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