function InputTest::testDefaultValueFromConfig

Tests getting the default value from configuration.

File

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

Class

InputTest
@group Recipe @covers \Drupal\Core\Recipe\InputConfigurator[[api-linebreak]]

Namespace

Drupal\KernelTests\Core\Recipe

Code

public function testDefaultValueFromConfig() : void {
  // Collect the input values before processing the recipe, using a mocked
  // collector that will always return the default value.
  $collector = $this->createMock(InputCollectorInterface::class);
  $collector->expects($this->any())
    ->method('collectValue')
    ->withAnyParameters()
    ->willReturnArgument(2);
  $this->recipe->input
    ->collectAll($collector);
  RecipeRunner::processRecipe($this->recipe);
  $this->assertSame([
    'ben@deep.space',
  ], ContactForm::load('feedback')?->getRecipients());
}

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