You are here

public function ImagemagickDeprecationTest::testGetModuleHandlerDeprecation in ImageMagick 8.2

Test deprecation of ImagemagickExecManager::getModuleHandler.

@group legacy

@todo the expectedDeprecation annotation does not work if tests are skipped.

#expectedDeprecation The deprecated alter hook hook_imagemagick_pre_parse_file_alter() is implemented in these functions: imagemagick_test_imagemagick_pre_parse_file_alter. Deprecated in 8.x-2.5, will be removed in 8.x-3.0. Use an event subscriber to react on a ImagemagickExecutionEvent::ENSURE_SOURCE_LOCAL_PATH event. See https://www.drupal.org/project/imagemagick/issues/3043136. #expectedDeprecation The deprecated alter hook hook_imagemagick_arguments_alter() is implemented in these functions: imagemagick_test_imagemagick_arguments_alter. Deprecated in 8.x-2.5, will be removed in 8.x-3.0. Use an event subscriber to react on a ImagemagickExecutionEvent::PRE_IDENTIFY_EXECUTE or a ImagemagickExecutionEvent::PRE_CONVERT_EXECUTE event. See https://www.drupal.org/project/imagemagick/issues/3043136. #expectedDeprecation Drupal\imagemagick\ImagemagickExecManager::getModuleHandler is deprecated in 8.x-2.5, will be removed in 8.x-3.0. No replacement suggested, Imagemagick hooks have been dropped in favour of event subscribers. See https://www.drupal.org/project/imagemagick/issues/3043136.

See also

https://github.com/symfony/symfony/pull/25757

File

tests/src/Functional/ImagemagickDeprecationTest.php, line 165

Class

ImagemagickDeprecationTest
Tests that core image manipulations work properly through Imagemagick.

Namespace

Drupal\Tests\imagemagick\Functional

Code

public function testGetModuleHandlerDeprecation() {
  $this
    ->setUpToolkit('imagemagick');
  $this
    ->expectDeprecation('The deprecated alter hook hook_imagemagick_pre_parse_file_alter() is implemented in these functions: imagemagick_test_imagemagick_pre_parse_file_alter. Deprecated in 8.x-2.5, will be removed in 8.x-3.0. Use an event subscriber to react on a ImagemagickExecutionEvent::ENSURE_SOURCE_LOCAL_PATH event. See https://www.drupal.org/project/imagemagick/issues/3043136.');
  $this
    ->expectDeprecation('The deprecated alter hook hook_imagemagick_arguments_alter() is implemented in these functions: imagemagick_test_imagemagick_arguments_alter. Deprecated in 8.x-2.5, will be removed in 8.x-3.0. Use an event subscriber to react on a ImagemagickExecutionEvent::PRE_IDENTIFY_EXECUTE or a ImagemagickExecutionEvent::PRE_CONVERT_EXECUTE event. See https://www.drupal.org/project/imagemagick/issues/3043136.');
  $this
    ->expectDeprecation('Drupal\\imagemagick\\ImagemagickExecManager::getModuleHandler is deprecated in 8.x-2.5, will be removed in 8.x-3.0. No replacement suggested, Imagemagick hooks have been dropped in favour of event subscribers. See https://www.drupal.org/project/imagemagick/issues/3043136.');
  $this
    ->getTestFiles('image');
  $image = $this->imageFactory
    ->get("public://image-test.png");
  $this
    ->assertInstanceOf(ModuleHandlerInterface::class, $image
    ->getToolkit()
    ->getExecManager()
    ->getModuleHandler());
}