function FieldPropertyTestCase::testIsProperty in Field property 7
File
- ./field_property.test, line 30
- Test integration for the field_property module.
Class
- FieldPropertyTestCase
- @file
Test integration for the field_property module.
Code
function testIsProperty() {
$edit['instance[is_property]'] = TRUE;
$this
->drupalPost('admin/structure/types/manage/article/fields/field_tags', $edit, 'Save settings');
$first = $node = $this
->drupalCreateNode(array(
'type' => 'article',
));
$this
->drupalGet("node/{$node->nid}/edit");
$this
->assertText("This field is synchonized across all revisions.");
$edit = array();
$edit['body[und][0][value]'] = 'Second revision';
$edit['field_tags[und]'] = 'term1, term2';
$edit['revision'] = TRUE;
$this
->drupalPost(NULL, $edit, 'Save');
$first = node_load($first->nid, $first->vid, TRUE);
$second = node_load($node->nid, NULL, TRUE);
$this
->assertNotEqual($first->vid, $second->vid);
$this
->assertEqual($first->field_tags, $second->field_tags);
$this
->assertNotEqual($first->body, $second->body);
$edit = array();
$edit['instance[is_property]'] = FALSE;
$this
->drupalPost('admin/structure/types/manage/article/fields/field_tags', $edit, 'Save settings');
$this
->drupalGet("node/{$node->nid}/edit");
$this
->assertNoText("This field is synchonized across all revisions.");
$edit = array();
$edit['body[und][0][value]'] = 'Third revision';
$edit['field_tags[und]'] = 'term1, term2, term3';
$edit['revision'] = TRUE;
$this
->drupalPost(NULL, $edit, 'Save');
$first = node_load($first->nid, $first->vid, TRUE);
$second = node_load($second->nid, $second->vid, TRUE);
$third = node_load($node->nid, NULL, TRUE);
$this
->assertNotEqual($second->vid, $third->vid);
$this
->assertNotEqual($second->field_tags, $third->field_tags);
$this
->assertNotEqual($second->body, $third->body);
$this
->assertEqual($first->field_tags, $second->field_tags);
$this
->assertNotEqual($first->body, $second->body);
$this
->drupalGet('admin/structure/types/manage/article/comment/fields/comment_body');
$this
->assertNoFieldByName('instance[is_property]');
}