function FieldAccessTest::testFieldAccess in Zircon Profile 8
Same name in this branch
- 8 core/modules/field/src/Tests/FieldAccessTest.php \Drupal\field\Tests\FieldAccessTest::testFieldAccess()
- 8 core/modules/system/src/Tests/Entity/FieldAccessTest.php \Drupal\system\Tests\Entity\FieldAccessTest::testFieldAccess()
Same name and namespace in other branches
- 8.0 core/modules/field/src/Tests/FieldAccessTest.php \Drupal\field\Tests\FieldAccessTest::testFieldAccess()
Test that hook_entity_field_access() is called.
File
- core/
modules/ field/ src/ Tests/ FieldAccessTest.php, line 80 - Contains \Drupal\field\Tests\FieldAccessTest.
Class
- FieldAccessTest
- Tests Field access.
Namespace
Drupal\field\TestsCode
function testFieldAccess() {
// Assert the text is visible.
$this
->drupalGet('node/' . $this->node
->id());
$this
->assertText($this->testViewFieldValue);
// Assert the text is not visible for anonymous users.
// The field_test module implements hook_entity_field_access() which will
// specifically target the 'test_view_field' field.
$this
->drupalLogout();
$this
->drupalGet('node/' . $this->node
->id());
$this
->assertNoText($this->testViewFieldValue);
}