abstract class LanguageTestBase in Drupal 10
Same name in this branch
- 10 core/modules/language/tests/src/Kernel/LanguageTestBase.php \Drupal\Tests\language\Kernel\LanguageTestBase
- 10 core/modules/language/tests/src/Kernel/Views/LanguageTestBase.php \Drupal\Tests\language\Kernel\Views\LanguageTestBase
Same name and namespace in other branches
- 8 core/modules/language/tests/src/Kernel/Views/LanguageTestBase.php \Drupal\Tests\language\Kernel\Views\LanguageTestBase
- 9 core/modules/language/tests/src/Kernel/Views/LanguageTestBase.php \Drupal\Tests\language\Kernel\Views\LanguageTestBase
Defines the base class for all Language handler tests.
Hierarchy
- class \Drupal\KernelTests\KernelTestBase extends \PHPUnit\Framework\TestCase implements ServiceProviderInterface uses \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, AssertContentTrait, ConfigTestTrait, ExtensionListTestTrait, RandomGeneratorTrait, TestRequirementsTrait, PhpUnitWarnings
- class \Drupal\Tests\views\Kernel\ViewsKernelTestBase uses ViewResultAssertionTrait
- class \Drupal\Tests\language\Kernel\Views\LanguageTestBase
- class \Drupal\Tests\views\Kernel\ViewsKernelTestBase uses ViewResultAssertionTrait
Expanded class hierarchy of LanguageTestBase
File
- core/
modules/ language/ tests/ src/ Kernel/ Views/ LanguageTestBase.php, line 11
Namespace
Drupal\Tests\language\Kernel\ViewsView source
abstract class LanguageTestBase extends ViewsKernelTestBase {
/**
* Modules to enable.
*
* @var array
*/
protected static $modules = [
'system',
'language',
];
protected function setUp($import_test_views = TRUE) : void {
parent::setUp();
$this
->installConfig([
'language',
]);
// Create another language beside English.
ConfigurableLanguage::create([
'id' => 'xx-lolspeak',
'label' => 'Lolspeak',
])
->save();
}
/**
* {@inheritdoc}
*/
protected function schemaDefinition() {
$schema = parent::schemaDefinition();
$schema['views_test_data']['fields']['langcode'] = [
'description' => 'The {language}.langcode of this beatle.',
'type' => 'varchar',
'length' => 12,
'default' => '',
];
return $schema;
}
/**
* {@inheritdoc}
*/
protected function viewsData() {
$data = parent::viewsData();
$data['views_test_data']['langcode'] = [
'title' => t('Langcode'),
'help' => t('Langcode'),
'field' => [
'id' => 'language',
],
'argument' => [
'id' => 'language',
],
'filter' => [
'id' => 'language',
],
];
return $data;
}
/**
* {@inheritdoc}
*/
protected function dataSet() {
$data = parent::dataSet();
$data[0]['langcode'] = 'en';
$data[1]['langcode'] = 'xx-lolspeak';
$data[2]['langcode'] = '';
$data[3]['langcode'] = '';
$data[4]['langcode'] = '';
return $data;
}
}