class LocaleBatchTest
Tests locale batches.
@group locale
Hierarchy
- class \Drupal\KernelTests\KernelTestBase extends \Drupal\Core\DependencyInjection\ServiceProviderInterface uses \Drupal\KernelTests\AssertContentTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\ExtensionListTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\PhpUnitCompatibilityTrait, \Prophecy\PhpUnit\ProphecyTrait, \Drupal\TestTools\Extension\DeprecationBridge\ExpectDeprecationTrait implements \PHPUnit\Framework\TestCase
- class \Drupal\Tests\locale\Kernel\LocaleBatchTest implements \Drupal\KernelTests\KernelTestBase
Expanded class hierarchy of LocaleBatchTest
File
-
core/
modules/ locale/ tests/ src/ Kernel/ LocaleBatchTest.php, line 14
Namespace
Drupal\Tests\locale\KernelView source
class LocaleBatchTest extends KernelTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = [
'locale',
'system',
'language',
];
/**
* Checks that the import batch finishes if the translation has already been imported.
*/
public function testBuildProjects() : void {
$this->installConfig([
'locale',
]);
$this->installSchema('locale', [
'locale_file',
]);
$this->container
->get('module_handler')
->loadInclude('locale', 'batch.inc');
\Drupal::database()->insert('locale_file')
->fields([
'project' => 'drupal',
'langcode' => 'en',
'filename' => 'drupal.po',
'version' => \Drupal::VERSION,
'timestamp' => time(),
])
->execute();
$context = [];
locale_translation_batch_fetch_import('drupal', 'en', [], $context);
$this->assertEquals(1, $context['finished']);
$this->assertEquals('Ignoring already imported translation for drupal.', $context['message']);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.