3 namespace Drupal\Tests\link\Kernel\Plugin\migrate\field\d7;
5 use Drupal\KernelTests\KernelTestBase;
6 use Drupal\migrate\Plugin\MigrationInterface;
7 use Drupal\link\Plugin\migrate\field\d7\LinkField;
11 * @coversDefaultClass \Drupal\link\Plugin\migrate\field\d7\LinkField
14 class LinkFieldTest extends KernelTestBase {
19 protected static $modules = ['system'];
22 * @var \Drupal\migrate_drupal\Plugin\MigrateFieldInterface
27 * @var \Drupal\migrate\Plugin\MigrationInterface
34 protected function setUp() {
37 $this->plugin = new LinkField([], 'link', []);
39 $migration = $this->prophesize(MigrationInterface::class);
41 // The plugin's ProcessFieldInstance() method will call
42 // mergeProcessOfProperty() and return nothing. So, in order to examine the
43 // process pipeline created by the plugin, we need to ensure that
44 // getProcess() always returns the last input to mergeProcessOfProperty().
45 $migration->mergeProcessOfProperty(Argument::type('string'), Argument::type('array'))
46 ->will(function ($arguments) use ($migration) {
47 $migration->getProcess()->willReturn($arguments[1]);
50 $this->migration = $migration->reveal();
54 * @covers ::processFieldInstance
56 public function testProcessFieldInstance() {
57 $this->plugin->processFieldInstance($this->migration);
60 'plugin' => 'static_map',
61 'source' => 'settings/title',
64 'disabled' => DRUPAL_DISABLED,
65 'optional' => DRUPAL_OPTIONAL,
66 'required' => DRUPAL_REQUIRED,
69 $this->assertSame($expected, $this->migration->getProcess());