function FFCTestCase::CoreTestHideSourceTargetIfString in Field formatter conditions 7
Test Hide source when target contains a string condition on Core.
1 call to FFCTestCase::CoreTestHideSourceTargetIfString()
- FFCTestCase::testVannillaCore in tests/
ffc.test - Test Vannilla Core.
File
- tests/
ffc.test, line 269 - Test file for Field formatter conditions.
Class
- FFCTestCase
- Group UI tests.
Code
function CoreTestHideSourceTargetIfString() {
// Hide body when tags are not empty.
$condition = array(
'fields[body][settings_edit_form][settings][conditions][0][condition]' => 'hide_if_string',
);
$configuration = array(
'fields[body][settings_edit_form][settings][conditions][0][configuration][target]' => 'field_tags',
'fields[body][settings_edit_form][settings][conditions][0][configuration][string]' => 'Tag 1',
);
$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->drupalGet('node/' . $this->node1->nid);
$this
->assertNoText($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
->assertText($this->node1->body[$this->node1->language][0]['value']);
$this
->assertNoText($this->terms[0]);
$this
->assertNoText($this->terms[1]);
$this
->assertNoText($this->terms[2]);
}