diff --git a/core/modules/content_translation/src/Tests/ContentTranslationOperationsTest.php b/core/modules/content_translation/src/Tests/ContentTranslationOperationsTest.php index 86a726a..93f3b41 100644 --- a/core/modules/content_translation/src/Tests/ContentTranslationOperationsTest.php +++ b/core/modules/content_translation/src/Tests/ContentTranslationOperationsTest.php @@ -105,4 +105,34 @@ function testOperationTranslateLink() { $this->assertResponse(403); } + /** + * @see acontent_translation_translate_access() + */ + public function testContentTranslationOverviewAccess() { + $access_control_handler = \Drupal::entityManager()->getAccessControlHandler('node'); + $user = $this->createUser(['create content translations', 'access content']); + $this->drupalLogin($user); + + $node = $this->drupalCreateNode(['status' => FALSE, 'type' => 'article']); + $this->assertFalse(content_translation_translate_access($node)->isAllowed()); + $access_control_handler->resetCache(); + + $node->setPublished(TRUE); + $node->save(); + $this->assertTrue(content_translation_translate_access($node)->isAllowed()); + $access_control_handler->resetCache(); + + user_role_change_permissions( + Role::AUTHENTICATED_ID, + [ + 'access content' => FALSE, + ] + ); + + $user = $this->createUser(['create content translations']); + $this->drupalLogin($user); + $this->assertFalse(content_translation_translate_access($node)->isAllowed()); + $access_control_handler->resetCache(); + } + }