You are here

public function FormStateTest::testSetCachedGet in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Form/FormStateTest.php \Drupal\Tests\Core\Form\FormStateTest::testSetCachedGet()

@covers ::setCached

File

core/tests/Drupal/Tests/Core/Form/FormStateTest.php, line 318
Contains \Drupal\Tests\Core\Form\FormStateTest.

Class

FormStateTest
@coversDefaultClass \Drupal\Core\Form\FormState

Namespace

Drupal\Tests\Core\Form

Code

public function testSetCachedGet() {
  $form_state = new FormState();
  $form_state
    ->setRequestMethod('GET');
  $this
    ->expectException(\LogicException::class);
  $this
    ->expectExceptionMessage('Form state caching on GET requests is not allowed.');
  $form_state
    ->setCached();
}