You are here

function FFCTestCase::CoreTestHideSourceTargetIfEmpty in Field formatter conditions 7

Test Hide source if target is empty condition on Core.

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

File

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

Class

FFCTestCase
Group UI tests.

Code

function CoreTestHideSourceTargetIfEmpty() {

  // Hide body when tags are empty.
  $condition = array(
    'fields[body][settings_edit_form][settings][conditions][0][condition]' => 'hide_if_empty',
  );
  $configuration = array(
    'fields[body][settings_edit_form][settings][conditions][0][configuration][target]' => 'field_tags',
  );
  $this
    ->ffcEditFormatterSettings($condition, $configuration);

  // Populate our node with tags again
  $edit = array(
    'field_tags[und]' => 'Tag 1, Tag 2, Tag 3, Tag 4, Tag 5',
  );
  $this
    ->drupalPost('node/' . $this->node1->nid . '/edit', $edit, t('Save'));
  $this
    ->assertText($this->node1->body[$this->node1->language][0]['value']);
  $this
    ->assertText($this->terms[0]);
  $this
    ->assertText($this->terms[1]);
  $this
    ->assertText($this->terms[2]);

  // Empty tags.
  $edit = array(
    'field_tags[und]' => '',
  );
  $this
    ->drupalPost('node/' . $this->node1->nid . '/edit', $edit, t('Save'));
  $this
    ->assertNoText($this->node1->body[$this->node1->language][0]['value']);
  $this
    ->assertNoText($this->terms[0]);
  $this
    ->assertNoText($this->terms[1]);
  $this
    ->assertNoText($this->terms[2]);
}