diff --git a/core/modules/image/lib/Drupal/image/Tests/ImageEffectsTest.php b/core/modules/image/lib/Drupal/image/Tests/ImageEffectsTest.php index 74f41ec..f01b786 100644 --- a/core/modules/image/lib/Drupal/image/Tests/ImageEffectsTest.php +++ b/core/modules/image/lib/Drupal/image/Tests/ImageEffectsTest.php @@ -29,6 +29,13 @@ class ImageEffectsTest extends ToolkitTestBase { */ protected $manager; + /** + * A dummy image style entity for testing. + * + * @var \Drupal\image\ImageStyleManager + */ + protected $style; + public static function getInfo() { return array( 'name' => 'Image effects', @@ -39,6 +46,7 @@ public static function getInfo() { public function setUp() { parent::setUp(); + $this->style = entity_create('image_style', array()); $this->manager = $this->container->get('plugin.manager.image.effect'); } @@ -143,6 +151,16 @@ function testRotateEffect() { } /** + * Test passing parameters between effect and style. + */ + function testParameterEffect() { + $this->assertImageEffect('image_module_test_parameter', array()); + + // Check that the effect has set the test parameter. + $this->assertEqual($style->getParameter('test_parameter'), 'test_value', 'Style parameter was set correctly by the effect'); + } + + /** * Test image effect caching. */ function testImageEffectsCaching() { @@ -174,7 +192,7 @@ function testImageEffectsCaching() { */ protected function assertImageEffect($effect_name, array $data) { $effect = $this->manager->createInstance($effect_name, array('data' => $data)); - return $this->assertTrue($effect->applyEffect($this->image), 'Function returned the expected value.'); + return $this->assertTrue($effect->applyEffect($this->image, $this->style), 'Function returned the expected value.'); } } diff --git a/core/modules/image/tests/modules/image_module_test/lib/Drupal/image_module_test/Plugin/ImageEffect/ParameterTestImageEffect.php b/core/modules/image/tests/modules/image_module_test/lib/Drupal/image_module_test/Plugin/ImageEffect/ParameterTestImageEffect.php new file mode 100644 index 0000000..8775214 --- /dev/null +++ b/core/modules/image/tests/modules/image_module_test/lib/Drupal/image_module_test/Plugin/ImageEffect/ParameterTestImageEffect.php @@ -0,0 +1,32 @@ +setParameter('test_parameter', 'test_value'); + return TRUE; + } + +}