LinkCckTest.php in Drupal 8
File
core/modules/link/tests/src/Kernel/Plugin/migrate/cckfield/d7/LinkCckTest.php
View source
<?php
namespace Drupal\Tests\link\Kernel\Plugin\migrate\cckfield\d7;
use Drupal\KernelTests\KernelTestBase;
use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\link\Plugin\migrate\cckfield\d7\LinkField;
use Prophecy\Argument;
class LinkCckTest extends KernelTestBase {
protected static $modules = [
'system',
];
protected $plugin;
protected $migration;
protected function setUp() {
parent::setUp();
$this->plugin = new LinkField([], 'link', []);
$migration = $this
->prophesize(MigrationInterface::class);
$migration
->mergeProcessOfProperty(Argument::type('string'), Argument::type('array'))
->will(function ($arguments) use ($migration) {
$migration
->getProcess()
->willReturn($arguments[1]);
});
$this->migration = $migration
->reveal();
}
public function testAlterFieldInstanceMigration($method = 'alterFieldInstanceMigration') {
$this->plugin
->{$method}($this->migration);
$expected = [
'plugin' => 'static_map',
'source' => 'settings/title',
'bypass' => TRUE,
'map' => [
'disabled' => DRUPAL_DISABLED,
'optional' => DRUPAL_OPTIONAL,
'required' => DRUPAL_REQUIRED,
],
];
$this
->assertSame($expected, $this->migration
->getProcess());
}
}