function FormValidatorTest::providerTestHandleErrorsWithLimitedValidation

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Form/FormValidatorTest.php \Drupal\Tests\Core\Form\FormValidatorTest::providerTestHandleErrorsWithLimitedValidation()
  2. 8.9.x core/tests/Drupal/Tests/Core/Form/FormValidatorTest.php \Drupal\Tests\Core\Form\FormValidatorTest::providerTestHandleErrorsWithLimitedValidation()
  3. 10 core/tests/Drupal/Tests/Core/Form/FormValidatorTest.php \Drupal\Tests\Core\Form\FormValidatorTest::providerTestHandleErrorsWithLimitedValidation()

File

core/tests/Drupal/Tests/Core/Form/FormValidatorTest.php, line 186

Class

FormValidatorTest
@coversDefaultClass \Drupal\Core\Form\FormValidator[[api-linebreak]] @group Form

Namespace

Drupal\Tests\Core\Form

Code

public static function providerTestHandleErrorsWithLimitedValidation() {
  return [
    // Test with a non-existent section.
[
      [
        [
          'test1',
        ],
        [
          'test3',
        ],
      ],
      [],
      [
        'test1' => 'foo',
        'test2' => 'bar',
      ],
      [
        'test1' => 'foo',
      ],
    ],
    // Test with buttons in a non-validated section.
[
      [
        [
          'test1',
        ],
      ],
      [
        '#is_button' => TRUE,
        '#value' => 'baz',
        '#name' => 'op',
        '#parents' => [
          'submit',
        ],
      ],
      [
        'test1' => 'foo',
        'test2' => 'bar',
        'op' => 'baz',
        'submit' => 'baz',
      ],
      [
        'test1' => 'foo',
        'submit' => 'baz',
        'op' => 'baz',
      ],
    ],
    // Test with a matching button #value and $form_state value.
[
      [
        [
          'submit',
        ],
      ],
      [
        '#is_button' => TRUE,
        '#value' => 'baz',
        '#name' => 'op',
        '#parents' => [
          'submit',
        ],
      ],
      [
        'test1' => 'foo',
        'test2' => 'bar',
        'op' => 'baz',
        'submit' => 'baz',
      ],
      [
        'submit' => 'baz',
        'op' => 'baz',
      ],
    ],
    // Test with a mismatched button #value and $form_state value.
[
      [
        [
          'submit',
        ],
      ],
      [
        '#is_button' => TRUE,
        '#value' => 'bar',
        '#name' => 'op',
        '#parents' => [
          'submit',
        ],
      ],
      [
        'test1' => 'foo',
        'test2' => 'bar',
        'op' => 'baz',
        'submit' => 'baz',
      ],
      [
        'submit' => 'baz',
      ],
    ],
  ];
}

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