You are here

function FFCTestCase::DSTestHideSourceUserRoles in Field formatter conditions 7

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

1 call to FFCTestCase::DSTestHideSourceUserRoles()
FFCTestCase::testDisplaySuite in tests/ffc.test
Tests with Display Suite.

File

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

Class

FFCTestCase
Group UI tests.

Code

function DSTestHideSourceUserRoles() {

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

  // Verify the post date is still there for the authenticated user.
  $this
    ->drupalGet('node/' . $this->node1->nid);
  $this
    ->assertRaw(check_plain($this->node1->name));

  // Log out and verify post date is not seen.
  $this
    ->drupalLogout();
  $this
    ->drupalGet('node/' . $this->node1->nid);
  $this
    ->assertNoRaw(check_plain($this->node1->name));

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