You are here

public function CallbackTest::testCallbackExceptions in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/migrate/tests/src/Unit/process/CallbackTest.php \Drupal\Tests\migrate\Unit\process\CallbackTest::testCallbackExceptions()
  2. 9 core/modules/migrate/tests/src/Unit/process/CallbackTest.php \Drupal\Tests\migrate\Unit\process\CallbackTest::testCallbackExceptions()

Tests callback exceptions.

@dataProvider providerCallbackExceptions

Parameters

string $message: The expected exception message.

array $configuration: The plugin configuration being tested.

string $class: (optional) The expected exception class.

mixed $args: (optional) Arguments to pass to the transform() method.

File

core/modules/migrate/tests/src/Unit/process/CallbackTest.php, line 91

Class

CallbackTest
Tests the callback process plugin.

Namespace

Drupal\Tests\migrate\Unit\process

Code

public function testCallbackExceptions($message, array $configuration, $class = 'InvalidArgumentException', $args = NULL) {
  $this
    ->expectException($class);
  $this
    ->expectExceptionMessage($message);
  $this->plugin = new Callback($configuration, 'map', []);
  $this->plugin
    ->transform($args, $this->migrateExecutable, $this->row, 'destination_property');
}