function UploadHelpTest::testUnlimitedFileSize

Verify the size limit text does not appear if the size is unlimited.

File

core/modules/file/tests/src/Kernel/UploadHelpTest.php, line 26

Class

UploadHelpTest
Tests the output of the file upload help.

Namespace

Drupal\Tests\file\Kernel

Code

public function testUnlimitedFileSize() : void {
  $help_text = [
    '#theme' => 'file_upload_help',
    '#upload_validators' => [
      'FileSizeLimit' => [
        'fileLimit' => '0',
      ],
    ],
    '#cardinality' => 1,
  ];
  /** @var \Drupal\Component\Render\MarkupInterface $output */
  $output = \Drupal::service('renderer')->renderInIsolation($help_text);
  $this->assertEquals("One file only.\n", (string) $output);
}

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