function ComposerProjectTemplatesTest::getPathReposForType
Same name in other branches
- 9 core/tests/Drupal/BuildTests/Composer/Template/ComposerProjectTemplatesTest.php \Drupal\BuildTests\Composer\Template\ComposerProjectTemplatesTest::getPathReposForType()
- 10 core/tests/Drupal/BuildTests/Composer/Template/ComposerProjectTemplatesTest.php \Drupal\BuildTests\Composer\Template\ComposerProjectTemplatesTest::getPathReposForType()
- 11.x core/tests/Drupal/BuildTests/Composer/Template/ComposerProjectTemplatesTest.php \Drupal\BuildTests\Composer\Template\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 41
Class
- ComposerProjectTemplatesTest
- Demonstrate that Composer project templates are buildable as patched.
Namespace
Drupal\BuildTests\Composer\TemplateCode
public function getPathReposForType($workspace_directory, $subdir) {
// Find the Composer items that we want to be path repos.
$path_repos = Finder::create()->files()
->name('composer.json')
->in($workspace_directory . '/composer/' . $subdir);
$data = [];
/* @var $path_repo \SplFileInfo */
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.