FieldInstanceSettingsTest.php

Same filename in this branch
  1. 9 core/modules/field/tests/src/Unit/Plugin/migrate/process/d6/FieldInstanceSettingsTest.php
Same filename in other branches
  1. 8.9.x core/modules/field/tests/src/Unit/Plugin/migrate/process/d7/FieldInstanceSettingsTest.php
  2. 10 core/modules/field/tests/src/Unit/Plugin/migrate/process/d6/FieldInstanceSettingsTest.php
  3. 10 core/modules/field/tests/src/Unit/Plugin/migrate/process/d7/FieldInstanceSettingsTest.php
  4. 11.x core/modules/field/tests/src/Unit/Plugin/migrate/process/d6/FieldInstanceSettingsTest.php
  5. 11.x core/modules/field/tests/src/Unit/Plugin/migrate/process/d7/FieldInstanceSettingsTest.php

Namespace

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

File

core/modules/field/tests/src/Unit/Plugin/migrate/process/d7/FieldInstanceSettingsTest.php

View source
<?php

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

use Drupal\field\Plugin\migrate\process\d7\FieldInstanceSettings;
use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\migrate\MigrateExecutableInterface;
use Drupal\migrate\Row;
use Drupal\Tests\migrate\Unit\MigrateTestCase;

/**
 * @coversDefaultClass \Drupal\field\Plugin\migrate\process\d7\FieldInstanceSettings
 * @group field
 */
class FieldInstanceSettingsTest extends MigrateTestCase {
    
    /**
     * Tests transformation of image field settings.
     *
     * @covers ::transform
     */
    public function testTransformImageSettings() {
        $migration = $this->createMock(MigrationInterface::class);
        $plugin = new FieldInstanceSettings([], 'd7_field_instance_settings', [], $migration);
        $executable = $this->createMock(MigrateExecutableInterface::class);
        $row = $this->getMockBuilder(Row::class)
            ->disableOriginalConstructor()
            ->getMock();
        $value = $plugin->transform([
            [],
            [
                'type' => 'image_image',
            ],
            [
                'data' => '',
            ],
        ], $executable, $row, 'foo');
        $this->assertIsArray($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']);
    }

}

Classes

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

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