Skip to content
Snippets Groups Projects
Commit c5ce9cef authored by catch's avatar catch
Browse files

Issue #2572125 by rodrigoaguilera, vijaycs85, swentel, Berdir, Wim Leers,...

Issue #2572125 by rodrigoaguilera, vijaycs85, swentel, Berdir, Wim Leers, tstoeckler: Content translation local tasks are not getting displayed due to caching
parent 7cd80db7
No related branches found
Tags 1.2.0
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -37,8 +37,11 @@ class ContentTranslationOperationsTest extends NodeTestBase {
*
* @var array
*/
public static $modules = ['language', 'content_translation', 'node', 'views'];
public static $modules = ['language', 'content_translation', 'node', 'views', 'block'];
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
......@@ -63,7 +66,7 @@ protected function setUp() {
/**
* Test that the operation "Translate" is displayed in the content listing.
*/
function testOperationTranslateLink() {
public function testOperationTranslateLink() {
$node = $this->drupalCreateNode(['type' => 'article', 'langcode' => 'es']);
// Verify no translation operation links are displayed for users without
// permission.
......@@ -103,9 +106,30 @@ function testOperationTranslateLink() {
$node->setPublished(FALSE)->save();
$this->drupalGet($node->urlInfo('drupal:content-translation-overview'));
$this->assertResponse(403);
$this->drupalLogout();
// Ensure the 'Translate' local task does not show up anymore when disabling
// translations for a content type.
$node->setPublished(TRUE)->save();
user_role_change_permissions(
Role::AUTHENTICATED_ID,
[
'administer content translation' => TRUE,
'administer languages' => TRUE,
]
);
$this->drupalPlaceBlock('local_tasks_block');
$this->drupalLogin($this->baseUser2);
$this->drupalGet('node/' . $node->id());
$this->assertLinkByHref('node/' . $node->id() . '/translations');
$this->drupalPostForm('admin/config/regional/content-language', ['settings[node][article][translatable]' => FALSE], t('Save configuration'));
$this->drupalGet('node/' . $node->id());
$this->assertNoLinkByHref('node/' . $node->id() . '/translations');
}
/**
* Tests the access to the overview page for translations.
*
* @see content_translation_translate_access()
*/
public function testContentTranslationOverviewAccess() {
......
......@@ -24,6 +24,7 @@
* entity_keys = {
* "id" = "id"
* },
* list_cache_tags = { "rendered" }
* )
*/
class ContentLanguageSettings extends ConfigEntityBase implements ContentLanguageSettingsInterface {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment