function InputTest::testAskHiddenPromptArgumentsForwarded

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/KernelTests/Core/Recipe/InputTest.php \Drupal\KernelTests\Core\Recipe\InputTest::testAskHiddenPromptArgumentsForwarded()

Tests that the askHidden prompt forwards arguments correctly.

File

core/tests/Drupal/KernelTests/Core/Recipe/InputTest.php, line 334

Class

InputTest
Tests Input.

Namespace

Drupal\KernelTests\Core\Recipe

Code

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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.