function ConfigurableLanguageUnitTest::testDirection

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

@covers ::getDirection

File

core/modules/language/tests/src/Unit/ConfigurableLanguageUnitTest.php, line 20

Class

ConfigurableLanguageUnitTest
Tests the ConfigurableLanguage entity class.

Namespace

Drupal\Tests\language\Unit

Code

public function testDirection() {
    // Direction of language writing, an integer. Usually either
    // ConfigurableLanguage::DIRECTION_LTR or
    // ConfigurableLanguage::DIRECTION_RTL.
    $configurableLanguage = new ConfigurableLanguage([
        'direction' => ConfigurableLanguage::DIRECTION_LTR,
    ], 'configurable_language');
    $this->assertEquals(ConfigurableLanguage::DIRECTION_LTR, $configurableLanguage->getDirection());
    // Test direction again, setting direction to RTL.
    $configurableLanguage = new ConfigurableLanguage([
        'direction' => ConfigurableLanguage::DIRECTION_RTL,
    ], 'configurable_language');
    $this->assertEquals(ConfigurableLanguage::DIRECTION_RTL, $configurableLanguage->getDirection());
}

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