You are here

public function FieldSettingsTest::testTransformImageSettings in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/field/tests/src/Unit/Plugin/migrate/process/d7/FieldSettingsTest.php \Drupal\Tests\field\Unit\Plugin\migrate\process\d7\FieldSettingsTest::testTransformImageSettings()

Tests transformation of image field settings.

@covers ::transform

File

core/modules/field/tests/src/Unit/Plugin/migrate/process/d7/FieldSettingsTest.php, line 22

Class

FieldSettingsTest
@coversDefaultClass \Drupal\field\Plugin\migrate\process\d7\FieldSettings @group field

Namespace

Drupal\Tests\field\Unit\Plugin\migrate\process\d7

Code

public function testTransformImageSettings() {
  $migration = $this
    ->createMock(MigrationInterface::class);
  $plugin = new FieldSettings([], 'd7_field_settings', [], $migration);
  $executable = $this
    ->createMock(MigrateExecutableInterface::class);
  $row = $this
    ->getMockBuilder(Row::class)
    ->disableOriginalConstructor()
    ->getMock();
  $row
    ->expects($this
    ->atLeastOnce())
    ->method('getSourceProperty')
    ->willReturnMap([
    [
      'settings',
      [
        'default_image' => NULL,
      ],
    ],
    [
      'type',
      'image',
    ],
  ]);
  $value = $plugin
    ->transform([], $executable, $row, 'foo');
  $this
    ->assertIsArray($value);
  $this
    ->assertSame('', $value['default_image']['uuid']);
}