function ElementsAccessTest::testAccessFalse

Same name in other branches
  1. 8.9.x core/modules/system/tests/src/Functional/Form/ElementsAccessTest.php \Drupal\Tests\system\Functional\Form\ElementsAccessTest::testAccessFalse()
  2. 10 core/modules/system/tests/src/Functional/Form/ElementsAccessTest.php \Drupal\Tests\system\Functional\Form\ElementsAccessTest::testAccessFalse()
  3. 11.x core/modules/system/tests/src/Functional/Form/ElementsAccessTest.php \Drupal\Tests\system\Functional\Form\ElementsAccessTest::testAccessFalse()

Ensures that child values are still processed when #access = FALSE.

File

core/modules/system/tests/src/Functional/Form/ElementsAccessTest.php, line 29

Class

ElementsAccessTest
Tests access control for form elements.

Namespace

Drupal\Tests\system\Functional\Form

Code

public function testAccessFalse() {
    $this->drupalGet('form_test/vertical-tabs-access');
    $this->submitForm([], 'Submit');
    $this->assertSession()
        ->pageTextNotContains('This checkbox inside a vertical tab does not have its default value.');
    $this->assertSession()
        ->pageTextNotContains('This textfield inside a vertical tab does not have its default value.');
    $this->assertSession()
        ->pageTextNotContains('This checkbox inside a fieldset does not have its default value.');
    $this->assertSession()
        ->pageTextNotContains('This checkbox inside a container does not have its default value.');
    $this->assertSession()
        ->pageTextNotContains('This checkbox inside a nested container does not have its default value.');
    $this->assertSession()
        ->pageTextNotContains('This checkbox inside a vertical tab whose fieldset access is allowed does not have its default value.');
    $this->assertSession()
        ->pageTextContains('The form submitted correctly.');
}

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