function MigrateLanguageTest::assertLanguage

Same name in other branches
  1. 9 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.

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 32

Class

MigrateLanguageTest
@group migrate_drupal_6

Namespace

Drupal\Tests\language\Kernel\Migrate\d6

Code

protected function assertLanguage($id, $label, $direction = ConfigurableLanguageInterface::DIRECTION_LTR, $weight = 0) {
    
    /** @var \Drupal\language\ConfigurableLanguageInterface $language */
    $language = ConfigurableLanguage::load($id);
    $this->assertInstanceOf(ConfigurableLanguageInterface::class, $language);
    $this->assertIdentical($label, $language->label());
    $this->assertIdentical($direction, $language->getDirection());
    $this->assertIdentical(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.