function ExtractTest::testExtractFail

Same name in other branches
  1. 9 core/modules/migrate/tests/src/Unit/process/ExtractTest.php \Drupal\Tests\migrate\Unit\process\ExtractTest::testExtractFail()
  2. 8.9.x core/modules/migrate/tests/src/Unit/process/ExtractTest.php \Drupal\Tests\migrate\Unit\process\ExtractTest::testExtractFail()
  3. 11.x 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 48

Class

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

Namespace

Drupal\Tests\migrate\Unit\process

Code

public function testExtractFail() : void {
    $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');
}

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