function MaximumFileSizeExceededUploadTest::setUp

Same name and namespace in other branches
  1. 8.9.x core/modules/file/tests/src/FunctionalJavascript/MaximumFileSizeExceededUploadTest.php \Drupal\Tests\file\FunctionalJavascript\MaximumFileSizeExceededUploadTest::setUp()
  2. 10 core/modules/file/tests/src/FunctionalJavascript/MaximumFileSizeExceededUploadTest.php \Drupal\Tests\file\FunctionalJavascript\MaximumFileSizeExceededUploadTest::setUp()
  3. 11.x core/modules/file/tests/src/FunctionalJavascript/MaximumFileSizeExceededUploadTest.php \Drupal\Tests\file\FunctionalJavascript\MaximumFileSizeExceededUploadTest::setUp()

Overrides BrowserTestBase::setUp

File

core/modules/file/tests/src/FunctionalJavascript/MaximumFileSizeExceededUploadTest.php, line 57

Class

MaximumFileSizeExceededUploadTest
Tests uploading a file that exceeds the maximum file size.

Namespace

Drupal\Tests\file\FunctionalJavascript

Code

protected function setUp() : void {
    parent::setUp();
    $this->fileSystem = $this->container
        ->get('file_system');
    // Create the Article node type.
    $this->drupalCreateContentType([
        'type' => 'article',
        'name' => 'Article',
    ]);
    // Attach a file field to the node type.
    $field_settings = [
        'file_extensions' => 'txt',
    ];
    $this->createFileField('field_file', 'node', 'article', [], $field_settings);
    // Log in as a content author who can create Articles.
    $this->user = $this->drupalCreateUser([
        'access content',
        'create article content',
    ]);
    $this->drupalLogin($this->user);
    // Disable the displaying of errors, so that the AJAX responses are not
    // contaminated with error messages about exceeding the maximum POST size.
    // @todo Remove this when issue #2905597 is fixed.
    // @see https://www.drupal.org/node/2905597
    $this->originalDisplayErrorsValue = ini_set('display_errors', '0');
}

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