You are here

public function ToolkitOperationsTest::testCreateNewImageArguments in ImageMagick 8.3

Same name and namespace in other branches
  1. 8.2 tests/src/Kernel/ToolkitOperationsTest.php \Drupal\Tests\imagemagick\Kernel\ToolkitOperationsTest::testCreateNewImageArguments()

Create a new image and inspect the arguments.

@dataProvider providerToolkitConfiguration

Parameters

string $toolkit_id: The id of the toolkit to set up.

string $toolkit_config: The config object of the toolkit to set up.

array $toolkit_settings: The settings of the toolkit to set up.

File

tests/src/Kernel/ToolkitOperationsTest.php, line 48

Class

ToolkitOperationsTest
Tests for ImageMagick toolkit operations.

Namespace

Drupal\Tests\imagemagick\Kernel

Code

public function testCreateNewImageArguments(string $toolkit_id, string $toolkit_config, array $toolkit_settings) : void {
  $this
    ->setUpToolkit($toolkit_id, $toolkit_config, $toolkit_settings);
  $image = $this->imageFactory
    ->get();
  $image
    ->createNew(100, 200);
  $this
    ->assertSame([
    0,
  ], array_keys($image
    ->getToolkit()
    ->arguments()
    ->find('/^./', NULL, [
    'image_toolkit_operation' => 'create_new',
  ])));
  $this
    ->assertSame([
    0,
  ], array_keys($image
    ->getToolkit()
    ->arguments()
    ->find('/^./', NULL, [
    'image_toolkit_operation_plugin_id' => 'imagemagick_create_new',
  ])));
  $this
    ->assertSame("-size 100x200 xc:transparent", $image
    ->getToolkit()
    ->arguments()
    ->toString(ImagemagickExecArguments::POST_SOURCE));
}