You are here

public function ConfigurableLanguageUnitTest::testDirection in Drupal 8

Same name and namespace in other branches
  1. 9 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());
}