You are here

public function LanguageDomainsTest::testTransform in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/language/tests/src/Unit/process/LanguageDomainsTest.php \Drupal\Tests\language\Unit\process\LanguageDomainsTest::testTransform()
  2. 9 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);
}