You are here

public function ConfigurableLanguageUnitTest::testWeight in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/language/tests/src/Unit/ConfigurableLanguageUnitTest.php \Drupal\Tests\language\Unit\ConfigurableLanguageUnitTest::testWeight()

@covers ::getWeight @covers ::setWeight

File

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

Class

ConfigurableLanguageUnitTest
Tests the ConfigurableLanguage entity class.

Namespace

Drupal\Tests\language\Unit

Code

public function testWeight() {

  // The weight, an integer. Used to order languages with larger positive
  // weights sinking items toward the bottom of lists.
  $configurableLanguage = new ConfigurableLanguage([
    'weight' => -5,
  ], 'configurable_language');
  $this
    ->assertEquals(-5, $configurableLanguage
    ->getWeight());
  $this
    ->assertEquals(13, $configurableLanguage
    ->setWeight(13)
    ->getWeight());
}