Test that hook_field_access() is called.
function testFieldAccess() {
// Assert the text is visible.
$this
->drupalGet('node/' . $this->node->nid);
$this
->assertText($this->test_view_field_value);
// Assert the text is not visible for anonymous users.
// The field_test module implements hook_field_access() which will
// specifically target the 'test_view_field' field.
$this
->drupalLogout();
$this
->drupalGet('node/' . $this->node->nid);
$this
->assertNoText($this->test_view_field_value);
}