function TextCckTest::testProcessBooleanTextExplicitValues

Same name in this branch
  1. 8.9.x core/modules/text/tests/src/Unit/Migrate/TextCckTest.php \Drupal\Tests\text\Unit\Migrate\TextCckTest::testProcessBooleanTextExplicitValues()

@covers ::processCckFieldValues

File

core/modules/text/tests/src/Unit/Plugin/migrate/cckfield/TextCckTest.php, line 99

Class

TextCckTest
@coversDefaultClass \Drupal\text\Plugin\migrate\cckfield\TextField @group text @group legacy

Namespace

Drupal\Tests\text\Unit\Plugin\migrate\cckfield

Code

public function testProcessBooleanTextExplicitValues() {
    $info = [
        'widget_type' => 'optionwidgets_onoff',
        'global_settings' => [
            'allowed_values' => "foo|Foo\nbaz|Baz",
        ],
    ];
    $this->plugin
        ->processCckFieldValues($this->migration, 'field', $info);
    $expected = [
        'value' => [
            'plugin' => 'static_map',
            'source' => 'value',
            'default_value' => 0,
            'map' => [
                'baz' => 1,
            ],
        ],
    ];
    $this->assertSame($expected, $this->migration
        ->getProcess()['process']);
}

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