Runs admin tests on the admin user.
object $user: The logged-in user.
private function doAdminTests($user) {
// Login the user.
$this
->drupalLogin($user);
// Retrieve forum menu id.
$mlid = db_query_range("SELECT mlid FROM {menu_links} WHERE link_path = 'forum' AND menu_name = 'tools' AND module = 'system' ORDER BY mlid ASC", 0, 1)
->fetchField();
// Add forum to the Tools menu.
$edit = array();
$this
->drupalPost('admin/structure/menu/manage/tools', $edit, t('Save'));
$this
->assertResponse(200);
// Edit forum taxonomy.
// Restoration of the settings fails and causes subsequent tests to fail.
$this->forumContainer = $this
->editForumVocabulary();
// Create forum container.
$this->forumContainer = $this
->createForum('container');
// Verify "edit container" link exists and functions correctly.
$this
->drupalGet('admin/structure/forum');
$this
->clickLink('edit container');
$this
->assertRaw('Edit container', 'Followed the link to edit the container');
// Create forum inside the forum container.
$this->forum = $this
->createForum('forum', $this->forumContainer['tid']);
// Verify the "edit forum" link exists and functions correctly.
$this
->drupalGet('admin/structure/forum');
$this
->clickLink('edit forum');
$this
->assertRaw('Edit forum', 'Followed the link to edit the forum');
// Navigate back to forum structure page.
$this
->drupalGet('admin/structure/forum');
// Create second forum in container.
$this->delete_forum = $this
->createForum('forum', $this->forumContainer['tid']);
// Save forum overview.
$this
->drupalPost('admin/structure/forum/', array(), t('Save'));
$this
->assertRaw(t('The configuration options have been saved.'));
// Delete this second forum.
$this
->deleteForum($this->delete_forum['tid']);
// Create forum at the top (root) level.
$this->root_forum = $this
->createForum('forum');
// Test vocabulary form alterations.
$this
->drupalGet('admin/structure/taxonomy/manage/forums/edit');
$this
->assertFieldByName('op', t('Save'), 'Save button found.');
$this
->assertNoFieldByName('op', t('Delete'), 'Delete button not found.');
// Test term edit form alterations.
$this
->drupalGet('taxonomy/term/' . $this->forumContainer['tid'] . '/edit');
// Test parent field been hidden by forum module.
$this
->assertNoField('parent[]', 'Parent field not found.');
// Create a default vocabulary named "Tags".
$description = 'Use tags to group articles on similar topics into categories.';
$help = 'Enter a comma-separated list of words to describe your content.';
$vocabulary = entity_create('taxonomy_vocabulary', array(
'name' => 'Tags',
'description' => $description,
'vid' => 'tags',
'langcode' => language_default()->langcode,
'help' => $help,
));
$vocabulary
->save();
// Test tags vocabulary form is not affected.
$this
->drupalGet('admin/structure/taxonomy/manage/tags/edit');
$this
->assertFieldByName('op', t('Save'), 'Save button found.');
$this
->assertFieldByName('op', t('Delete'), 'Delete button found.');
// Test tags vocabulary term form is not affected.
$this
->drupalGet('admin/structure/taxonomy/manage/tags/add');
$this
->assertField('parent[]', 'Parent field found.');
// Test relations widget exists.
$relations_widget = $this
->xpath("//details[@id='edit-relations']");
$this
->assertTrue(isset($relations_widget[0]), 'Relations widget element found.');
}