function BookSettingsFormTest::testConfigValuesSavedCorrectly
Tests that submitted values are processed and saved correctly.
File
- 
              core/modules/ book/ tests/ src/ Kernel/ BookSettingsFormTest.php, line 46 
Class
- BookSettingsFormTest
- @covers \Drupal\book\Form\BookSettingsForm[[api-linebreak]] @group book @group legacy
Namespace
Drupal\Tests\book\KernelCode
public function testConfigValuesSavedCorrectly() : void {
  $form_state = new FormState();
  $form_state->setValues([
    'book_allowed_types' => [
      'page',
      'chapter',
      '',
    ],
    'book_child_type' => 'page',
  ]);
  $this->container
    ->get('form_builder')
    ->submitForm(BookSettingsForm::class, $form_state);
  $config = $this->config('book.settings');
  $this->assertSame([
    'chapter',
    'page',
  ], $config->get('allowed_types'));
  $this->assertSame('page', $config->get('child_type'));
}Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.
