function ConfigurableLanguageUnitTest::testWeight

Same name in other branches
  1. 9 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($configurableLanguage->getWeight(), -5);
    $this->assertEquals($configurableLanguage->setWeight(13)
        ->getWeight(), 13);
}

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