function ImageTest::getTestImageForOperation
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Image/ImageTest.php \Drupal\Tests\Core\Image\ImageTest::getTestImageForOperation()
- 8.9.x core/tests/Drupal/Tests/Core/Image/ImageTest.php \Drupal\Tests\Core\Image\ImageTest::getTestImageForOperation()
- 11.x core/tests/Drupal/Tests/Core/Image/ImageTest.php \Drupal\Tests\Core\Image\ImageTest::getTestImageForOperation()
Get an image with mocked toolkit and operation, for operation testing.
Parameters
string $class_name: The name of the GD toolkit operation class to be mocked.
Return value
\Drupal\Core\Image\Image An image object.
14 calls to ImageTest::getTestImageForOperation()
- ImageTest::testConvert in core/
tests/ Drupal/ Tests/ Core/ Image/ ImageTest.php - Tests \Drupal\Core\Image\Image::convert().
- ImageTest::testCrop in core/
tests/ Drupal/ Tests/ Core/ Image/ ImageTest.php - Tests \Drupal\Core\Image\Image::crop().
- ImageTest::testCropHeight in core/
tests/ Drupal/ Tests/ Core/ Image/ ImageTest.php - Tests \Drupal\Core\Image\Image::crop().
- ImageTest::testCropWidth in core/
tests/ Drupal/ Tests/ Core/ Image/ ImageTest.php - Tests \Drupal\Core\Image\Image::crop().
- ImageTest::testDesaturate in core/
tests/ Drupal/ Tests/ Core/ Image/ ImageTest.php - Tests \Drupal\Core\Image\Image::desaturate().
File
-
core/
tests/ Drupal/ Tests/ Core/ Image/ ImageTest.php, line 136
Class
- ImageTest
- Tests the image class.
Namespace
Drupal\Tests\Core\ImageCode
protected function getTestImageForOperation($class_name) {
$this->toolkit = $this->getToolkitMock([
'getToolkitOperation',
]);
$this->toolkitOperation = $this->getToolkitOperationMock($class_name, $this->toolkit);
$this->toolkit
->expects($this->any())
->method('getPluginId')
->willReturn('gd');
$this->toolkit
->expects($this->any())
->method('getToolkitOperation')
->willReturn($this->toolkitOperation);
$this->image = new Image($this->toolkit, $this->source);
return $this->image;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.