function FFCTestCase::DSTestHideSourceTargetIfEmpty in Field formatter conditions 7
Test Hide source when target is empty condition on DS
1 call to FFCTestCase::DSTestHideSourceTargetIfEmpty()
- FFCTestCase::testDisplaySuite in tests/
ffc.test - Tests with Display Suite.
File
- tests/
ffc.test, line 380 - Test file for Field formatter conditions.
Class
- FFCTestCase
- Group UI tests.
Code
function DSTestHideSourceTargetIfEmpty() {
// Hide submitted_by when body is empty.
$condition = array(
'fields[submitted_by][settings_edit_form][settings][conditions][0][condition]' => 'hide_if_empty',
);
$configuration = array(
'fields[submitted_by][settings_edit_form][settings][conditions][0][configuration][target]' => 'body',
);
$this
->ffcEditFormatterSettings($condition, $configuration, 'edit submitted_by');
// Insert the original node/1 body value back into the node/1 body
$edit = array(
'body[und][0][value]' => $nodeBodyValue,
);
$this
->drupalPost('node/' . $this->node1->nid . '/edit', $edit, t('Save'));
$body_value = $this->node1->body[$this->node1->language][0]['value'];
$this
->assertText($body_value);
$this
->assertRaw(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
->assertNoRaw(check_plain($this->node1->name));
}