Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 298090

Improve test coverage for Inline Form Errors

$
0
0

Problem/Motivation

#2880011: Allow disabling the Inline Form Errors summary needs refactoring of test FormErrorHandlerTest.

Add one form in the Setup with fields for various test cases (e.g. missing or invisible fields) and use it in every tests.

protected function setUp() {
  parent::setUp();

  $form = [
    '#parents' => [],
    '#form_id' => 'test_form',
    '#array_parents' => [],
  ];
  $form['test1'] = [
    '#type' => 'textfield',
    '#title' => 'Test 1',
    '#parents' => ['test1'],
    '#array_parents' => ['test1'],
    '#id' => 'edit-test1',
  ];


  (...)


  $form['test6'] = [
    '#type' => 'value',
    '#title' => 'Test 6',
    '#parents' => ['test6'],
    '#array_parents' => ['test6'],
    '#id' => 'edit-test6',
  ];

  $this->form = $form;

Proposed resolution

Use the existing form from the testDisplayErrorMessagesInline().

Remove testSetElementErrorsFromFormState(). It does not seem to be necessary. It's covered in testDisplayErrorMessagesInline()!


Viewing all articles
Browse latest Browse all 298090

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>