LocalTasksTests.php in Translation Management Tool 8
File
tests/src/Functional/LocalTasksTests.php
View source
<?php
namespace Drupal\Tests\tmgmt\Functional;
class LocalTasksTests extends TMGMTTestBase {
public static $modules = array(
'dblog',
'node',
'views',
'tmgmt_content',
'tmgmt_file',
'tmgmt_config',
);
public function setUp() : void {
parent::setUp();
$this
->loginAsAdmin(array(
'access administration pages',
));
}
public function testTranslatorLocalTasks() {
$this
->drupalCreateContentType(array(
'type' => 'article',
'name' => 'Article',
));
$content_translation_manager = \Drupal::service('content_translation.manager');
$content_translation_manager
->setEnabled('node', 'article', TRUE);
$content_translation_manager
->setEnabled('user', 'user', TRUE);
drupal_static_reset();
\Drupal::entityTypeManager()
->clearCachedDefinitions();
\Drupal::service('router.builder')
->rebuild();
\Drupal::service('entity.definition_update_manager')
->getChangeList();
$this
->drupalGet('admin');
$this
->clickLink(t('Translation'));
$this
->clickLink(t('Cart'));
$this
->clickLink(t('Jobs'));
$this
->clickLink(t('Providers'));
$this
->clickLink(t('Settings'));
$this
->clickLink(t('Sources'));
$this
->assertOptionSelected('edit-source', 'content:node');
$this
->assertOption('edit-source', 'content:node');
$this
->assertOption('edit-source', 'content:user');
$this
->assertOption('edit-source', 'config:block');
$this
->assertOption('edit-source', 'config:node_type');
$this
->assertOption('edit-source', 'config:tmgmt_translator');
$this
->assertNoOption('edit-source', 'config:base_field_override');
}
public function testTranslatorLocalTasksNoSource() {
$this
->loginAsAdmin(array(
'access administration pages',
));
$this
->drupalGet('admin');
$this
->clickLink(t('Translation'));
$this
->clickLink(t('Sources'));
$this
->assertText(t('No sources enabled.'));
}
}