Commit 06054932 authored by webchick's avatar webchick

Issue #2080543 by larowlan, angel.h, grisendo, mrsinguyen: Remove unused local...

Issue #2080543 by larowlan, angel.h, grisendo, mrsinguyen: Remove unused local variables in the forum module.
parent 8abc63dc
...@@ -6,10 +6,7 @@ ...@@ -6,10 +6,7 @@
*/ */
use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Language\Language;
use Drupal\taxonomy\Entity\Term;
use Drupal\field\Field; use Drupal\field\Field;
use Drupal\node\NodeInterface;
/** /**
* Implements hook_help(). * Implements hook_help().
......
...@@ -118,7 +118,7 @@ function testForum() { ...@@ -118,7 +118,7 @@ function testForum() {
// Do the admin tests. // Do the admin tests.
$this->doAdminTests($this->admin_user); $this->doAdminTests($this->admin_user);
$this->generateForumTopics($this->forum); $this->generateForumTopics();
// Login an unprivileged user to view the forum topics and generate an // Login an unprivileged user to view the forum topics and generate an
// active forum topics list. // active forum topics list.
...@@ -140,7 +140,7 @@ function testForum() { ...@@ -140,7 +140,7 @@ function testForum() {
// Create a forum node authored by this user. // Create a forum node authored by this user.
$own_topics_user_node = $this->createForumTopic($this->forum, FALSE); $own_topics_user_node = $this->createForumTopic($this->forum, FALSE);
// Verify that this user cannot edit forum content authored by another user. // Verify that this user cannot edit forum content authored by another user.
$this->verifyForums($this->edit_any_topics_user, $any_topics_user_node, FALSE, 403); $this->verifyForums($any_topics_user_node, FALSE, 403);
// Verify that this user is shown a local task to add new forum content. // Verify that this user is shown a local task to add new forum content.
$this->drupalGet('forum'); $this->drupalGet('forum');
...@@ -151,7 +151,7 @@ function testForum() { ...@@ -151,7 +151,7 @@ function testForum() {
// Login a user with permission to edit any forum content. // Login a user with permission to edit any forum content.
$this->drupalLogin($this->edit_any_topics_user); $this->drupalLogin($this->edit_any_topics_user);
// Verify that this user can edit forum content authored by another user. // Verify that this user can edit forum content authored by another user.
$this->verifyForums($this->edit_own_topics_user, $own_topics_user_node, TRUE); $this->verifyForums($own_topics_user_node, TRUE);
// Verify the topic and post counts on the forum page. // Verify the topic and post counts on the forum page.
$this->drupalGet('forum'); $this->drupalGet('forum');
...@@ -246,9 +246,6 @@ private function doAdminTests($user) { ...@@ -246,9 +246,6 @@ private function doAdminTests($user) {
// Login the user. // Login the user.
$this->drupalLogin($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. // Add forum to the Tools menu.
$edit = array(); $edit = array();
$this->drupalPostForm('admin/structure/menu/manage/tools', $edit, t('Save')); $this->drupalPostForm('admin/structure/menu/manage/tools', $edit, t('Save'));
...@@ -438,7 +435,7 @@ private function doBasicTests($user, $admin) { ...@@ -438,7 +435,7 @@ private function doBasicTests($user, $admin) {
// Create forum node. // Create forum node.
$node = $this->createForumTopic($this->forum, FALSE); $node = $this->createForumTopic($this->forum, FALSE);
// Verify the user has access to all the forum nodes. // Verify the user has access to all the forum nodes.
$this->verifyForums($user, $node, $admin); $this->verifyForums($node, $admin);
} }
/** /**
...@@ -522,8 +519,6 @@ function createForumTopic($forum, $container = FALSE) { ...@@ -522,8 +519,6 @@ function createForumTopic($forum, $container = FALSE) {
/** /**
* Verifies that the logged in user has access to a forum node. * Verifies that the logged in user has access to a forum node.
* *
* @param $node_user
* The user who creates the node.
* @param \Drupal\Core\Entity\EntityInterface $node * @param \Drupal\Core\Entity\EntityInterface $node
* The node being checked. * The node being checked.
* @param $admin * @param $admin
...@@ -531,7 +526,7 @@ function createForumTopic($forum, $container = FALSE) { ...@@ -531,7 +526,7 @@ function createForumTopic($forum, $container = FALSE) {
* @param $response * @param $response
* The exptected HTTP response code. * The exptected HTTP response code.
*/ */
private function verifyForums($node_user, EntityInterface $node, $admin, $response = 200) { private function verifyForums(EntityInterface $node, $admin, $response = 200) {
$response2 = ($admin) ? 200 : 403; $response2 = ($admin) ? 200 : 403;
// View forum help node. // View forum help node.
...@@ -628,11 +623,8 @@ private function verifyForumView($forum, $parent = NULL) { ...@@ -628,11 +623,8 @@ private function verifyForumView($forum, $parent = NULL) {
/** /**
* Generates forum topics. * Generates forum topics.
*
* @param array $forum
* The forum array (a row from taxonomy_term_data table).
*/ */
private function generateForumTopics($forum) { private function generateForumTopics() {
$this->nids = array(); $this->nids = array();
for ($i = 0; $i < 5; $i++) { for ($i = 0; $i < 5; $i++) {
$node = $this->createForumTopic($this->forum, FALSE); $node = $this->createForumTopic($this->forum, FALSE);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment