function FieldSettingsTest::testTransformImageSettings

Same name and namespace in other branches
  1. 8.9.x core/modules/field/tests/src/Unit/Plugin/migrate/process/d7/FieldSettingsTest.php \Drupal\Tests\field\Unit\Plugin\migrate\process\d7\FieldSettingsTest::testTransformImageSettings()
  2. 10 core/modules/field/tests/src/Unit/Plugin/migrate/process/d7/FieldSettingsTest.php \Drupal\Tests\field\Unit\Plugin\migrate\process\d7\FieldSettingsTest::testTransformImageSettings()
  3. 11.x 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 <a href="/api/drupal/core%21modules%21field%21src%21Plugin%21migrate%21process%21d7%21FieldSettings.php/class/FieldSettings/9" title="Plugin annotation @MigrateProcessPlugin( id = &quot;d7_field_settings&quot; )" class="local">\Drupal\field\Plugin\migrate\process\d7\FieldSettings</a> @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']);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.