Skip to content
Snippets Groups Projects
Unverified Commit 81f055eb authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3477329 by phenaproxima, thejimbirch, b_sharpe: Recipe validation...

Issue #3477329 by phenaproxima, thejimbirch, b_sharpe: Recipe validation should always treat required modules as installed
parent f9d14651
No related branches found
No related tags found
17 merge requests!11131[10.4.x-only-DO-NOT-MERGE]: Issue ##2842525 Ajax attached to Views exposed filter form does not trigger callbacks,!8736Update the Documention As per the Function uses.,!3878Removed unused condition head title for views,!3818Issue #2140179: $entity->original gets stale between updates,!3742Issue #3328429: Create item list field formatter for displaying ordered and unordered lists,!3731Claro: role=button on status report items,!3154Fixes #2987987 - CSRF token validation broken on routes with optional parameters.,!3133core/modules/system/css/components/hidden.module.css,!2964Issue #2865710 : Dependencies from only one instance of a widget are used in display modes,!2812Issue #3312049: [Followup] Fix Drupal.Commenting.FunctionComment.MissingReturnType returns for NULL,!2062Issue #3246454: Add weekly granularity to views date sort,!10223132456: Fix issue where views instances are emptied before an ajax request is complete,!877Issue #2708101: Default value for link text is not saved,!617Issue #3043725: Provide a Entity Handler for user cancelation,!579Issue #2230909: Simple decimals fail to pass validation,!560Move callback classRemove outside of the loop,!555Issue #3202493
Pipeline #304131 passed with warnings
Pipeline: drupal

#304166

    Pipeline: drupal

    #304153

      Pipeline: drupal

      #304138

        ...@@ -383,14 +383,23 @@ private static function validateConfigActions(mixed $value, ExecutionContextInte ...@@ -383,14 +383,23 @@ private static function validateConfigActions(mixed $value, ExecutionContextInte
        $configurator = new RecipeConfigurator($recipe_being_validated['recipes'] ?? [], $include_path); $configurator = new RecipeConfigurator($recipe_being_validated['recipes'] ?? [], $include_path);
        /** @var \Drupal\Core\Extension\ModuleExtensionList $module_list */
        $module_list = \Drupal::service('extension.list.module');
        // The config provider must either be an already-installed module or theme, // The config provider must either be an already-installed module or theme,
        // or an extension being installed by this recipe or a recipe it depends on. // or an extension being installed by this recipe or a recipe it depends on.
        $all_extensions = [ $all_extensions = [
        ...array_keys(\Drupal::service('extension.list.module')->getAllInstalledInfo()), ...array_keys($module_list->getAllInstalledInfo()),
        ...array_keys(\Drupal::service('extension.list.theme')->getAllInstalledInfo()), ...array_keys(\Drupal::service('extension.list.theme')->getAllInstalledInfo()),
        ...$recipe_being_validated['install'] ?? [], ...$recipe_being_validated['install'] ?? [],
        ...$configurator->listAllExtensions(), ...$configurator->listAllExtensions(),
        ]; ];
        // Explicitly treat required modules as installed, even if Drupal isn't
        // installed yet, because we know they WILL be installed.
        foreach ($module_list->getAllAvailableInfo() as $name => $info) {
        if (!empty($info['required'])) {
        $all_extensions[] = $name;
        }
        }
        if (!in_array($config_provider, $all_extensions, TRUE)) { if (!in_array($config_provider, $all_extensions, TRUE)) {
        $context->addViolation('Config actions cannot be applied to %config_name because the %config_provider extension is not installed, and is not installed by this recipe or any of the recipes it depends on.', [ $context->addViolation('Config actions cannot be applied to %config_name because the %config_provider extension is not installed, and is not installed by this recipe or any of the recipes it depends on.', [
        ......
        ...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
        use Drupal\Core\Recipe\RecipeFileException; use Drupal\Core\Recipe\RecipeFileException;
        use Drupal\Core\Recipe\RecipePreExistingConfigException; use Drupal\Core\Recipe\RecipePreExistingConfigException;
        use Drupal\Core\Recipe\RecipeRunner; use Drupal\Core\Recipe\RecipeRunner;
        use Drupal\FunctionalTests\Core\Recipe\RecipeTestTrait;
        use Drupal\KernelTests\KernelTestBase; use Drupal\KernelTests\KernelTestBase;
        /** /**
        ...@@ -16,6 +17,8 @@ ...@@ -16,6 +17,8 @@
        */ */
        class RecipeTest extends KernelTestBase { class RecipeTest extends KernelTestBase {
        use RecipeTestTrait;
        /** /**
        * {@inheritdoc} * {@inheritdoc}
        */ */
        ...@@ -80,4 +83,19 @@ public function testExampleRecipe(): void { ...@@ -80,4 +83,19 @@ public function testExampleRecipe(): void {
        $this->assertSame($this->config('text.settings')->get('default_summary_length'), 700); $this->assertSame($this->config('text.settings')->get('default_summary_length'), 700);
        } }
        public function testImplicitlyRequiredModule(): void {
        $this->disableModules(['user']);
        $recipe = $this->createRecipe([
        'name' => 'Actions on config from required module',
        'config' => [
        'actions' => [
        'user.role.authenticated' => [
        'grantPermission' => 'access administration pages',
        ],
        ],
        ],
        ]);
        $this->assertIsObject($recipe);
        }
        } }
        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