function ArrayBuildTest::testNonExistentValue

Same name and namespace in other branches
  1. 8.9.x core/modules/migrate/tests/src/Unit/process/ArrayBuildTest.php \Drupal\Tests\migrate\Unit\process\ArrayBuildTest::testNonExistentValue()
  2. 10 core/modules/migrate/tests/src/Unit/process/ArrayBuildTest.php \Drupal\Tests\migrate\Unit\process\ArrayBuildTest::testNonExistentValue()
  3. 11.x core/modules/migrate/tests/src/Unit/process/ArrayBuildTest.php \Drupal\Tests\migrate\Unit\process\ArrayBuildTest::testNonExistentValue()

Tests non-existent key for the value configuration.

File

core/modules/migrate/tests/src/Unit/process/ArrayBuildTest.php, line 57

Class

ArrayBuildTest
@coversDefaultClass <a href="/api/drupal/core%21modules%21migrate%21src%21Plugin%21migrate%21process%21ArrayBuild.php/class/ArrayBuild/9" title="Builds an array based on the key and value configuration." class="local">\Drupal\migrate\Plugin\migrate\process\ArrayBuild</a> @group migrate

Namespace

Drupal\Tests\migrate\Unit\process

Code

public function testNonExistentValue() {
    $source = [
        [
            'foo' => 'bar',
        ],
    ];
    $this->expectException(MigrateException::class);
    $this->expectExceptionMessage("The key 'bar' does not exist");
    $this->plugin
        ->transform($source, $this->migrateExecutable, $this->row, 'destination_property');
}

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