Tests the translator add, edit and overview user interfaces.
@group tmgmt
Expanded class hierarchy of TranslatorUITest
class TranslatorUITest extends TMGMTTestBase {
/**
* Modules to enable.
*
* @var array
*/
protected static $modules = array(
'tmgmt_file',
);
/**
* {@inheritdoc}
*/
function setUp() : void {
parent::setUp();
// Login as administrator to add/edit and view translators.
$this
->loginAsAdmin();
}
/**
* Tests UI for creating a translator.
*/
public function testTranslatorUI() {
// Test translator creation UI.
$this
->drupalGet('admin/tmgmt/translators/add');
$this
->submitForm([
'label' => 'Test translator',
'description' => 'Test translator description',
'name' => 'translator_test',
'settings[scheme]' => 'private',
], 'Save');
$this
->assertSession()
->pageTextContains('Test translator configuration has been created.');
// Test translator edit page.
$this
->drupalGet('admin/tmgmt/translators/manage/translator_test');
$this
->assertSession()
->fieldValueEquals('label', 'Test translator');
$this
->assertSession()
->fieldValueEquals('description', 'Test translator description');
$this
->assertSession()
->fieldValueEquals('name', 'translator_test');
$this
->assertSession()
->checkboxChecked('edit-settings-scheme-private');
$this
->submitForm([
'label' => 'Test translator changed',
'description' => 'Test translator description changed',
], 'Save');
$this
->assertSession()
->pageTextContains('Test translator changed configuration has been updated.');
// Test translator overview page.
$this
->drupalGet('admin/tmgmt/translators');
$this
->assertSession()
->responseContains('<img class="tmgmt-logo-overview"');
$this
->assertSession()
->pageTextContains('Test translator changed');
$this
->assertSession()
->linkExists('Edit');
$this
->assertSession()
->linkExists('Delete');
// Check if the edit link is displayed before the clone link.
$content = $this
->assertSession()
->elementExists('css', '.dropbutton-wrapper')
->getHtml();
$edit_position = strpos($content, 'Edit');
$clone_position = strpos($content, 'Clone');
$this
->assertTrue($edit_position < $clone_position);
}
}
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
TMGMTTestBase:: |
protected | property | ||
TMGMTTestBase:: |
protected | property | A default translator using the test translator. | |
TmgmtTestTrait:: |
protected | property | List of permissions used by loginAsAdmin(). | |
TmgmtTestTrait:: |
protected | property | Drupal user object created by loginAsAdmin(). | |
TmgmtTestTrait:: |
protected | property | The language weight for new languages. | |
TmgmtTestTrait:: |
protected | property | List of permissions used by loginAsTranslator(). | |
TmgmtTestTrait:: |
protected | property | Drupal user object created by loginAsTranslator(). | |
TmgmtTestTrait:: |
function | Sets the proper environment. | ||
TmgmtTestTrait:: |
function | Asserts job item language codes. | ||
TmgmtTestTrait:: |
protected | function | Asserts text in the page with an xpath expression. | |
TmgmtTestTrait:: |
function | Clicks on an image link with the provided title attribute. | ||
TmgmtTestTrait:: |
function | Creates, saves and returns a translation job. | ||
TmgmtTestTrait:: |
function | Creates, saves and returns a translator. | ||
TmgmtTestTrait:: |
function | Will create a user with admin permissions and log it in. | ||
TmgmtTestTrait:: |
function | Will create a user with translator permissions and log it in. | ||
TranslatorUITest:: |
protected static | property |
Modules to enable. Overrides TMGMTTestBase:: |
|
TranslatorUITest:: |
function |
Overrides DrupalWebTestCase::setUp() Overrides TMGMTTestBase:: |
||
TranslatorUITest:: |
public | function | Tests UI for creating a translator. |