function LocaleTest::testConfig

Tests deprecation of config() method.

@covers ::config @group legacy

File

core/modules/locale/tests/src/Unit/LocaleTest.php, line 24

Class

LocaleTest
@coversDefaultClass \Drupal\locale\Locale @group Cache

Namespace

Drupal\Tests\locale\Unit

Code

public function testConfig() : void {
    $config_manager = $this->prophesize(LocaleConfigManager::class);
    $container = $this->prophesize(Container::class);
    $container->get('locale.config_manager')
        ->willReturn($config_manager->reveal());
    \Drupal::setContainer($container->reveal());
    $this->expectDeprecation('The Drupal\\locale\\Locale is deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. There is no replacement. See https://www.drupal.org/node/3437110');
    $this->expectDeprecation('Drupal\\locale\\Locale::config() is deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. Use \\Drupal::service(\'locale.config_manager\') instead. See https://www.drupal.org/node/3437110');
    $this->assertInstanceOf(LocaleConfigManager::class, Locale::config());
}

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