Skip to content
Snippets Groups Projects
Commit 849277cb authored by Ted Bowman's avatar Ted Bowman Committed by Adam G-H
Browse files

Issue #3409774 by phenaproxima, tedbow: Run kernel tests on GitLab CI after...

Issue #3409774 by phenaproxima, tedbow: Run kernel tests on GitLab CI after module is converted to core version
parent 04b61080
No related branches found
No related tags found
1 merge request!1003Resolve #3409774 "Kernel tests"
Pipeline #66420 passed
......@@ -134,7 +134,9 @@ phpunit:
- package_manager
TEST_TYPE:
- PHPUnit-Unit
- PHPUnit-Kernel
variables:
COMPOSER_HOME: '$CI_PROJECT_DIR/.composer'
_PHPUNIT_CONCURRENT: '1'
_PHPUNIT_EXTRA: '--types $TEST_TYPE --module $MODULE'
_PHPUNIT_TESTGROUPS: '--verbose'
......
......@@ -20,7 +20,12 @@
"bar": 134,
"foo-bar": null
},
"baz": null
"baz": null,
"installer-paths": {
"modules/contrib/{$name}": ["type:drupal-module"],
"profiles/contrib/{$name}": ["type:drupal-profile"],
"themes/contrib/{$name}": ["type:drupal-theme"]
}
},
"repositories": {
"fake-packages": {
......
......@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "0235f8f2d3ef91d87864b76e12838e89",
"content-hash": "17cd7e695939dc97e22d10fa4efbe10b",
"packages": [
{
"name": "drupal/core",
......
......@@ -138,7 +138,7 @@ class FixtureManipulator {
$fs->mkdir($file_dir);
}
}
file_put_contents("$repo_path/$file_name", $file_contents);
assert(file_put_contents("$repo_path/$file_name", $file_contents) !== FALSE);
}
}
return $this->requirePackage($package['name'], $package['version'], $is_dev_requirement, $allow_plugins);
......@@ -277,7 +277,7 @@ class FixtureManipulator {
if ($file_name === NULL) {
$file_name = "$project_name.info.yml";
}
file_put_contents("$path/$file_name", Yaml::encode(['project' => $project_name]));
assert(file_put_contents("$path/$file_name", Yaml::encode(['project' => $project_name])) !== FALSE);
return $this;
}
......@@ -586,7 +586,7 @@ class FixtureManipulator {
'url' => $repo_path,
];
$packages_data['packages'][$name][$version] = $package;
file_put_contents($packages_json, json_encode($packages_data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
assert(file_put_contents($packages_json, json_encode($packages_data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)) !== FALSE);
return $repo_path;
}
......@@ -607,7 +607,7 @@ class FixtureManipulator {
// Update all the repos in the composer.json file to point to the new
// repos at the absolute path.
$composer_json = file_get_contents($this->dir . '/packages.json');
file_put_contents($this->dir . '/packages.json', str_replace('../path_repos/', "$path_repo_base/", $composer_json));
assert(file_put_contents($this->dir . '/packages.json', str_replace('../path_repos/', "$path_repo_base/", $composer_json)) !== FALSE);
$this->runComposerCommand(['update', '--lock']);
$this->runComposerCommand(['install']);
}
......
......@@ -51,6 +51,11 @@ class ComposerInspectorTest extends PackageManagerKernelTestBase {
"foo-bar" => NULL,
],
'baz' => NULL,
'installer-paths' => [
'modules/contrib/{$name}' => ['type:drupal-module'],
'profiles/contrib/{$name}' => ['type:drupal-profile'],
'themes/contrib/{$name}' => ['type:drupal-theme'],
],
], Json::decode($inspector->getConfig('extra', $dir)));
try {
......
......@@ -61,14 +61,14 @@ trait ComposerInstallersTrait {
* The fixture directory.
*/
private function setInstallerPaths(array $installer_paths, string $directory):void {
// Ensure Drupal core's default installer paths are also respected.
// Respect any existing installer paths.
$extra = $this->container->get(ComposerInspector::class)
->getConfig('extra', $this->getDrupalRoot() . '/composer.json');
$core_project_installer_paths = json_decode($extra, TRUE, flags: JSON_THROW_ON_ERROR)['installer-paths'];
->getConfig('extra', $directory . '/composer.json');
$existing_installer_paths = json_decode($extra, TRUE, flags: JSON_THROW_ON_ERROR)['installer-paths'] ?? [];
(new FixtureManipulator())
->addConfig([
'extra.installer-paths' => $installer_paths + $core_project_installer_paths,
'extra.installer-paths' => $installer_paths + $existing_installer_paths,
])
->commitChanges($directory);
}
......
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