You are here

protected function TestToolkit::logCall in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/system/tests/modules/image_test/src/Plugin/ImageToolkit/TestToolkit.php \Drupal\image_test\Plugin\ImageToolkit\TestToolkit::logCall()
  2. 9 core/modules/system/tests/modules/image_test/src/Plugin/ImageToolkit/TestToolkit.php \Drupal\image_test\Plugin\ImageToolkit\TestToolkit::logCall()

Stores the values passed to a toolkit call.

Parameters

string $op: One of the toolkit methods 'parseFile', 'save', 'settings', or 'apply'.

array $args: Values passed to hook.

See also

\Drupal\Tests\system\Functional\Image\ToolkitTestBase::imageTestReset()

\Drupal\Tests\system\Functional\Image\ToolkitTestBase::imageTestGetAllCalls()

4 calls to TestToolkit::logCall()
TestToolkit::apply in core/modules/system/tests/modules/image_test/src/Plugin/ImageToolkit/TestToolkit.php
Applies a toolkit operation to an image.
TestToolkit::buildConfigurationForm in core/modules/system/tests/modules/image_test/src/Plugin/ImageToolkit/TestToolkit.php
Form constructor.
TestToolkit::parseFile in core/modules/system/tests/modules/image_test/src/Plugin/ImageToolkit/TestToolkit.php
Determines if a file contains a valid image.
TestToolkit::save in core/modules/system/tests/modules/image_test/src/Plugin/ImageToolkit/TestToolkit.php
Writes an image resource to a destination file.

File

core/modules/system/tests/modules/image_test/src/Plugin/ImageToolkit/TestToolkit.php, line 166

Class

TestToolkit
Defines a Test toolkit for image manipulation within Drupal.

Namespace

Drupal\image_test\Plugin\ImageToolkit

Code

protected function logCall($op, $args) {
  $results = $this->state
    ->get('image_test.results', []);
  $results[$op][] = $args;

  // A call to apply is also logged under its operation name whereby the
  // array of arguments are logged as separate arguments, this because at the
  // ImageInterface level we still have methods named after the operations.
  if ($op === 'apply') {
    $operation = array_shift($args);
    $results[$operation][] = array_values(reset($args));
  }
  $this->state
    ->set('image_test.results', $results);
}