function ComposerProjectTemplatesTest::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 ComposerProjectTemplatesTest::getPathReposForType()
ComposerProjectTemplatesTest::testTemplateCreateProject in core/tests/Drupal/BuildTests/Composer/Template/ComposerProjectTemplatesTest.php
@dataProvider provideTemplateCreateProject

File

core/tests/Drupal/BuildTests/Composer/Template/ComposerProjectTemplatesTest.php, line 56

Class

ComposerProjectTemplatesTest
Demonstrate that Composer project templates are buildable as patched.

Namespace

Drupal\BuildTests\Composer\Template

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.