function OgVocabTestCase::setUp in OG Vocabulary 6
File
- ./
og_vocab.test, line 21
Class
Code
function setUp() {
parent::setUp('og', 'og_vocab');
// Create and login admin user.
$admin_user = $this
->drupalCreateUser(array(
'administer nodes',
'administer content types',
'access administration pages',
'administer site configuration',
'administer organic groups',
'administer taxonomy',
));
$this
->drupalLogin($admin_user);
$this->admin_user = $admin_user;
// Create a group node content type.
$group_type = $this
->drupalCreateContentType();
variable_set('og_content_type_usage_' . $group_type->name, 'group');
// Rebuild the menu so the new content types will appear in the menu.
menu_rebuild();
// Create a group node.
$gid1 = $this
->addOgGroup($group_type->name);
$gid2 = $this
->addOgGroup($group_type->name);
// Create taxonomy vocabulary and for each group.
$vid = $tid = array();
foreach (array(
$gid1,
$gid2,
) as $gid) {
$edit = array();
$machine_name = drupal_strtolower($this
->randomName());
$edit['name'] = $this
->randomName();
$edit['description'] = $this
->randomName();
$edit['machine_name'] = $machine_name;
$edit['og'] = $gid;
taxonomy_save_vocabulary($edit);
$vid[] = $edit['vid'];
// Create a term.
$form_values = array();
$form_values['vid'] = $edit['vid'];
$form_values['name'] = $this
->randomName();
taxonomy_save_term($form_values);
$tid[] = $form_values['tid'];
}
list($vid1, $vid2) = $vid;
list($tid1, $tid2) = $tid;
// Array with the name of the page, and its URL.
$this->og_vocab_pages = array(
'group taxonomy tab' => "node/{$gid1}/og/vocab",
'add group vocabulary' => "node/{$gid1}/og/vocab/add/vocabulary",
'edit group vocabulary' => "node/{$gid1}/og/vocab/edit/vocabulary/{$vid1}",
'edit group vocabulary of another group' => "node/{$gid1}/og/vocab/edit/vocabulary/{$vid2}",
'list terms of group vocabulary' => "node/{$gid1}/og/vocab/terms/{$vid1}",
'list terms of group vocabulary of another group' => "node/{$gid1}/og/vocab/terms/{$vid2}",
'add new group term' => "node/{$gid1}/og/vocab/terms/{$vid1}/add_term",
'add new group term of a vocabulary of another group' => "node/{$gid1}/og/vocab/terms/{$vid2}/add_term",
'edit group term' => "node/{$gid1}/og/vocab/terms/edit/{$tid1}",
'edit group term of a vocabulary of another group' => "node/{$gid1}/og/vocab/terms/edit/{$tid2}",
);
$this->gid1 = $gid1;
}