You are here

public function WorkspaceIntegrationTest::testFormCacheForRegularForms in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/workspaces/tests/src/Kernel/WorkspaceIntegrationTest.php \Drupal\Tests\workspaces\Kernel\WorkspaceIntegrationTest::testFormCacheForRegularForms()
  2. 10 core/modules/workspaces/tests/src/Kernel/WorkspaceIntegrationTest.php \Drupal\Tests\workspaces\Kernel\WorkspaceIntegrationTest::testFormCacheForRegularForms()

Tests that non-entity forms can be stored in the form cache.

File

core/modules/workspaces/tests/src/Kernel/WorkspaceIntegrationTest.php, line 996

Class

WorkspaceIntegrationTest
Tests a complete publishing scenario across different workspaces.

Namespace

Drupal\Tests\workspaces\Kernel

Code

public function testFormCacheForRegularForms() {
  $this
    ->initializeWorkspacesModule();
  $this
    ->switchToWorkspace('stage');
  $form_builder = $this->container
    ->get('form_builder');
  $form_state = new FormState();
  $built_form = $form_builder
    ->getForm(SiteInformationForm::class, $form_state);
  $form_builder
    ->setCache($built_form['#build_id'], $built_form, $form_state);
}