protected function SvgFormatterTest::createMediaEntity in SVG Formatter 8
Creates a media entity.
Return value
\Drupal\media\Entity\Media The created media entity.
Throws
\Drupal\Core\Entity\EntityStorageException
7 calls to SvgFormatterTest::createMediaEntity()
- SvgFormatterTest::testAltAndTitleAttributes in tests/
src/ Functional/ SvgFormatterTest.php - Tests alt and title attributes.
- SvgFormatterTest::testImageSizeAttributes in tests/
src/ Functional/ SvgFormatterTest.php - Tests image size attributes.
- SvgFormatterTest::testInlineImageOutput in tests/
src/ Functional/ SvgFormatterTest.php - Tests inline image output.
- SvgFormatterTest::testInlineImageWithTitleOutput in tests/
src/ Functional/ SvgFormatterTest.php - Tests inline image output with title attribute.
- SvgFormatterTest::testNonInlineImageOutput in tests/
src/ Functional/ SvgFormatterTest.php - Tests non-inline image output.
File
- tests/
src/ Functional/ SvgFormatterTest.php, line 144
Class
- SvgFormatterTest
- Simple test to ensure that basic functionality of the module works.
Namespace
Drupal\Tests\svg_formatter\FunctionalCode
protected function createMediaEntity() {
$value = static::generateTestSvgFile();
$media = Media::create([
'name' => 'test',
'bundle' => 'svg',
$this->defaultSourceField
->getName() => $value
->id(),
]);
$media
->save();
return $media;
}