function MigrateLanguageTest::assertLanguage

Same name in other branches
  1. 8.9.x core/modules/language/tests/src/Kernel/Migrate/d6/MigrateLanguageTest.php \Drupal\Tests\language\Kernel\Migrate\d6\MigrateLanguageTest::assertLanguage()
  2. 10 core/modules/language/tests/src/Kernel/Migrate/d6/MigrateLanguageTest.php \Drupal\Tests\language\Kernel\Migrate\d6\MigrateLanguageTest::assertLanguage()
  3. 11.x core/modules/language/tests/src/Kernel/Migrate/d6/MigrateLanguageTest.php \Drupal\Tests\language\Kernel\Migrate\d6\MigrateLanguageTest::assertLanguage()

Asserts various properties of a configurable language entity.

@internal

Parameters

string $id: The language ID.

string $label: The language name.

string $direction: (optional) The language's direction (one of the DIRECTION_* constants in ConfigurableLanguageInterface). Defaults to LTR.

int $weight: (optional) The weight of the language. Defaults to 0.

1 call to MigrateLanguageTest::assertLanguage()
MigrateLanguageTest::testLanguageMigration in core/modules/language/tests/src/Kernel/Migrate/d6/MigrateLanguageTest.php
Tests migration of Drupal 6 languages to configurable language entities.

File

core/modules/language/tests/src/Kernel/Migrate/d6/MigrateLanguageTest.php, line 34

Class

MigrateLanguageTest
@group migrate_drupal_6

Namespace

Drupal\Tests\language\Kernel\Migrate\d6

Code

protected function assertLanguage(string $id, string $label, string $direction = ConfigurableLanguageInterface::DIRECTION_LTR, int $weight = 0) : void {
    
    /** @var \Drupal\language\ConfigurableLanguageInterface $language */
    $language = ConfigurableLanguage::load($id);
    $this->assertInstanceOf(ConfigurableLanguageInterface::class, $language);
    $this->assertSame($label, $language->label());
    $this->assertSame($direction, $language->getDirection());
    $this->assertSame(0, $language->getWeight());
    $this->assertFalse($language->isLocked());
}

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