class FieldLanguageTest in Drupal 10
Same name and namespace in other branches
- 8 core/modules/language/tests/src/Kernel/Views/FieldLanguageTest.php \Drupal\Tests\language\Kernel\Views\FieldLanguageTest
- 9 core/modules/language/tests/src/Kernel/Views/FieldLanguageTest.php \Drupal\Tests\language\Kernel\Views\FieldLanguageTest
Tests the field language handler.
@group language
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\language\Kernel\Views\FieldLanguageTest
- class \Drupal\Tests\language\Kernel\Views\LanguageTestBase
- class \Drupal\Tests\views\Kernel\ViewsKernelTestBase uses ViewResultAssertionTrait
Expanded class hierarchy of FieldLanguageTest
See also
\Drupal\language\Plugin\views\field\Language
File
- core/
modules/ language/ tests/ src/ Kernel/ Views/ FieldLanguageTest.php, line 13
Namespace
Drupal\Tests\language\Kernel\ViewsView source
class FieldLanguageTest extends LanguageTestBase {
/**
* Views used by this test.
*
* @var array
*/
public static $testViews = [
'test_view',
];
/**
* Tests the language field.
*/
public function testField() {
$view = Views::getView('test_view');
$view
->setDisplay();
$view->displayHandlers
->get('default')
->overrideOption('fields', [
'langcode' => [
'id' => 'langcode',
'table' => 'views_test_data',
'field' => 'langcode',
],
]);
$this
->executeView($view);
$this
->assertEquals('English', $view->field['langcode']
->advancedRender($view->result[0]));
$this
->assertEquals('Lolspeak', $view->field['langcode']
->advancedRender($view->result[1]));
}
}