function BookSettingsFormTest::testConfigValuesSavedCorrectly

Same name in other branches
  1. 10 core/modules/book/tests/src/Kernel/BookSettingsFormTest.php \Drupal\Tests\book\Kernel\BookSettingsFormTest::testConfigValuesSavedCorrectly()

Tests that submitted values are processed and saved correctly.

File

core/modules/book/tests/src/Kernel/BookSettingsFormTest.php, line 43

Class

BookSettingsFormTest
@covers \Drupal\book\Form\BookSettingsForm @group book

Namespace

Drupal\Tests\book\Kernel

Code

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.