Version 1
[yaffs-website] / web / core / modules / system / tests / src / Functional / Form / ElementsAccessTest.php
1 <?php
2
3 namespace Drupal\Tests\system\Functional\Form;
4
5 use Drupal\Tests\BrowserTestBase;
6
7 /**
8  * Tests access control for form elements.
9  *
10  * @group Form
11  */
12 class ElementsAccessTest extends BrowserTestBase {
13
14   /**
15    * Modules to enable.
16    *
17    * @var array
18    */
19   public static $modules = ['form_test'];
20
21   /**
22    * Ensures that child values are still processed when #access = FALSE.
23    */
24   public function testAccessFalse() {
25     $this->drupalPostForm('form_test/vertical-tabs-access', NULL, t('Submit'));
26     $this->assertNoText(t('This checkbox inside a vertical tab does not have its default value.'));
27     $this->assertNoText(t('This textfield inside a vertical tab does not have its default value.'));
28     $this->assertNoText(t('This checkbox inside a fieldset does not have its default value.'));
29     $this->assertNoText(t('This checkbox inside a container does not have its default value.'));
30     $this->assertNoText(t('This checkbox inside a nested container does not have its default value.'));
31     $this->assertNoText(t('This checkbox inside a vertical tab whose fieldset access is allowed does not have its default value.'));
32     $this->assertText(t('The form submitted correctly.'));
33   }
34
35 }