ContentTmgmtEntitySourceNoCanonicalLinkTest.php in Translation Management Tool 8
File
sources/content/tests/src/Functional/ContentTmgmtEntitySourceNoCanonicalLinkTest.php
View source
<?php
namespace Drupal\Tests\tmgmt_content\Functional;
use Drupal\content_translation_test\Entity\EntityTestTranslatableUISkip;
use Drupal\Tests\tmgmt\Functional\TmgmtEntityTestTrait;
use Drupal\Tests\tmgmt\Functional\TMGMTTestBase;
class ContentTmgmtEntitySourceNoCanonicalLinkTest extends TMGMTTestBase {
use TmgmtEntityTestTrait;
public static $modules = array(
'content_translation_test',
'language',
'entity_test',
'tmgmt_content',
);
function setUp() : void {
parent::setUp();
$this
->loginAsAdmin(array(
'create translation jobs',
'submit translation jobs',
'accept translation jobs',
'administer content translation',
'access content overview',
'update content translations',
'translate any entity',
));
$content_translation_manager = \Drupal::service('content_translation.manager');
$content_translation_manager
->setEnabled('entity_test_translatable_UI_skip', 'entity_test_translatable_UI_skip', TRUE);
$this
->addLanguage('de');
}
public function testNoCanonicalLinkTemplate() {
$entity = EntityTestTranslatableUISkip::create([
'name' => 'name english',
'langcode' => 'en',
]);
$entity
->save();
$this
->drupalGet('admin/tmgmt/sources/content/entity_test_translatable_UI_skip');
$this
->assertText($entity
->label());
$edit = [
'items[' . $entity
->id() . ']' => TRUE,
];
$this
->drupalPostForm(NULL, $edit, 'Request translation');
$this
->drupalPostForm(NULL, NULL, 'Submit to provider');
$this
->assertText('The translation of ' . $entity
->label() . ' to German is finished and can now be reviewed.');
$this
->clickLink('reviewed');
$this
->assertNoText('Translation publish status');
$this
->assertNoField('edit-moderation-state-new-state');
$this
->drupalPostForm(NULL, NULL, 'Save as completed');
$this
->assertTitle($entity
->label() . ' (English to German, Finished) | Drupal');
$this
->assertText('The translation for name english has been accepted as de(de-ch): name english.');
}
}