class ConfigEntityListMultilingualTest in Drupal 10
Same name and namespace in other branches
- 8 core/modules/config/tests/src/Functional/ConfigEntityListMultilingualTest.php \Drupal\Tests\config\Functional\ConfigEntityListMultilingualTest
- 9 core/modules/config/tests/src/Functional/ConfigEntityListMultilingualTest.php \Drupal\Tests\config\Functional\ConfigEntityListMultilingualTest
Tests the listing of configuration entities in a multilingual scenario.
@group config
Hierarchy
- class \Drupal\Tests\BrowserTestBase extends \PHPUnit\Framework\TestCase uses \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, FunctionalTestSetupTrait, TestSetupTrait, BlockCreationTrait, ConfigTestTrait, ExtensionListTestTrait, ContentTypeCreationTrait, NodeCreationTrait, RandomGeneratorTrait, TestRequirementsTrait, PhpUnitWarnings, UiHelperTrait, UserCreationTrait, XdebugRequestTrait
- class \Drupal\Tests\config\Functional\ConfigEntityListMultilingualTest
Expanded class hierarchy of ConfigEntityListMultilingualTest
File
- core/
modules/ config/ tests/ src/ Functional/ ConfigEntityListMultilingualTest.php, line 13
Namespace
Drupal\Tests\config\FunctionalView source
class ConfigEntityListMultilingualTest extends BrowserTestBase {
/**
* Modules to enable.
*
* @var array
*/
protected static $modules = [
'config_test',
'language',
'block',
];
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* {@inheritdoc}
*/
protected function setUp() : void {
parent::setUp();
// Delete the override config_test entity. It is not required by this test.
\Drupal::entityTypeManager()
->getStorage('config_test')
->load('override')
->delete();
ConfigurableLanguage::createFromLangcode('hu')
->save();
$this
->drupalPlaceBlock('local_actions_block');
}
/**
* Tests the listing UI with different language scenarios.
*/
public function testListUI() {
// Log in as an administrative user to access the full menu trail.
$this
->drupalLogin($this
->drupalCreateUser([
'access administration pages',
'administer site configuration',
]));
// Get the list page.
$this
->drupalGet('admin/structure/config_test');
$this
->assertSession()
->linkByHrefExists('admin/structure/config_test/manage/dotted.default');
// Add a new entity using the action link.
$this
->clickLink('Add test configuration');
$edit = [
'label' => 'Antilop',
'id' => 'antilop',
'langcode' => 'hu',
];
$this
->submitForm($edit, 'Save');
// Ensure that operations for editing the Hungarian entity appear in English.
$this
->assertSession()
->linkByHrefExists('admin/structure/config_test/manage/antilop');
// Get the list page in Hungarian and assert Hungarian admin links
// regardless of language of config entities.
$this
->drupalGet('hu/admin/structure/config_test');
$this
->assertSession()
->linkByHrefExists('hu/admin/structure/config_test/manage/dotted.default');
$this
->assertSession()
->linkByHrefExists('hu/admin/structure/config_test/manage/antilop');
}
}