TaxonomyTermReferenceFieldTest.php in Drupal 8
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() {
$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, 'somefieldname', []);
$expected = [
'plugin' => 'sub_process',
'source' => 'somefieldname',
'process' => [
'target_id' => 'tid',
],
];
$this
->assertSame($expected, $this->migration
->getProcess());
}
}