class LocaleBulkDeprecationTest
Tests locale.bulk.inc.
@group locale
Hierarchy
- class \Drupal\Tests\UnitTestCase extends \PHPUnit\Framework\TestCase uses \Drupal\Tests\PhpUnitCompatibilityTrait, \Prophecy\PhpUnit\ProphecyTrait, \Drupal\TestTools\Extension\DeprecationBridge\ExpectDeprecationTrait, \Drupal\Tests\RandomGeneratorTrait
- class \Drupal\Tests\locale\Unit\LocaleBulkDeprecationTest extends \Drupal\Tests\UnitTestCase
Expanded class hierarchy of LocaleBulkDeprecationTest
File
-
core/
modules/ locale/ tests/ src/ Unit/ LocaleBulkDeprecationTest.php, line 15
Namespace
Drupal\Tests\locale\UnitView source
class LocaleBulkDeprecationTest extends UnitTestCase {
protected function setUp() : void {
parent::setUp();
$container = new ContainerBuilder();
$container->set('locale.config_manager', $this->createMock('Drupal\\locale\\LocaleConfigManager'));
$language_manager = $this->createMock('Drupal\\Core\\Language\\LanguageManagerInterface');
$language_manager->expects($this->any())
->method('getDefaultLanguage')
->willReturn($this->createMock('Drupal\\Core\\Language\\LanguageInterface'));
$container->set('language_manager', $language_manager);
\Drupal::setContainer($container);
include_once DRUPAL_ROOT . '/core/modules/locale/locale.bulk.inc';
}
/**
* Tests the deprecation of locale_config_batch_refresh_name().
*
* @group legacy
*
* @see locale_config_batch_refresh_name()
*/
public function testDeprecatedLocaleConfigBatchRefreshName() : void {
$this->expectDeprecation('locale_config_batch_refresh_name() is deprecated in drupal:11.1.0 and is removed from drupal:12.0.0. Use locale_config_batch_update_config_translations() instead. See https://www.drupal.org/node/3475054');
$names = [
'English',
'German',
];
$langcodes = [
'en',
'de',
];
locale_config_batch_refresh_name($names, $langcodes, $context);
}
/**
* Tests the deprecation of locale_config_batch_set_config_langcodes().
*
* @group legacy
*
* @see locale_config_batch_set_config_langcodes()
*/
public function testDeprecatedLocaleConfigBatchSetConfigLangcodes() : void {
$this->expectDeprecation('locale_config_batch_set_config_langcodes() is deprecated in drupal:11.1.0 and is removed from drupal:12.0.0. Use locale_config_batch_update_default_config_langcodes() instead. See https://www.drupal.org/node/3475054');
$context = [];
locale_config_batch_set_config_langcodes($context);
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title |
---|---|---|---|---|
ExpectDeprecationTrait::expectDeprecation | public | function | Adds an expected deprecation. | |
ExpectDeprecationTrait::getCallableName | private static | function | Returns a callable as a string suitable for inclusion in a message. | |
ExpectDeprecationTrait::setUpErrorHandler | public | function | Sets up the test error handler. | |
ExpectDeprecationTrait::tearDownErrorHandler | public | function | Tears down the test error handler. | |
LocaleBulkDeprecationTest::setUp | protected | function | Overrides UnitTestCase::setUp | |
LocaleBulkDeprecationTest::testDeprecatedLocaleConfigBatchRefreshName | public | function | Tests the deprecation of locale_config_batch_refresh_name(). | |
LocaleBulkDeprecationTest::testDeprecatedLocaleConfigBatchSetConfigLangcodes | public | function | Tests the deprecation of locale_config_batch_set_config_langcodes(). | |
RandomGeneratorTrait::getRandomGenerator | protected | function | Gets the random generator for the utility methods. | |
RandomGeneratorTrait::randomMachineName | protected | function | Generates a unique random string containing letters and numbers. | |
RandomGeneratorTrait::randomObject | public | function | Generates a random PHP object. | |
RandomGeneratorTrait::randomString | public | function | Generates a pseudo-random string of ASCII characters of codes 32 to 126. | |
UnitTestCase::$root | protected | property | The app root. | |
UnitTestCase::getClassResolverStub | protected | function | Returns a stub class resolver. | |
UnitTestCase::getConfigFactoryStub | public | function | Returns a stub config factory that behaves according to the passed array. | |
UnitTestCase::getConfigStorageStub | public | function | Returns a stub config storage that returns the supplied configuration. | |
UnitTestCase::getContainerWithCacheTagsInvalidator | protected | function | Sets up a container with a cache tags invalidator. | |
UnitTestCase::getStringTranslationStub | public | function | Returns a stub translation manager that just returns the passed string. | |
UnitTestCase::setUpBeforeClass | public static | function |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.