This commit is contained in:
2020-07-13 17:09:59 +02:00
parent 03559a7b76
commit 3a082e23cc
492 changed files with 4129 additions and 982 deletions
@@ -99,6 +99,7 @@ class ContentTranslationController extends ControllerBase {
* The route match.
* @param string $entity_type_id
* (optional) The entity type ID.
*
* @return array
* Array of page elements to render.
*/
@@ -26,7 +26,12 @@ class ContentTranslationEntityBundleUITest extends BrowserTestBase {
protected function setUp() {
parent::setUp();
$user = $this->drupalCreateUser(['access administration pages', 'administer languages', 'administer content translation', 'administer content types']);
$user = $this->drupalCreateUser([
'access administration pages',
'administer languages',
'administer content translation',
'administer content types',
]);
$this->drupalLogin($user);
}
@@ -64,7 +64,12 @@ class ContentTranslationOperationsTest extends NodeTestBase {
\Drupal::service('router.builder')->rebuild();
$this->baseUser1 = $this->drupalCreateUser(['access content overview']);
$this->baseUser2 = $this->drupalCreateUser(['access content overview', 'create content translations', 'update content translations', 'delete content translations']);
$this->baseUser2 = $this->drupalCreateUser([
'access content overview',
'create content translations',
'update content translations',
'delete content translations',
]);
}
/**
@@ -49,7 +49,17 @@ class ContentTranslationSettingsTest extends BrowserTestBase {
$this->addDefaultCommentField('node', 'article', 'comment_article', CommentItemInterface::OPEN, 'comment_article');
$this->addDefaultCommentField('node', 'page', 'comment_page');
$admin_user = $this->drupalCreateUser(['access administration pages', 'administer languages', 'administer content translation', 'administer content types', 'administer node fields', 'administer comment fields', 'administer comments', 'administer comment types', 'administer account settings']);
$admin_user = $this->drupalCreateUser([
'access administration pages',
'administer languages',
'administer content translation',
'administer content types',
'administer node fields',
'administer comment fields',
'administer comments',
'administer comment types',
'administer account settings',
]);
$this->drupalLogin($admin_user);
}
@@ -59,7 +69,7 @@ class ContentTranslationSettingsTest extends BrowserTestBase {
public function testSettingsUI() {
// Check for the content_translation_menu_links_discovered_alter() changes.
$this->drupalGet('admin/config');
$this->assertLink('Content language and translation');
$this->assertSession()->linkExists('Content language and translation');
$this->assertText('Configure language and translation support for content.');
// Test that the translation settings are ignored if the bundle is marked
// translatable but the entity type is not.
@@ -125,7 +125,11 @@ class ContentTranslationWorkflowsTest extends ContentTranslationTestBase {
$ops = ['create' => t('Add'), 'update' => t('Edit'), 'delete' => t('Delete')];
$translations_url = $this->entity->toUrl('drupal:content-translation-overview');
foreach ($ops as $current_op => $item) {
$user = $this->drupalCreateUser([$this->getTranslatePermission(), "$current_op content translations", 'view test entity']);
$user = $this->drupalCreateUser([
$this->getTranslatePermission(),
"$current_op content translations",
'view test entity',
]);
$this->drupalLogin($user);
$this->drupalGet($translations_url);
@@ -138,10 +142,10 @@ class ContentTranslationWorkflowsTest extends ContentTranslationTestBase {
foreach ($ops as $op => $label) {
if ($op != $current_op) {
$this->assertNoLink($label, new FormattableMarkup('No %op link found.', ['%op' => $label]));
$this->assertSession()->linkNotExists($label, new FormattableMarkup('No %op link found.', ['%op' => $label]));
}
else {
$this->assertLink($label, 0, new FormattableMarkup('%op link found.', ['%op' => $label]));
$this->assertSession()->linkExists($label, 0, new FormattableMarkup('%op link found.', ['%op' => $label]));
}
}
}