public function GetTest::testTransformSourceArrayAt in Drupal 10
Same name and namespace in other branches
- 8 core/modules/migrate/tests/src/Unit/process/GetTest.php \Drupal\Tests\migrate\Unit\process\GetTest::testTransformSourceArrayAt()
- 9 core/modules/migrate/tests/src/Unit/process/GetTest.php \Drupal\Tests\migrate\Unit\process\GetTest::testTransformSourceArrayAt()
Tests the Get plugin when source is an array pointing to destination.
File
- core/
modules/ migrate/ tests/ src/ Unit/ process/ GetTest.php, line 61
Class
- GetTest
- Tests the get process plugin.
Namespace
Drupal\Tests\migrate\Unit\processCode
public function testTransformSourceArrayAt() {
$map = [
'test1' => 'source_value1',
'@@test2' => 'source_value2',
'@@test3' => 'source_value3',
'test4' => 'source_value4',
];
$this->plugin = new Get([
'source' => [
'test1',
'@@test2',
'@@test3',
'test4',
],
], '', []);
$this->row
->expects($this
->exactly(4))
->method('get')
->willReturnCallback(function ($argument) use ($map) {
return $map[$argument];
});
$value = $this->plugin
->transform(NULL, $this->migrateExecutable, $this->row, 'destination_property');
$this
->assertSame([
'source_value1',
'source_value2',
'source_value3',
'source_value4',
], $value);
}