You are here

public function FormValidatorTest::providerTestHandleErrorsWithLimitedValidation in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/tests/Drupal/Tests/Core/Form/FormValidatorTest.php \Drupal\Tests\Core\Form\FormValidatorTest::providerTestHandleErrorsWithLimitedValidation()

File

core/tests/Drupal/Tests/Core/Form/FormValidatorTest.php, line 193
Contains \Drupal\Tests\Core\Form\FormValidatorTest.

Class

FormValidatorTest
@coversDefaultClass \Drupal\Core\Form\FormValidator @group Form

Namespace

Drupal\Tests\Core\Form

Code

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