You are here

function FFCTestCase::CoreTestHideSourceUserRoles in Field formatter conditions 7

Test Hide source when current user has certain roles on Core.

1 call to FFCTestCase::CoreTestHideSourceUserRoles()
FFCTestCase::testVannillaCore in tests/ffc.test
Test Vannilla Core.

File

tests/ffc.test, line 302
Test file for Field formatter conditions.

Class

FFCTestCase
Group UI tests.

Code

function CoreTestHideSourceUserRoles() {

  // Hide body when user is anonymous.
  $condition = array(
    'fields[body][settings_edit_form][settings][conditions][0][condition]' => 'hide_on_role',
  );
  $configuration = array(
    'fields[body][settings_edit_form][settings][conditions][0][configuration][roles][]' => '1',
  );
  $this
    ->ffcEditFormatterSettings($condition, $configuration);

  // Verify the body is still there for the authenticated user.
  $this
    ->drupalGet('node/' . $this->node1->nid);
  $this
    ->assertText($this->node1->body[$this->node1->language][0]['value']);

  // Log out and verify body is not seen.
  $this
    ->drupalLogout();
  $this
    ->drupalGet('node/' . $this->node1->nid);
  $this
    ->assertNoText($this->node1->body[$this->node1->language][0]['value']);

  // Login in again.
  $this
    ->drupalLogin($this->admin_user);
}