3 namespace Drupal\Tests\link\Kernel\Plugin\migrate\cckfield\d7;
5 use Drupal\KernelTests\KernelTestBase;
6 use Drupal\migrate\Plugin\MigrationInterface;
7 use Drupal\link\Plugin\migrate\cckfield\d7\LinkField;
11 * @coversDefaultClass \Drupal\link\Plugin\migrate\cckfield\d7\LinkField
15 class LinkCckTest extends KernelTestBase {
20 protected static $modules = ['system'];
23 * @var \Drupal\migrate_drupal\Plugin\MigrateCckFieldInterface
28 * @var \Drupal\migrate\Plugin\MigrationInterface
35 protected function setUp() {
38 $this->plugin = new LinkField([], 'link', []);
40 $migration = $this->prophesize(MigrationInterface::class);
42 // The plugin's alterFieldInstanceMigration() method will call
43 // mergeProcessOfProperty() and return nothing. So, in order to examine the
44 // process pipeline created by the plugin, we need to ensure that
45 // getProcess() always returns the last input to mergeProcessOfProperty().
46 $migration->mergeProcessOfProperty(Argument::type('string'), Argument::type('array'))
47 ->will(function ($arguments) use ($migration) {
48 $migration->getProcess()->willReturn($arguments[1]);
51 $this->migration = $migration->reveal();
55 * @covers ::alterFieldInstanceMigration
57 public function testAlterFieldInstanceMigration($method = 'alterFieldInstanceMigration') {
58 $this->plugin->$method($this->migration);
61 'plugin' => 'static_map',
62 'source' => 'settings/title',
65 'disabled' => DRUPAL_DISABLED,
66 'optional' => DRUPAL_OPTIONAL,
67 'required' => DRUPAL_REQUIRED,
70 $this->assertSame($expected, $this->migration->getProcess());