TaxonomyTermReferenceFieldTest.php in Drupal 10
File
core/modules/taxonomy/tests/src/Unit/Plugin/migrate/field/TaxonomyTermReferenceFieldTest.php
View source
<?php
namespace Drupal\Tests\taxonomy\Unit\Plugin\migrate\field;
use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\Tests\UnitTestCase;
use Drupal\taxonomy\Plugin\migrate\field\TaxonomyTermReference;
use Prophecy\Argument;
class TaxonomyTermReferenceFieldTest extends UnitTestCase {
protected $plugin;
protected $migration;
protected function setUp() : void {
$this->plugin = new TaxonomyTermReference([], 'taxonomy', []);
$migration = $this
->prophesize(MigrationInterface::class);
$migration
->setProcessOfProperty(Argument::type('string'), Argument::type('array'))
->will(function ($arguments) use ($migration) {
$migration
->getProcess()
->willReturn($arguments[1]);
});
$this->migration = $migration
->reveal();
}
public function testDefineValueProcessPipeline($method = 'defineValueProcessPipeline') {
$this->plugin
->{$method}($this->migration, 'field_name', []);
$expected = [
'plugin' => 'sub_process',
'source' => 'field_name',
'process' => [
'target_id' => 'tid',
],
];
$this
->assertSame($expected, $this->migration
->getProcess());
}
}