class ArgumentLanguageTest in Drupal 10
Same name and namespace in other branches
- 8 core/modules/language/tests/src/Kernel/Views/ArgumentLanguageTest.php \Drupal\Tests\language\Kernel\Views\ArgumentLanguageTest
- 9 core/modules/language/tests/src/Kernel/Views/ArgumentLanguageTest.php \Drupal\Tests\language\Kernel\Views\ArgumentLanguageTest
Tests the argument 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\ArgumentLanguageTest
- class \Drupal\Tests\language\Kernel\Views\LanguageTestBase
- class \Drupal\Tests\views\Kernel\ViewsKernelTestBase uses ViewResultAssertionTrait
Expanded class hierarchy of ArgumentLanguageTest
See also
\Drupal\language\Plugin\views\argument\Language.php
File
- core/
modules/ language/ tests/ src/ Kernel/ Views/ ArgumentLanguageTest.php, line 13
Namespace
Drupal\Tests\language\Kernel\ViewsView source
class ArgumentLanguageTest extends LanguageTestBase {
/**
* Views used by this test.
*
* @var array
*/
public static $testViews = [
'test_view',
];
/**
* Tests the language argument.
*/
public function testArgument() {
$view = Views::getView('test_view');
foreach ([
'en' => 'John',
'xx-lolspeak' => 'George',
] as $langcode => $name) {
$view
->setDisplay();
$view->displayHandlers
->get('default')
->overrideOption('arguments', [
'langcode' => [
'id' => 'langcode',
'table' => 'views_test_data',
'field' => 'langcode',
],
]);
$this
->executeView($view, [
$langcode,
]);
$expected = [
[
'name' => $name,
],
];
$this
->assertIdenticalResultset($view, $expected, [
'views_test_data_name' => 'name',
]);
$view
->destroy();
}
}
}