public function FileEntityFormatterTest::testFormatterFileMime in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/file/src/Tests/Formatter/FileEntityFormatterTest.php \Drupal\file\Tests\Formatter\FileEntityFormatterTest::testFormatterFileMime()
Tests the file_extension field formatter.
File
- core/
modules/ file/ src/ Tests/ Formatter/ FileEntityFormatterTest.php, line 142 - Contains \Drupal\file\Tests\Formatter\FileEntityFormatterTest.
Class
- FileEntityFormatterTest
- Tests the default file formatter.
Namespace
Drupal\file\Tests\FormatterCode
public function testFormatterFileMime() {
$entity_display = EntityViewDisplay::create([
'targetEntityType' => 'file',
'bundle' => 'file',
]);
$entity_display
->setComponent('filemime', [
'type' => 'file_filemime',
'settings' => [
'filemime_image' => TRUE,
],
]);
foreach (array_values($this->files) as $i => $file) {
$build = $entity_display
->build($file);
$this
->assertEqual('image__file_icon', $build['filemime'][0]['#theme']);
$this
->assertEqual(spl_object_hash($file), spl_object_hash($build['filemime'][0]['#file']));
}
}