LanguageTestBase.php in Zircon Profile 8
File
core/modules/language/src/Tests/Views/LanguageTestBase.php
View source
<?php
namespace Drupal\language\Tests\Views;
use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\views\Tests\ViewKernelTestBase;
abstract class LanguageTestBase extends ViewKernelTestBase {
public static $modules = array(
'system',
'language',
);
protected function setUp() {
parent::setUp();
$this
->installConfig(array(
'language',
));
ConfigurableLanguage::create(array(
'id' => 'xx-lolspeak',
'label' => 'Lolspeak',
))
->save();
}
protected function schemaDefinition() {
$schema = parent::schemaDefinition();
$schema['views_test_data']['fields']['langcode'] = array(
'description' => 'The {language}.langcode of this beatle.',
'type' => 'varchar',
'length' => 12,
'default' => '',
);
return $schema;
}
protected function viewsData() {
$data = parent::viewsData();
$data['views_test_data']['langcode'] = array(
'title' => t('Langcode'),
'help' => t('Langcode'),
'field' => array(
'id' => 'language',
),
'argument' => array(
'id' => 'language',
),
'filter' => array(
'id' => 'language',
),
);
return $data;
}
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;
}
}