function LocaleBuildTest::testLocaleTranslationGetProjects

Tests deprecated function locale_translation_get_projects().

Attributes

#[IgnoreDeprecations]

File

core/modules/locale/tests/src/Kernel/LocaleBuildTest.php, line 77

Class

LocaleBuildTest
Tests building the translatable project information.

Namespace

Drupal\Tests\locale\Kernel

Code

public function testLocaleTranslationGetProjects() : void {
  \Drupal::state()->set('locale.test_system_info_alter', TRUE);
  $this->expectUserDeprecationMessage('locale_translation_get_projects() is deprecated in drupal:11.4.0 and is removed from drupal:13.0.0. Use \\Drupal::service(LocaleProjectRepository::class)->getAll() or \\Drupal::service(LocaleProjectRepository::class)->getMultiple($project_names) instead. See https://www.drupal.org/node/3569330');
  $this->container
    ->get('module_handler')
    ->loadInclude('locale', 'translation.inc');
  $this->assertCount(2, locale_translation_get_projects());
  $this->assertCount(1, locale_translation_get_projects([
    'locale_test',
  ]));
  $this->assertCount(0, locale_translation_get_projects([
    'does_not_exist',
  ]));
}

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