FieldSettingsTest.php

Same filename in this branch
  1. 9 core/modules/field/tests/src/Unit/Plugin/migrate/process/d6/FieldSettingsTest.php
  2. 9 core/tests/Drupal/KernelTests/Core/Field/FieldSettingsTest.php
Same filename in other branches
  1. 8.9.x core/modules/field/tests/src/Unit/Plugin/migrate/process/d6/FieldSettingsTest.php
  2. 8.9.x core/modules/field/tests/src/Unit/Plugin/migrate/process/d7/FieldSettingsTest.php
  3. 8.9.x core/tests/Drupal/KernelTests/Core/Field/FieldSettingsTest.php
  4. 10 core/modules/field/tests/src/Unit/Plugin/migrate/process/d6/FieldSettingsTest.php
  5. 10 core/modules/field/tests/src/Unit/Plugin/migrate/process/d7/FieldSettingsTest.php
  6. 10 core/tests/Drupal/KernelTests/Core/Field/FieldSettingsTest.php
  7. 11.x core/modules/field/tests/src/Unit/Plugin/migrate/process/d6/FieldSettingsTest.php
  8. 11.x core/modules/field/tests/src/Unit/Plugin/migrate/process/d7/FieldSettingsTest.php
  9. 11.x core/tests/Drupal/KernelTests/Core/Field/FieldSettingsTest.php

Namespace

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

File

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

View source
<?php

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

use Drupal\field\Plugin\migrate\process\d7\FieldSettings;
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\FieldSettings
 * @group field
 */
class FieldSettingsTest extends MigrateTestCase {
    
    /**
     * Tests transformation of image field settings.
     *
     * @covers ::transform
     */
    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']);
    }

}

Classes

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

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