function ComposerPluginsValidatorTest::providerSimpleInvalidCases
Generates simple invalid test cases.
Return value
\Generator
1 call to ComposerPluginsValidatorTest::providerSimpleInvalidCases()
- ComposerPluginsValidatorTest::providerComplexInvalidCases in core/
modules/ package_manager/ tests/ src/ Kernel/ ComposerPluginsValidatorTest.php - Generates complex invalid test cases based on the simple test cases.
File
-
core/
modules/ package_manager/ tests/ src/ Kernel/ ComposerPluginsValidatorTest.php, line 277
Class
- ComposerPluginsValidatorTest
- @covers \Drupal\package_manager\Validator\ComposerPluginsValidator @group package_manager @internal
Namespace
Drupal\Tests\package_manager\KernelCode
public static function providerSimpleInvalidCases() : \Generator {
(yield 'one UNsupported composer plugin — pretty package name' => [
[
'allow-plugins.not-cweagans/not-composer-patches' => TRUE,
],
[
[
'name' => 'not-cweagans/not-composer-patches',
'require' => [
'composer-plugin-api' => '*',
],
'extra' => [
'class' => 'AnyClass',
],
'version' => '6.1',
'type' => 'composer-plugin',
],
],
[
ValidationResult::createError([
new TranslatableMarkup('<code>not-cweagans/not-composer-patches</code>'),
], new TranslatableMarkup('An unsupported Composer plugin was detected.')),
],
]);
(yield 'one UNsupported composer plugin — normalized package name' => [
[
'allow-plugins.also-not-cweagans/also-not-composer-patches' => TRUE,
],
[
[
'name' => 'also-not-cweagans/also-not-composer-patches',
'version' => '20.1',
'type' => 'composer-plugin',
'require' => [
'composer-plugin-api' => '*',
],
'extra' => [
'class' => 'AnyClass',
],
],
],
[
ValidationResult::createError([
new TranslatableMarkup('<code>also-not-cweagans/also-not-composer-patches</code>'),
], new TranslatableMarkup('An unsupported Composer plugin was detected.')),
],
]);
(yield 'one supported composer plugin but incompatible version — newer version' => [
[
'allow-plugins.phpstan/extension-installer' => TRUE,
],
[
[
'name' => 'phpstan/extension-installer',
'version' => '20.1',
'type' => 'composer-plugin',
'require' => [
'composer-plugin-api' => '*',
],
'extra' => [
'class' => 'AnyClass',
],
],
],
[
ValidationResult::createError([
new TranslatableMarkup('<code>phpstan/extension-installer</code> is supported, but only version <code>^1.1</code>, found <code>20.1</code>.'),
], new TranslatableMarkup('An unsupported Composer plugin was detected.')),
],
]);
(yield 'one supported composer plugin but incompatible version — older version' => [
[
'allow-plugins.dealerdirect/phpcodesniffer-composer-installer' => TRUE,
],
[
[
'name' => 'dealerdirect/phpcodesniffer-composer-installer',
'version' => '0.6.1',
'type' => 'composer-plugin',
'require' => [
'composer-plugin-api' => '*',
],
'extra' => [
'class' => 'AnyClass',
],
],
],
[
ValidationResult::createError([
new TranslatableMarkup('<code>dealerdirect/phpcodesniffer-composer-installer</code> is supported, but only version <code>^0.7.1 || ^1.0.0</code>, found <code>0.6.1</code>.'),
], new TranslatableMarkup('An unsupported Composer plugin was detected.')),
],
]);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.