function EntityReferenceOgContextTestCase::testPrepopulate in Entityreference prepopulate 7
Test the OG-context integration.
File
- ./
entityreference_prepopulate.test, line 45
Class
Code
function testPrepopulate() {
$settings = array(
'type' => $this->group_type,
'uid' => $this->user1->uid,
);
$settings[OG_GROUP_FIELD][LANGUAGE_NONE][0]['value'] = 1;
$group1 = $this
->drupalCreateNode($settings);
og_group('node', $group1, array(
'entity_type' => 'user',
'entity' => $this->user2,
));
$this
->drupalLogin($this->user2);
$this
->drupalGet('node/add/' . str_replace('_', '-', $this->group_content_type));
$this
->assertNoOptionSelected('edit-og-group-ref-und-0-default', 1, 'Group-audience fields is not selected.');
// Set the OG-context();
// See entityreference_prepopulate_test_init().
$options = array(
'query' => array(
'gid' => $group1->nid,
),
);
$this
->drupalGet('node/add/' . str_replace('_', '-', $this->group_content_type), $options);
$this
->assertOptionSelected('edit-og-group-ref-und-0-default', 1, 'Group-audience fields is selected.');
}