You are here

function FFCTestCase::DSTestHideSourceTargetNotEmpty in Field formatter conditions 7

Test Hide source when target is not empty condition on DS

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

File

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

Class

FFCTestCase
Group UI tests.

Code

function DSTestHideSourceTargetNotEmpty() {

  // Hide submitted_by when body is not empty.
  $condition = array(
    'fields[submitted_by][settings_edit_form][settings][conditions][0][condition]' => 'hide_not_empty',
  );
  $configuration = array(
    'fields[submitted_by][settings_edit_form][settings][conditions][0][configuration][target]' => 'body',
  );
  $this
    ->ffcEditFormatterSettings($condition, $configuration, 'edit submitted_by');
  $this
    ->drupalGet('node/' . $this->node1->nid);
  $body_value = $this->node1->body[$this->node1->language][0]['value'];
  $this
    ->assertText($body_value);
  $this
    ->assertNoRaw(check_plain($this->node1->name));

  // Empty body.
  $edit = array(
    'body[und][0][value]' => '',
  );
  $this
    ->drupalPost('node/' . $this->node1->nid . '/edit', $edit, t('Save'));
  $this
    ->drupalGet('node/' . $this->node1->nid);
  $this
    ->assertNoText($body_value);
  $this
    ->assertRaw(check_plain($this->node1->name));
}