ConfigurableLanguageUnitTest.php in Drupal 9
File
core/modules/language/tests/src/Unit/ConfigurableLanguageUnitTest.php
View source
<?php
namespace Drupal\Tests\language\Unit;
use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\Tests\UnitTestCase;
class ConfigurableLanguageUnitTest extends UnitTestCase {
public function testDirection() {
$configurableLanguage = new ConfigurableLanguage([
'direction' => ConfigurableLanguage::DIRECTION_LTR,
], 'configurable_language');
$this
->assertEquals(ConfigurableLanguage::DIRECTION_LTR, $configurableLanguage
->getDirection());
$configurableLanguage = new ConfigurableLanguage([
'direction' => ConfigurableLanguage::DIRECTION_RTL,
], 'configurable_language');
$this
->assertEquals(ConfigurableLanguage::DIRECTION_RTL, $configurableLanguage
->getDirection());
}
public function testWeight() {
$configurableLanguage = new ConfigurableLanguage([
'weight' => -5,
], 'configurable_language');
$this
->assertEquals(-5, $configurableLanguage
->getWeight());
$this
->assertEquals(13, $configurableLanguage
->setWeight(13)
->getWeight());
}
}