You are here

public function LanguageEntityFieldAccessHookTest::testHookEntityFieldAccess in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/language/tests/src/Functional/LanguageEntityFieldAccessHookTest.php \Drupal\Tests\language\Functional\LanguageEntityFieldAccessHookTest::testHookEntityFieldAccess()
  2. 10 core/modules/language/tests/src/Functional/LanguageEntityFieldAccessHookTest.php \Drupal\Tests\language\Functional\LanguageEntityFieldAccessHookTest::testHookEntityFieldAccess()

Tests compatibility with hook_entity_field_access().

File

core/modules/language/tests/src/Functional/LanguageEntityFieldAccessHookTest.php, line 36

Class

LanguageEntityFieldAccessHookTest
Tests language picker compatibility with hook_entity_field_access.

Namespace

Drupal\Tests\language\Functional

Code

public function testHookEntityFieldAccess() {

  // Create an admin user and do the login.
  $user = $this
    ->drupalCreateUser([], NULL, TRUE);
  $this
    ->drupalLogin($user);

  // Assess the field is not visible.
  $this
    ->drupalGet('node/add/page');
  $this
    ->assertSession()
    ->fieldNotExists('langcode[0][value]');
  $this
    ->drupalLogout();
}