function ToolkitGdTest::testMissingOperation in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/system/src/Tests/Image/ToolkitGdTest.php \Drupal\system\Tests\Image\ToolkitGdTest::testMissingOperation()
Tests calling a missing image operation plugin.
File
- core/
modules/ system/ src/ Tests/ Image/ ToolkitGdTest.php, line 469 - Contains \Drupal\system\Tests\Image\ToolkitGdTest.
Class
- ToolkitGdTest
- Tests that core image manipulations work properly: scale, resize, rotate, crop, scale and crop, and desaturate.
Namespace
Drupal\system\Tests\ImageCode
function testMissingOperation() {
// Test that the image factory is set to use the GD toolkit.
$this
->assertEqual($this->imageFactory
->getToolkitId(), 'gd', 'The image factory is set to use the \'gd\' image toolkit.');
// An image file that will be tested.
$file = 'image-test.png';
// Load up a fresh image.
$image = $this->imageFactory
->get(drupal_get_path('module', 'simpletest') . '/files/' . $file);
if (!$image
->isValid()) {
$this
->fail(SafeMarkup::format('Could not load image %file.', array(
'%file' => $file,
)));
}
// Try perform a missing toolkit operation.
$this
->assertFalse($image
->apply('missing_op', array()), 'Calling a missing image toolkit operation plugin fails.');
}