You are here

public function ExtractTest::testExtractFail in Drupal 9

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

Tests unsuccessful extraction.

File

core/modules/migrate/tests/src/Unit/process/ExtractTest.php, line 46

Class

ExtractTest
@coversDefaultClass \Drupal\migrate\Plugin\migrate\process\Extract @group migrate

Namespace

Drupal\Tests\migrate\Unit\process

Code

public function testExtractFail() {
  $this
    ->expectException(MigrateException::class);
  $this
    ->expectExceptionMessage("Array index missing, extraction failed for 'array(\n  'bar' => 'foo',\n)'. Consider adding a `default` key to the configuration.");
  $this->plugin
    ->transform([
    'bar' => 'foo',
  ], $this->migrateExecutable, $this->row, 'destination_property');
}