You are here

public function ArrayBuildTest::testTransform in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/migrate/tests/src/Unit/process/ArrayBuildTest.php \Drupal\Tests\migrate\Unit\process\ArrayBuildTest::testTransform()
  2. 9 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);
}