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();
47 public function testProcessCckFieldValues() {
48 $this->testDefineValueProcessPipeline('processCckFieldValues');
52 * @covers ::defineValueProcessPipeline
54 public function testDefineValueProcessPipeline($method = 'defineValueProcessPipeline') {
55 $this->plugin->$method($this->migration, 'somefieldname', []);
58 'plugin' => 'sub_process',
59 'source' => 'somefieldname',
64 $this->assertSame($expected, $this->migration->getProcess());