public function FormValidatorTest::providerTestPerformRequiredValidation in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/tests/Drupal/Tests/Core/Form/FormValidatorTest.php \Drupal\Tests\Core\Form\FormValidatorTest::providerTestPerformRequiredValidation()
File
- core/
tests/ Drupal/ Tests/ Core/ Form/ FormValidatorTest.php, line 408 - Contains \Drupal\Tests\Core\Form\FormValidatorTest.
Class
- FormValidatorTest
- @coversDefaultClass \Drupal\Core\Form\FormValidator @group Form
Namespace
Drupal\Tests\Core\FormCode
public function providerTestPerformRequiredValidation() {
return array(
array(
array(
'#type' => 'select',
'#options' => array(
'foo' => 'Foo',
'bar' => 'Bar',
),
'#required' => TRUE,
'#value' => 'baz',
'#empty_value' => 'baz',
'#multiple' => FALSE,
),
'Test field is required.',
FALSE,
),
array(
array(
'#type' => 'select',
'#options' => array(
'foo' => 'Foo',
'bar' => 'Bar',
),
'#value' => 'baz',
'#multiple' => FALSE,
),
'An illegal choice has been detected. Please contact the site administrator.',
TRUE,
),
array(
array(
'#type' => 'checkboxes',
'#options' => array(
'foo' => 'Foo',
'bar' => 'Bar',
),
'#value' => array(
'baz',
),
'#multiple' => TRUE,
),
'An illegal choice has been detected. Please contact the site administrator.',
TRUE,
),
array(
array(
'#type' => 'select',
'#options' => array(
'foo' => 'Foo',
'bar' => 'Bar',
),
'#value' => array(
'baz',
),
'#multiple' => TRUE,
),
'An illegal choice has been detected. Please contact the site administrator.',
TRUE,
),
array(
array(
'#type' => 'textfield',
'#maxlength' => 7,
'#value' => $this
->randomMachineName(8),
),
'Test cannot be longer than <em class="placeholder">7</em> characters but is currently <em class="placeholder">8</em> characters long.',
FALSE,
),
);
}