function InputTest::testAskPromptArgumentsInteger

Tests that the ask prompt for integer value doesn't fail with an error.

File

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

Class

InputTest
Tests Input.

Namespace

Drupal\KernelTests\Core\Recipe

Code

public function testAskPromptArgumentsInteger() : void {
  $input = $this->createMock(InputInterface::class);
  $io = $this->createMock(StyleInterface::class);
  $io->expects($this->once())
    ->method('ask')
    ->with('Who are you?', '123', NULL);
  $data_definition = DataDefinition::create('string')->setSetting('prompt', [
    'method' => 'ask',
    'arguments' => [
      'question' => 'Who are you?',
    ],
  ]);
  (new ConsoleInputCollector($input, $io))->collectValue('test.one', $data_definition, 123);
}

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