createForumTopic example

// Log in an unprivileged user to view the forum topics and generate an     // active forum topics list.     $this->drupalLogin($this->webUser);
    // Verify that this user is shown a message that they may not post content.     $this->drupalGet('forum/' . $this->forum['tid']);
    $this->assertSession()->pageTextContains('You are not allowed to post new content in the forum');

    // Log in, and do basic tests for a user with permission to edit any forum     // content.     $this->doBasicTests($this->editAnyTopicsUser, TRUE);
    // Create a forum node authored by this user.     $any_topics_user_node = $this->createForumTopic($this->forum, FALSE);

    // Log in, and do basic tests for a user with permission to edit only its     // own forum content.     $this->doBasicTests($this->editOwnTopicsUser, FALSE);
    // Create a forum node authored by this user.     $own_topics_user_node = $this->createForumTopic($this->forum, FALSE);
    // Verify that this user cannot edit forum content authored by another user.     $this->verifyForums($any_topics_user_node, FALSE, 403);

    // Verify that this user is shown a local task to add new forum content.     $this->drupalGet('forum');
    
Home | Imprint | This part of the site doesn't use cookies.