ConfigurableLanguageTest.php

Same filename in this branch
  1. 9 core/modules/jsonapi/tests/src/Functional/ConfigurableLanguageTest.php
Same filename in other branches
  1. 8.9.x core/modules/language/tests/src/Kernel/ConfigurableLanguageTest.php
  2. 8.9.x core/modules/jsonapi/tests/src/Functional/ConfigurableLanguageTest.php
  3. 10 core/modules/language/tests/src/Kernel/ConfigurableLanguageTest.php
  4. 10 core/modules/jsonapi/tests/src/Functional/ConfigurableLanguageTest.php
  5. 11.x core/modules/language/tests/src/Kernel/ConfigurableLanguageTest.php
  6. 11.x core/modules/jsonapi/tests/src/Functional/ConfigurableLanguageTest.php

Namespace

Drupal\Tests\language\Kernel

File

core/modules/language/tests/src/Kernel/ConfigurableLanguageTest.php

View source
<?php

namespace Drupal\Tests\language\Kernel;

use Drupal\KernelTests\KernelTestBase;
use Drupal\language\Entity\ConfigurableLanguage;

/**
 * Tests the ConfigurableLanguage entity.
 *
 * @group language
 * @see \Drupal\language\Entity\ConfigurableLanguage.
 */
class ConfigurableLanguageTest extends KernelTestBase {
    
    /**
     * Modules to enable.
     *
     * @var array
     */
    protected static $modules = [
        'language',
    ];
    
    /**
     * Tests configurable language name methods.
     */
    public function testName() {
        $name = $this->randomMachineName();
        $language_code = $this->randomMachineName(2);
        $configurableLanguage = new ConfigurableLanguage([
            'label' => $name,
            'id' => $language_code,
        ], 'configurable_language');
        $this->assertEquals($name, $configurableLanguage->getName());
        $this->assertEquals('Test language', $configurableLanguage->setName('Test language')
            ->getName());
    }

}

Classes

Title Deprecated Summary
ConfigurableLanguageTest Tests the ConfigurableLanguage entity.

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