Version 1
[yaffs-website] / web / core / modules / system / tests / src / Functional / Form / ElementsAccessTest.php
diff --git a/web/core/modules/system/tests/src/Functional/Form/ElementsAccessTest.php b/web/core/modules/system/tests/src/Functional/Form/ElementsAccessTest.php
new file mode 100644 (file)
index 0000000..1a92893
--- /dev/null
@@ -0,0 +1,35 @@
+<?php
+
+namespace Drupal\Tests\system\Functional\Form;
+
+use Drupal\Tests\BrowserTestBase;
+
+/**
+ * Tests access control for form elements.
+ *
+ * @group Form
+ */
+class ElementsAccessTest extends BrowserTestBase {
+
+  /**
+   * Modules to enable.
+   *
+   * @var array
+   */
+  public static $modules = ['form_test'];
+
+  /**
+   * Ensures that child values are still processed when #access = FALSE.
+   */
+  public function testAccessFalse() {
+    $this->drupalPostForm('form_test/vertical-tabs-access', NULL, t('Submit'));
+    $this->assertNoText(t('This checkbox inside a vertical tab does not have its default value.'));
+    $this->assertNoText(t('This textfield inside a vertical tab does not have its default value.'));
+    $this->assertNoText(t('This checkbox inside a fieldset does not have its default value.'));
+    $this->assertNoText(t('This checkbox inside a container does not have its default value.'));
+    $this->assertNoText(t('This checkbox inside a nested container does not have its default value.'));
+    $this->assertNoText(t('This checkbox inside a vertical tab whose fieldset access is allowed does not have its default value.'));
+    $this->assertText(t('The form submitted correctly.'));
+  }
+
+}