public function TextimageApiTest::testForceTargetExtension in Textimage 8.3
Same name and namespace in other branches
- 8.4 tests/src/Kernel/TextimageApiTest.php \Drupal\Tests\textimage\Kernel\TextimageApiTest::testForceTargetExtension()
Test forcing an extension different from source image file.
File
- tests/
src/ Kernel/ TextimageApiTest.php, line 182
Class
- TextimageApiTest
- Kernel tests for Textimage API.
Namespace
Drupal\Tests\textimage\KernelCode
public function testForceTargetExtension() {
$files = $this
->getTestFiles('image');
// Get 'image-test.png'.
$file = File::create((array) array_shift($files));
$file
->save();
// Force GIF.
$textimage = $this->textimageFactory
->get();
$textimage
->setStyle(ImageStyle::load('textimage_test'))
->setSourceImageFile($file)
->setTargetExtension('gif')
->process([
'bingox',
])
->buildImage();
$image = \Drupal::service('image.factory')
->get($textimage
->getUri());
$this
->assertSame('image/gif', $image
->getMimeType());
}