LanguageTestBase.php

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

Namespace

Drupal\Tests\language\Kernel

File

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

View source
<?php

namespace Drupal\Tests\language\Kernel;

use Drupal\KernelTests\KernelTestBase;

/**
 * Test for dependency injected language object.
 */
abstract class LanguageTestBase extends KernelTestBase {
    protected static $modules = [
        'system',
        'language',
        'language_test',
    ];
    
    /**
     * The language manager.
     *
     * @var \Drupal\Core\Language\LanguageManagerInterface
     */
    protected $languageManager;
    
    /**
     * The state storage service.
     *
     * @var \Drupal\Core\State\StateInterface
     */
    protected $state;
    
    /**
     * {@inheritdoc}
     */
    protected function setUp() {
        parent::setUp();
        $this->installConfig([
            'language',
        ]);
        $this->state = $this->container
            ->get('state');
        // Ensure we are building a new Language object for each test.
        $this->languageManager = $this->container
            ->get('language_manager');
        $this->languageManager
            ->reset();
    }

}

Classes

Title Deprecated Summary
LanguageTestBase Test for dependency injected language object.

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