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

Issue #3517481 by mradcliffe, smustgrave: askHidden prompt fails with "Unknown...

Issue #3517481 by mradcliffe, smustgrave: askHidden prompt fails with "Unknown named parameter $default"

(cherry picked from commit b43aae5d)
parent d17509c2
Branches
Tags
6 merge requests!12473Issue #3521639 by mstrelan, smustgrave for 11.2,!12462Issue #3523109 by ghost of drupal past, donquixote, nicxvan, dww, larowlan,...,!12357Issue #3529639 by mradcliffe, smustgrave, solomon.yifru: replacing a depricated css,!12209#3526180 Ensure displace runs with new navigation module.,!8811Issue #3129179: Provide some way to rebuild the persistent bundle field map,!7916Remove taxonomy dependency on node module - 11.x
Pipeline #495742 passed with warnings
Pipeline: drupal

#495767

    Pipeline: drupal

    #495755

      Pipeline: drupal

      #495749

        ......@@ -93,11 +93,14 @@ public function collectValue(string $name, DataDefinitionInterface $definition,
        $method = $settings['method'];
        $arguments = $settings['arguments'] ?? [];
        // Most of the input-collecting methods of StyleInterface have a `default`
        // parameter.
        $arguments += [
        'default' => $default_value,
        ];
        if ($method !== 'askHidden') {
        // Most of the input-collecting methods of StyleInterface have a `default`
        // parameter.
        $arguments += [
        'default' => $default_value,
        ];
        }
        // We don't support using Symfony Console's inline validation; instead,
        // input definitions should define constraints.
        unset($arguments['validator']);
        ......
        ......@@ -17,7 +17,9 @@
        use Drupal\KernelTests\KernelTestBase;
        use Drupal\node\Entity\NodeType;
        use Symfony\Component\Console\Input\InputInterface;
        use Symfony\Component\Console\Output\OutputInterface;
        use Symfony\Component\Console\Style\StyleInterface;
        use Symfony\Component\Console\Style\SymfonyStyle;
        use Symfony\Component\Validator\Exception\ValidationFailedException;
        /**
        ......@@ -289,4 +291,32 @@ public function collectValue(string $name, DataDefinitionInterface $definition,
        RecipeRunner::processRecipe($recipe);
        }
        /**
        * Tests that the askHidden prompt forwards arguments correctly.
        */
        public function testAskHiddenPromptArgumentsForwarded(): void {
        $input = $this->createMock(InputInterface::class);
        $output = $this->createMock(OutputInterface::class);
        $io = new SymfonyStyle($input, $output);
        $recipe = $this->createRecipe(<<<YAML
        name: 'Prompt askHidden Test'
        input:
        foo:
        data_type: string
        description: Foo
        prompt:
        method: askHidden
        default:
        source: value
        value: bar
        YAML
        );
        $collector = new ConsoleInputCollector($input, $io);
        // askHidden prompt should have an ArgumentCountError rather than a general
        // error.
        $this->expectException(\ArgumentCountError::class);
        $recipe->input->collectAll($collector);
        }
        }
        0% Loading or .
        You are about to add 0 people to the discussion. Proceed with caution.
        Please register or to comment