function ConfigTargetTest::testIncorrectKey

Same name and namespace in other branches
  1. 10 core/modules/system/tests/src/Functional/Form/ConfigTargetTest.php \Drupal\Tests\system\Functional\Form\ConfigTargetTest::testIncorrectKey()

Tests #config_target with an incorrect key.

File

core/modules/system/tests/src/Functional/Form/ConfigTargetTest.php, line 43

Class

ConfigTargetTest
Tests forms using #config_target.

Namespace

Drupal\Tests\system\Functional\Form

Code

public function testIncorrectKey() : void {
    $this->drupalGet('/form-test/incorrect-config-target');
    $page = $this->getSession()
        ->getPage();
    $page->pressButton('Save configuration');
    $assert_session = $this->assertSession();
    $assert_session->statusMessageContains('\'does_not_exist\' is not a supported key.', 'error');
    $assert_session->elementAttributeExists('named', [
        'field',
        'Missing key',
    ], 'aria-invalid');
}

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