public function FileEntityFormatterTest::testFormatterFileLink 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::testFormatterFileLink()
Tests the file_link field formatter.
File
- core/
modules/ file/ src/ Tests/ Formatter/ FileEntityFormatterTest.php, line 79 - Contains \Drupal\file\Tests\Formatter\FileEntityFormatterTest.
Class
- FileEntityFormatterTest
- Tests the default file formatter.
Namespace
Drupal\file\Tests\FormatterCode
public function testFormatterFileLink() {
$entity_display = EntityViewDisplay::create([
'targetEntityType' => 'file',
'bundle' => 'file',
]);
$entity_display
->setComponent('filename', [
'type' => 'file_link',
]);
$build = $entity_display
->buildMultiple($this->files)[0]['filename'][0];
$this
->assertEqual('file.png', $build['#title']);
$this
->assertEqual(Url::fromUri(file_create_url('public://file.png')), $build['#url']);
}