3 namespace Drupal\Tests\file\Unit\Plugin\migrate\cckfield\d7;
5 use Drupal\migrate\Plugin\MigrationInterface;
6 use Drupal\Tests\UnitTestCase;
7 use Drupal\file\Plugin\migrate\cckfield\d7\ImageField;
11 * @coversDefaultClass \Drupal\file\Plugin\migrate\cckfield\d7\ImageField
15 class ImageCckTest extends UnitTestCase {
18 * @var \Drupal\migrate_drupal\Plugin\MigrateCckFieldInterface
23 * @var \Drupal\migrate\Plugin\MigrationInterface
30 protected function setUp() {
31 $this->plugin = new ImageField([], 'image', []);
33 $migration = $this->prophesize(MigrationInterface::class);
35 // The plugin's defineValueProcessPipeline() method will call
36 // mergeProcessOfProperty() and return nothing. So, in order to examine the
37 // process pipeline created by the plugin, we need to ensure that
38 // getProcess() always returns the last input to mergeProcessOfProperty().
39 $migration->mergeProcessOfProperty(Argument::type('string'), Argument::type('array'))
40 ->will(function ($arguments) use ($migration) {
41 $migration->getProcess()->willReturn($arguments[1]);
43 $this->migration = $migration->reveal();
47 * @covers ::processCckFieldValues
49 public function testProcessCckFieldValues() {
50 $this->plugin->processCckFieldValues($this->migration, 'somefieldname', []);
53 'plugin' => 'sub_process',
54 'source' => 'somefieldname',
63 $this->assertSame($expected, $this->migration->getProcess());