FormElementInlineErrorTest.php in Drupal 8
File
core/modules/inline_form_errors/tests/src/Kernel/FormElementInlineErrorTest.php
View source
<?php
namespace Drupal\Tests\inline_form_errors\Kernel;
use Drupal\Core\Form\FormState;
use Drupal\KernelTests\KernelTestBase;
class FormElementInlineErrorTest extends KernelTestBase {
public static $modules = [
'inline_form_errors',
];
public function testDisplayErrorMessagesNotInline() {
$form_id = 'test';
$form = [
'#parents' => [],
'#disable_inline_form_errors' => TRUE,
'#array_parents' => [],
];
$form['test'] = [
'#type' => 'textfield',
'#title' => 'Test',
'#parents' => [
'test',
],
'#id' => 'edit-test',
'#array_parents' => [
'test',
],
];
$form_state = new FormState();
\Drupal::formBuilder()
->prepareForm($form_id, $form, $form_state);
\Drupal::formBuilder()
->processForm($form_id, $form, $form_state);
$this
->assertArraySubset([
'#error_no_message' => TRUE,
], $form['test']);
}
}