3 namespace Drupal\Tests\file\Unit\Plugin\migrate\field\d7;
5 use Drupal\migrate\Plugin\MigrationInterface;
6 use Drupal\Tests\UnitTestCase;
7 use Drupal\file\Plugin\migrate\field\d7\ImageField;
11 * @coversDefaultClass \Drupal\file\Plugin\migrate\field\d7\ImageField
15 class ImageFieldTest extends UnitTestCase {
18 * @var \Drupal\migrate_drupal\Plugin\MigrateFieldInterface
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 processFieldValues() 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 ::processFieldValues
48 * @expectedDeprecation ImageField is deprecated in Drupal 8.5.x and will be removed before Drupal 9.0.x. Use \Drupal\image\Plugin\migrate\field\d7\ImageField instead. See https://www.drupal.org/node/2936061.
50 public function testProcessFieldValues() {
51 $this->plugin->processFieldValues($this->migration, 'somefieldname', []);
54 'plugin' => 'sub_process',
55 'source' => 'somefieldname',
64 $this->assertSame($expected, $this->migration->getProcess());