function ContentTranslationOperationsTest::testContentTranslationOverviewAccess
Tests the access to the overview page for translations.
See also
content_translation_translate_access()
File
- 
              core/
modules/ content_translation/ tests/ src/ Functional/ ContentTranslationOperationsTest.php, line 143  
Class
- ContentTranslationOperationsTest
 - Tests the content translation operations available in the content listing.
 
Namespace
Drupal\Tests\content_translation\FunctionalCode
public function testContentTranslationOverviewAccess() {
  $access_control_handler = \Drupal::entityTypeManager()->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();
  $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();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.