function ConfigurableLanguageUnitTest::testWeight

Same name in other branches
  1. 8.9.x core/modules/language/tests/src/Unit/ConfigurableLanguageUnitTest.php \Drupal\Tests\language\Unit\ConfigurableLanguageUnitTest::testWeight()
  2. 10 core/modules/language/tests/src/Unit/ConfigurableLanguageUnitTest.php \Drupal\Tests\language\Unit\ConfigurableLanguageUnitTest::testWeight()
  3. 11.x 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());
}

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