function ArrayBuildTest::testTransform

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

Tests successful transformation.

File

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

Class

ArrayBuildTest
@coversDefaultClass \Drupal\migrate\Plugin\migrate\process\ArrayBuild @group migrate

Namespace

Drupal\Tests\migrate\Unit\process

Code

public function testTransform() {
    $source = [
        [
            'foo' => 'Foo',
            'bar' => 'Bar',
        ],
        [
            'foo' => 'foo bar',
            'bar' => 'bar foo',
        ],
    ];
    $expected = [
        'Foo' => 'Bar',
        'foo bar' => 'bar foo',
    ];
    $value = $this->plugin
        ->transform($source, $this->migrateExecutable, $this->row, 'destination_property');
    $this->assertSame($value, $expected);
}

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