function LanguageDomainsTest::testTransform

Same name in other branches
  1. 9 core/modules/language/tests/src/Unit/process/LanguageDomainsTest.php \Drupal\Tests\language\Unit\process\LanguageDomainsTest::testTransform()
  2. 10 core/modules/language/tests/src/Unit/process/LanguageDomainsTest.php \Drupal\Tests\language\Unit\process\LanguageDomainsTest::testTransform()
  3. 11.x core/modules/language/tests/src/Unit/process/LanguageDomainsTest.php \Drupal\Tests\language\Unit\process\LanguageDomainsTest::testTransform()

@covers ::transform

File

core/modules/language/tests/src/Unit/process/LanguageDomainsTest.php, line 45

Class

LanguageDomainsTest
@coversDefaultClass \Drupal\language\Plugin\migrate\process\LanguageDomains @group language

Namespace

Drupal\Tests\language\Unit\process

Code

public function testTransform() {
    $source = [
        [
            'language' => 'en',
            'domain' => '',
        ],
        [
            'language' => 'fr',
            'domain' => 'fr.example.com',
        ],
        [
            'language' => 'es',
            'domain' => 'http://es.example.com',
        ],
        [
            'language' => 'hu',
            'domain' => 'https://hu.example.com',
        ],
    ];
    $expected = [
        'en' => 'example.com',
        'fr' => 'fr.example.com',
        'es' => 'es.example.com',
        'hu' => 'hu.example.com',
    ];
    $value = $this->plugin
        ->transform($source, $this->migrateExecutable, $this->row, 'destination_property');
    $this->assertSame($value, $expected);
}

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