You are here

protected function ToolkitSetupTrait::prepareImageFileHandling in ImageMagick 8.2

Same name and namespace in other branches
  1. 8.3 tests/src/Kernel/ToolkitSetupTrait.php \Drupal\Tests\imagemagick\Kernel\ToolkitSetupTrait::prepareImageFileHandling()

Prepares image files for test handling.

This method is only working for functional tests. Kernel tests use a vfsStream virtual file system, that is not compatible with invocation by ImageMagick executables that require a physical file passed in as a real path.

5 calls to ToolkitSetupTrait::prepareImageFileHandling()
EventSubscriberTest::testEventSubscriber in tests/src/Functional/EventSubscriberTest.php
Test module's event subscriber.
ToolkitImagemagickFileMetadataTest::testFileMetadata in tests/src/Functional/ToolkitImagemagickFileMetadataTest.php
Test image toolkit integration with file metadata manager.
ToolkitImagemagickFileMetadataTest::testSourceLocalPath in tests/src/Functional/ToolkitImagemagickFileMetadataTest.php
Tests getSourceLocalPath() for re-creating local path.
ToolkitImagemagickTest::testManipulations in tests/src/Functional/ToolkitImagemagickTest.php
Test image toolkit operations.
ToolkitImagemagickTest::testTemporaryRemoteCopiesDeletion in tests/src/Functional/ToolkitImagemagickTest.php
Test removal of temporary files created during operations on remote files.

File

tests/src/Kernel/ToolkitSetupTrait.php, line 125

Class

ToolkitSetupTrait
Trait to manage toolkit setup tasks common across tests.

Namespace

Drupal\Tests\imagemagick\Kernel

Code

protected function prepareImageFileHandling() {
  if (!$this instanceof BrowserTestBase) {
    $this
      ->fail(__CLASS__ . " is not a BrowserTestBase test class, and file system cannot be initialised properly for calling ImageMagick executables.");
  }
  $this->fileSystem = \Drupal::service('file_system');

  // Prepare a directory for test file results.
  $this->testDirectory = 'public://imagetest';
  file_unmanaged_delete_recursive($this->testDirectory);
  file_prepare_directory($this->testDirectory, FILE_CREATE_DIRECTORY);

  // Prepare a copy of test files.
  $this
    ->getTestFiles('image');
}