function FieldSettingsTest::testTransformImageSettings

Same name in other branches
  1. 9 core/modules/field/tests/src/Unit/Plugin/migrate/process/d7/FieldSettingsTest.php \Drupal\Tests\field\Unit\Plugin\migrate\process\d7\FieldSettingsTest::testTransformImageSettings()
  2. 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()
  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 24

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() : void {
    $migration = $this->createMock(MigrationInterface::class);
    $plugin = new FieldSettings([], 'd7_field_settings', []);
    $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.