TranslatorUITest.php in Translation Management Tool 8
File
tests/src/Functional/TranslatorUITest.php
View source
<?php
namespace Drupal\Tests\tmgmt\Functional;
class TranslatorUITest extends TMGMTTestBase {
public static $modules = array(
'tmgmt_file',
);
function setUp() : void {
parent::setUp();
$this
->loginAsAdmin();
}
public function testTranslatorUI() {
$this
->drupalGet('admin/tmgmt/translators/add');
$this
->drupalPostForm('admin/tmgmt/translators/add', array(
'label' => 'Test translator',
'description' => 'Test translator description',
'name' => 'translator_test',
'settings[scheme]' => 'private',
), t('Save'));
$this
->assertText('Test translator configuration has been created.');
$this
->drupalGet('admin/tmgmt/translators/manage/translator_test');
$this
->assertFieldByName('label', 'Test translator');
$this
->assertFieldByName('description', 'Test translator description');
$this
->assertFieldByName('name', 'translator_test');
$this
->assertFieldChecked('edit-settings-scheme-private');
$this
->drupalPostForm(NULL, array(
'label' => 'Test translator changed',
'description' => 'Test translator description changed',
), t('Save'));
$this
->assertText('Test translator changed configuration has been updated.');
$this
->drupalGet('admin/tmgmt/translators');
$this
->assertRaw('<img class="tmgmt-logo-overview"');
$this
->assertText('Test translator changed');
$this
->assertLink(t('Edit'));
$this
->assertLink(t('Delete'));
$content = $this
->getSession()
->getPage()
->getContent();
$edit_position = strpos($content, '<li class="edit">');
$clone_position = strpos($content, '<li class="clone">');
$this
->assertTrue($edit_position < $clone_position);
}
}