class FileElementTest
Same name and namespace in other branches
- 11.x core/modules/system/tests/src/Kernel/Form/FileElementTest.php \Drupal\Tests\system\Kernel\Form\FileElementTest
Tests for the 'file' form element.
@group Form
Hierarchy
- class \Drupal\KernelTests\KernelTestBase extends \Drupal\Core\DependencyInjection\ServiceProviderInterface uses \Drupal\KernelTests\AssertLegacyTrait, \Drupal\KernelTests\AssertContentTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\ExtensionListTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait implements \PHPUnit\Framework\TestCase
- class \Drupal\Tests\system\Kernel\Form\FileElementTest implements \Drupal\KernelTests\KernelTestBase
Expanded class hierarchy of FileElementTest
File
-
core/
modules/ system/ tests/ src/ Kernel/ Form/ FileElementTest.php, line 13
Namespace
Drupal\Tests\system\Kernel\FormView source
class FileElementTest extends KernelTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = [
'form_test',
];
/**
* Tests that file elements are built and processed correctly.
*/
public function testFileElement() {
$form = $this->container
->get('form_builder')
->getForm(FormTestFileForm::class);
$this->assertSame('file', $form['file']['#type']);
$this->assertTrue($form['file']['#multiple']);
$this->assertContains('cagatio', $form['file']['#attributes']['class']);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.