$this->
assertSame(20,
$image->
getHeight());
$this->
assertSame(image_type_to_mime_type($type),
$image->
getMimeType());
$this->
assertTrue($image->
save($file_path), "Image '
$file' should have been saved successfully, but it has not."
);
// Reload and check saved image.
$image_reloaded =
$this->imageFactory->
get($file_path);
$this->
assertTrue($image_reloaded->
isValid());
$this->
assertSame(50,
$image_reloaded->
getWidth());
$this->
assertSame(20,
$image_reloaded->
getHeight());
$this->
assertSame(image_type_to_mime_type($type),
$image_reloaded->
getMimeType());
if ($image_reloaded->
getToolkit()->
getType() == IMAGETYPE_GIF
) { $this->
assertSame('#ffff00',
$image_reloaded->
getToolkit()->
getTransparentColor(), "Image '
$file' after reload should have color channel set to #ffff00, but it has not."
);
} else { $this->
assertNull($image_reloaded->
getToolkit()->
getTransparentColor(), "Image '
$file' after reload should have no color channel set, but it has."
);
} } /**
* Tests failures of the 'create_new' operation.
*/
public function testCreateNewFailures(): void
{ $image =
$this->imageFactory->
get();