HelpTopicTranslatedTestBase.php
Same filename and directory in other branches
- 11.x core/modules/help/tests/src/Functional/HelpTopicTranslatedTestBase.php
- 10 core/modules/help/tests/src/Functional/HelpTopicTranslatedTestBase.php
- 9 core/modules/help_topics/tests/src/Functional/HelpTopicTranslatedTestBase.php
- 8.9.x core/modules/help_topics/tests/src/Functional/HelpTopicTranslatedTestBase.php
Namespace
Drupal\Tests\help\FunctionalFile
-
core/
modules/ help/ tests/ src/ Functional/ HelpTopicTranslatedTestBase.php
View source
<?php
declare (strict_types=1);
namespace Drupal\Tests\help\Functional;
use Drupal\Tests\BrowserTestBase;
use Drupal\Tests\Traits\Core\Locale\InstallerLanguageTrait;
// cspell:ignore hilfetestmodul übersetzung
/**
* Provides a base class for functional help topic tests that use translation.
*
* Installs in German, with a small PO file, and sets up the task, help, and
* page title blocks.
*/
abstract class HelpTopicTranslatedTestBase extends BrowserTestBase {
use InstallerLanguageTrait;
/**
* {@inheritdoc}
*/
protected static $modules = [
'help_topics_test',
'help',
'block',
];
/**
* {@inheritdoc}
*/
protected function setUp() : void {
parent::setUp();
// These tests rely on some markup from the Default Admin theme, as well as
// an optional block added when Default Admin is enabled.
\Drupal::service('theme_installer')->install([
'default_admin',
]);
\Drupal::configFactory()->getEditable('system.theme')
->set('admin', 'default_admin')
->save();
// Place various blocks.
$settings = [
'theme' => 'default_admin',
'region' => 'help',
];
$this->placeBlock('help_block', $settings);
$this->placeBlock('local_tasks_block', $settings);
$this->placeBlock('local_actions_block', $settings);
$this->placeBlock('page_title_block', $settings);
// Create user.
$this->drupalLogin($this->createUser([
'access help pages',
'view the administration theme',
'administer permissions',
]));
}
/**
* {@inheritdoc}
*/
protected function getInstallLangcode() : string {
return 'de';
}
/**
* {@inheritdoc}
*/
protected function getTranslationFileContents() : string {
return <<<PO
msgid ""
msgstr ""
msgid "ABC Help Test module"
msgstr "ABC-Hilfetestmodul"
msgid "Test translation."
msgstr "Übersetzung testen."
msgid "Non-word-item to translate."
msgstr "Non-word-german sdfwedrsdf."
PO;
}
}
Classes
| Title | Deprecated | Summary |
|---|---|---|
| HelpTopicTranslatedTestBase | Provides a base class for functional help topic tests that use translation. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.