function FormErrorHandlerFileUploadTest::testFileUploadErrors

Same name and namespace in other branches
  1. 9 core/modules/inline_form_errors/tests/src/Functional/FormErrorHandlerFileUploadTest.php \Drupal\Tests\inline_form_errors\Functional\FormErrorHandlerFileUploadTest::testFileUploadErrors()
  2. 8.9.x core/modules/inline_form_errors/tests/src/Functional/FormErrorHandlerFileUploadTest.php \Drupal\Tests\inline_form_errors\Functional\FormErrorHandlerFileUploadTest::testFileUploadErrors()
  3. 10 core/modules/inline_form_errors/tests/src/Functional/FormErrorHandlerFileUploadTest.php \Drupal\Tests\inline_form_errors\Functional\FormErrorHandlerFileUploadTest::testFileUploadErrors()

Tests that the required field error is displayed as inline error message.

File

core/modules/inline_form_errors/tests/src/Functional/FormErrorHandlerFileUploadTest.php, line 94

Class

FormErrorHandlerFileUploadTest
Tests file upload scenario's with Inline Form Errors.

Namespace

Drupal\Tests\inline_form_errors\Functional

Code

public function testFileUploadErrors() : void {
    $this->drupalGet('node/add/page');
    $edit = [
        'edit-title-0-value' => $this->randomString(),
    ];
    $this->submitForm($edit, 'Save');
    $error_text = $this->getSession()
        ->getPage()
        ->find('css', '.field--name-field-ief-file .form-item--error-message')
        ->getText();
    $this->assertEquals('field_ief_file field is required.', $error_text);
}

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