function CallbackTest::testCallbackExceptions

Same name in other branches
  1. 8.9.x core/modules/migrate/tests/src/Unit/process/CallbackTest.php \Drupal\Tests\migrate\Unit\process\CallbackTest::testCallbackExceptions()
  2. 10 core/modules/migrate/tests/src/Unit/process/CallbackTest.php \Drupal\Tests\migrate\Unit\process\CallbackTest::testCallbackExceptions()
  3. 11.x 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');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.