public function FocalPointEffectsTest::testCalculateAnchor in Focal Point 8
Test calculating the anchor.
@covers ::calculateAnchor
@dataProvider calculateAnchorProvider
File
- tests/
src/ Unit/ Effects/ FocalPointEffectsTest.php, line 217
Class
- FocalPointEffectsTest
- Tests the Focal Point image effects.
Namespace
Drupal\Tests\focal_point\Unit\EffectsCode
public function testCalculateAnchor($focal_point, $image_size, $crop_size, $expected) {
$image = $this
->getTestImage($image_size['width'], $image_size['height']);
$crop = $this
->prophesize(CropInterface::class);
$crop
->size()
->willReturn($crop_size);
// Use reflection to test a private/protected method.
$effect = $this
->getTestEffect();
$effect_reflection = new \ReflectionClass(TestFocalPointEffectBase::class);
$method = $effect_reflection
->getMethod('calculateAnchor');
$method
->setAccessible(TRUE);
$args = [
$focal_point,
$image,
$crop
->reveal(),
];
$this
->assertSame($expected, $method
->invokeArgs($effect, $args));
}