protected function FocalPointUnitTestCase::getTestEffect in Focal Point 8
Get the test effects.
Parameters
\Drupal\Core\Image\ImageInterface|null $original_image: Original Image.
Return value
\Drupal\focal_point\Plugin\ImageEffect\FocalPointCropImageEffect Effect.
4 calls to FocalPointUnitTestCase::getTestEffect()
- FocalPointEffectsTest::testCalculateAnchor in tests/
src/ Unit/ Effects/ FocalPointEffectsTest.php - Test calculating the anchor.
- FocalPointEffectsTest::testConstrainCropArea in tests/
src/ Unit/ Effects/ FocalPointEffectsTest.php - Test constrain logic.
- FocalPointEffectsTest::testSetGetOriginalImageSize in tests/
src/ Unit/ Effects/ FocalPointEffectsTest.php - Test the getting and setting of the original image size.
- FocalPointEffectsTest::testTransformFocalPoint in tests/
src/ Unit/ Effects/ FocalPointEffectsTest.php - Test the focal point transformation.
File
- tests/
src/ Unit/ FocalPointUnitTestCase.php, line 68
Class
- FocalPointUnitTestCase
- Focal point unit test case.
Namespace
Drupal\Tests\focal_point\UnitCode
protected function getTestEffect(ImageInterface $original_image = NULL) {
if (is_null($original_image)) {
$original_image = $this
->getTestImage(0, 0);
}
$logger = $this
->prophesize(LoggerInterface::class);
$crop_storage = $this
->prophesize(CropStorageInterface::class);
$immutable_config = $this
->prophesize(ImmutableConfig::class);
$request = $this
->prophesize(Request::class);
$effect = new FocalPointCropImageEffect([], 'plugin_id', [], $logger
->reveal(), $this->focalPointManager, $crop_storage
->reveal(), $immutable_config
->reveal(), $request
->reveal());
$effect
->setOriginalImageSize($original_image
->getWidth(), $original_image
->getHeight());
return $effect;
}