function ComposerPatchesValidatorTest::testErrorDuringPreCreate
Tests that the patcher configuration is validated during pre-create.
Parameters
int $options: What aspects of the patcher are installed how.
\Drupal\package_manager\ValidationResult[] $expected_results: The expected validation results.
@dataProvider providerErrorDuringPreCreate
File
-
core/
modules/ package_manager/ tests/ src/ Kernel/ ComposerPatchesValidatorTest.php, line 76
Class
- ComposerPatchesValidatorTest
- @covers \Drupal\package_manager\Validator\ComposerPatchesValidator @group package_manager @internal
Namespace
Drupal\Tests\package_manager\KernelCode
public function testErrorDuringPreCreate(int $options, array $expected_results) : void {
$active_manipulator = new ActiveFixtureManipulator();
if ($options & static::CONFIG_ALLOWED_PLUGIN) {
$active_manipulator->addConfig([
'allow-plugins.cweagans/composer-patches' => TRUE,
]);
}
if ($options & static::EXTRA_EXIT_ON_PATCH_FAILURE) {
$active_manipulator->addConfig([
'extra.composer-exit-on-patch-failure' => TRUE,
]);
}
if ($options & static::REQUIRE_PACKAGE_FROM_ROOT) {
$active_manipulator->requirePackage('cweagans/composer-patches', '@dev');
}
elseif ($options & static::REQUIRE_PACKAGE_INDIRECTLY) {
$active_manipulator->addPackage([
'type' => 'package',
'name' => 'dummy/depends-on-composer-patches',
'description' => 'A dummy package depending on cweagans/composer-patches',
'version' => '1.0.0',
'require' => [
'cweagans/composer-patches' => '*',
],
]);
}
if ($options !== static::ABSENT) {
$active_manipulator->commitChanges();
}
$this->assertStatusCheckResults($expected_results);
$this->assertResults($expected_results, PreCreateEvent::class);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.