3 namespace Drupal\Tests\taxonomy\Unit\Plugin\migrate\field;
5 use Drupal\migrate\Plugin\MigrationInterface;
6 use Drupal\Tests\UnitTestCase;
7 use Drupal\taxonomy\Plugin\migrate\field\TaxonomyTermReference;
11 * @coversDefaultClass \Drupal\taxonomy\Plugin\migrate\field\TaxonomyTermReference
14 class TaxonomyTermReferenceFieldTest extends UnitTestCase {
17 * @var \Drupal\migrate_drupal\Plugin\MigrateFieldInterface
22 * @var \Drupal\migrate\Plugin\MigrationInterface
29 protected function setUp() {
30 $this->plugin = new TaxonomyTermReference([], 'taxonomy', []);
32 $migration = $this->prophesize(MigrationInterface::class);
34 // The plugin's processFieldValues() method will call
35 // setProcessOfProperty() and return nothing. So, in order to examine the
36 // process pipeline created by the plugin, we need to ensure that
37 // getProcess() always returns the last input to setProcessOfProperty().
38 $migration->setProcessOfProperty(Argument::type('string'), Argument::type('array'))
39 ->will(function ($arguments) use ($migration) {
40 $migration->getProcess()->willReturn($arguments[1]);
43 $this->migration = $migration->reveal();
47 * @covers ::processFieldValues
49 public function testProcessFieldValues() {
50 $this->plugin->processFieldValues($this->migration, 'somefieldname', []);
53 'plugin' => 'sub_process',
54 'source' => 'somefieldname',
59 $this->assertSame($expected, $this->migration->getProcess());