You are here

public function FieldInstanceSettingsTest::testTransformImageSettings in Zircon Profile 8.0

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

Tests transformation of image field settings.

@covers ::transform

File

core/modules/field/tests/src/Unit/Plugin/migrate/process/d7/FieldInstanceSettingsTest.php, line 27
Contains \Drupal\Tests\field\Unit\Plugin\migrate\process\d7\FieldInstanceSettingsTest.

Class

FieldInstanceSettingsTest
@coversDefaultClass \Drupal\field\Plugin\migrate\process\d7\FieldInstanceSettings @group field

Namespace

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

Code

public function testTransformImageSettings() {
  $migration = $this
    ->getMock(MigrationInterface::class);
  $plugin = new FieldInstanceSettings([], 'd7_field_instance_settings', [], $migration);
  $executable = $this
    ->getMock(MigrateExecutableInterface::class);
  $row = $this
    ->getMockBuilder(Row::class)
    ->disableOriginalConstructor()
    ->getMock();
  $value = $plugin
    ->transform([
    [],
    [
      'type' => 'image_image',
    ],
  ], $executable, $row, 'foo');
  $this
    ->assertInternalType('array', $value['default_image']);
  $this
    ->assertSame('', $value['default_image']['alt']);
  $this
    ->assertSame('', $value['default_image']['title']);
  $this
    ->assertNull($value['default_image']['width']);
  $this
    ->assertNull($value['default_image']['height']);
  $this
    ->assertSame('', $value['default_image']['uuid']);
}