3 namespace Drupal\Tests\taxonomy\Unit\Plugin\migrate\cckfield;
5 use Drupal\migrate\Plugin\MigrationInterface;
6 use Drupal\Tests\UnitTestCase;
7 use Drupal\taxonomy\Plugin\migrate\cckfield\TaxonomyTermReference;
11 * @coversDefaultClass \Drupal\taxonomy\Plugin\migrate\cckfield\TaxonomyTermReference
15 class TaxonomyTermReferenceCckTest extends UnitTestCase {
18 * @var \Drupal\migrate_drupal\Plugin\MigrateCckFieldInterface
23 * @var \Drupal\migrate\Plugin\MigrationInterface
30 protected function setUp() {
31 $this->plugin = new TaxonomyTermReference([], 'taxonomy', []);
33 $migration = $this->prophesize(MigrationInterface::class);
35 // The plugin's processCckFieldValues() method will call
36 // setProcessOfProperty() and return nothing. So, in order to examine the
37 // process pipeline created by the plugin, we need to ensure that
38 // getProcess() always returns the last input to setProcessOfProperty().
39 $migration->setProcessOfProperty(Argument::type('string'), Argument::type('array'))
40 ->will(function ($arguments) use ($migration) {
41 $migration->getProcess()->willReturn($arguments[1]);
44 $this->migration = $migration->reveal();
48 * @covers ::processCckFieldValues
50 public function testProcessCckFieldValues() {
51 $this->plugin->processFieldValues($this->migration, 'somefieldname', []);
54 'plugin' => 'sub_process',
55 'source' => 'somefieldname',
60 $this->assertSame($expected, $this->migration->getProcess());