public function FileHashTest::testFileHashField in File Hash 8
Tests the table with file hashes field formatter.
File
- tests/
src/ Functional/ FileHashTest.php, line 69
Class
- FileHashTest
- File Hash tests.
Namespace
Drupal\Tests\filehash\FunctionalCode
public function testFileHashField() {
$field_name = strtolower($this
->randomMachineName());
$type_name = 'article';
$field_storage_settings = [
'display_field' => '1',
'display_default' => '1',
'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED,
];
$field_settings = [
'description_field' => '1',
];
$widget_settings = [];
$this
->createFileField($field_name, 'node', $type_name, $field_storage_settings, $field_settings, $widget_settings);
$this
->drupalGet("admin/structure/types/manage/{$type_name}/display");
$fields = [
"fields[{$field_name}][type]" => 'filehash_table',
];
$this
->submitForm($fields, $this
->t('Save'));
}