You are here

public function FormBuilderTest::testFormCacheDeletionUncached in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php \Drupal\Tests\Core\Form\FormBuilderTest::testFormCacheDeletionUncached()
  2. 9 core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php \Drupal\Tests\Core\Form\FormBuilderTest::testFormCacheDeletionUncached()

Tests that an uncached form does not trigger cache set or delete.

File

core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php, line 548
Contains \Drupal\Tests\Core\Form\FormBuilderTest.

Class

FormBuilderTest
@coversDefaultClass \Drupal\Core\Form\FormBuilder @group Form

Namespace

Drupal\Tests\Core\Form

Code

public function testFormCacheDeletionUncached() {
  $form_id = 'test_form_id';
  $form_build_id = $this
    ->randomMachineName();
  $expected_form = $form_id();
  $expected_form['#build_id'] = $form_build_id;
  $form_arg = $this
    ->getMockForm($form_id, $expected_form);
  $this->formCache
    ->expects($this
    ->never())
    ->method('deleteCache');
  $form_state = new FormState();
  $this
    ->simulateFormSubmission($form_id, $form_arg, $form_state);
}