function ConditionPluginBaseTest::testValidateConfigurationForm

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/Tests/Core/Condition/ConditionPluginBaseTest.php \Drupal\Tests\Core\Condition\ConditionPluginBaseTest::testValidateConfigurationForm()

Tests that the negate form value is cast to a boolean on validation.

Attributes

#[DataProvider('providerTestValidateConfigurationForm')]

File

core/tests/Drupal/Tests/Core/Condition/ConditionPluginBaseTest.php, line 24

Class

ConditionPluginBaseTest
Tests Drupal\Core\Condition\ConditionPluginBase.

Namespace

Drupal\Tests\Core\Condition

Code

public function testValidateConfigurationForm(mixed $value, bool $expected) : void {
  $condition = new TestConditionPluginBase([], '', '');
  $form = [];
  $form_state = new FormState();
  $form_state->setValue('negate', $value);
  $condition->validateConfigurationForm($form, $form_state);
  $this->assertSame($expected, $form_state->getValue('negate'));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.