function OgAudienceFieldDeltaTestCase::testEntityMetadataWrapperForOgAudienceField in Organic groups 7.2
Test after creation we can access values using entity metadata wrapper with the get method.
File
- ./
og.test, line 2630
Class
- OgAudienceFieldDeltaTestCase
- Verify OG group ref field support delta after saving.
Code
function testEntityMetadataWrapperForOgAudienceField() {
$group = $this
->drupalCreateNode(array(
'type' => $this->groupType->type,
));
$node = $this
->drupalCreateNode(array(
'type' => $this->groupConentType->type,
));
$wrapper = entity_metadata_wrapper('node', $node);
$wrapper->{OG_AUDIENCE_FIELD}
->set(array(
$group,
));
$wrapper
->save();
$this
->assertEqual($wrapper->{OG_AUDIENCE_FIELD}
->get(0)
->getIdentifier(), $group->nid, 'The delta method returned the expected group ID.');
}