function InputTest::testMissingArgumentsThrowsException

Tests missing arguments throws exception.

@legacy-covers \Drupal\Core\Recipe\ConsoleInputCollector::collectValue

File

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

Class

InputTest
Tests Input.

Namespace

Drupal\KernelTests\Core\Recipe

Code

public function testMissingArgumentsThrowsException() : void {
  $recipe = $this->createRecipe(<<<YAML
  name: 'Collecting prompt input'
  input:
    capital:
      data_type: string
      description: The capital of a long-defunct country.
      prompt:
        method: ask
      default:
        source: value
        value: "I don't know that!"
  YAML);
  $collector = new ConsoleInputCollector($this->createMock(InputInterface::class), $this->createMock(StyleInterface::class));
  $this->expectException(\ArgumentCountError::class);
  $this->expectExceptionMessage('Argument #1 ($question) not passed');
  $recipe->input
    ->collectAll($collector);
}

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