public function SvgFormatterTest::testNonInlineImageOutput in SVG Formatter 8
Tests non-inline image output.
File
- tests/
src/ Functional/ SvgFormatterTest.php, line 159
Class
- SvgFormatterTest
- Simple test to ensure that basic functionality of the module works.
Namespace
Drupal\Tests\svg_formatter\FunctionalCode
public function testNonInlineImageOutput() {
$media = $this
->createMediaEntity();
$media
->save();
$display = $this->container
->get('entity_type.manager')
->getStorage('entity_view_display')
->load('media.svg.default');
$component = $display
->getComponent('field_media_file');
$component['settings'] = [
'inline' => FALSE,
'sanitize' => FALSE,
'apply_dimensions' => FALSE,
'width' => 100,
'height' => 100,
'enable_alt' => TRUE,
'alt_string' => '',
'enable_title' => TRUE,
'title_string' => '',
];
$display
->setComponent('field_media_file', $component)
->save();
$this
->drupalGet('media/1');
$this
->assertSession()
->elementAttributeContains('css', 'main > div > div > div:nth-child(3) > div:nth-child(4) > div:nth-child(2) > img', 'src', $media
->get('field_media_file')->entity
->getFilename());
}