Skip to content
Snippets Groups Projects
Commit 46eb2833 authored by catch's avatar catch
Browse files

Issue #3421448 by mondrake: Make remaining BuildTest data providers, static

parent d5a12841
No related branches found
No related tags found
No related merge requests found
......@@ -25,13 +25,13 @@ class ComponentsIsolatedBuildTest extends ComposerBuildTestBase {
* @return array
* An array with relative paths to the component paths.
*/
public function provideComponentPaths(): array {
public static function provideComponentPaths(): array {
$data = [];
// During the dataProvider phase, there is not a workspace directory yet.
// So we will find relative paths and assemble them with the workspace
// path later.
$drupal_root = $this->getDrupalRoot();
$composer_json_finder = $this->getComponentPathsFinder($drupal_root);
$drupal_root = self::getDrupalRootStatic();
$composer_json_finder = self::getComponentPathsFinder($drupal_root);
/** @var \Symfony\Component\Finder\SplFileInfo $path */
foreach ($composer_json_finder->getIterator() as $path) {
......
......@@ -51,7 +51,7 @@ protected function assertDrupalVersion(string $expectedVersion, string $dir): vo
* @return \Symfony\Component\Finder\Finder
* A Finder object with all the composer.json files for components.
*/
protected function getComponentPathsFinder(string $drupal_root): Finder {
protected static function getComponentPathsFinder(string $drupal_root): Finder {
$finder = new Finder();
$finder->name('composer.json')
->in($drupal_root . static::$componentsPath)
......
......@@ -14,9 +14,9 @@ class ComposerValidateTest extends BuildTestBase {
use ComposerIntegrationTrait;
public function provideComposerJson() {
public static function provideComposerJson() {
$data = [];
$composer_json_finder = $this->getComposerJsonFinder($this->getDrupalRoot());
$composer_json_finder = self::getComposerJsonFinder(self::getDrupalRootStatic());
foreach ($composer_json_finder->getIterator() as $composer_json) {
$data[] = [$composer_json->getPathname()];
}
......
......@@ -600,6 +600,16 @@ public function getCodebaseFinder() {
* The full path to the root of this Drupal codebase.
*/
public function getDrupalRoot() {
return self::getDrupalRootStatic();
}
/**
* Get the root path of this Drupal codebase.
*
* @return string
* The full path to the root of this Drupal codebase.
*/
public static function getDrupalRootStatic() {
// Given this code is in the drupal/core package, $core cannot be NULL.
/** @var string $core */
$core = InstalledVersions::getInstallPath('drupal/core');
......
......@@ -20,7 +20,7 @@ trait ComposerIntegrationTrait {
* @return \Symfony\Component\Finder\Finder
* A Finder object able to iterate all the composer.json files in core.
*/
public function getComposerJsonFinder($drupal_root) {
public static function getComposerJsonFinder($drupal_root) {
$composer_json_finder = new Finder();
$composer_json_finder->name('composer.json')
->in([
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment