LinkFieldTest.php in Drupal 8
File
core/modules/link/tests/src/Unit/Plugin/migrate/field/d6/LinkFieldTest.php
View source
<?php
namespace Drupal\Tests\link\Unit\Plugin\migrate\field\d6;
use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\Tests\UnitTestCase;
use Drupal\link\Plugin\migrate\field\d6\LinkField;
use Prophecy\Argument;
class LinkFieldTest extends UnitTestCase {
protected $plugin;
protected $migration;
protected function 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 testDefineValueProcessPipeline($method = 'defineValueProcessPipeline') {
$this->plugin
->{$method}($this->migration, 'somefieldname', []);
$expected = [
'plugin' => 'field_link',
'source' => 'somefieldname',
];
$this
->assertSame($expected, $this->migration
->getProcess());
}
}