verifyHelp example


    $this->noTourUser = $this->drupalCreateUser([
      'access administration pages',
    ]);
  }

  /** * Logs in users, tests help pages. */
  public function testHelp() {
    $this->drupalLogin($this->tourUser);
    $this->verifyHelp();

    $this->drupalLogin($this->noTourUser);
    $this->verifyHelp(FALSE);
  }

  /** * Verifies the logged in user has access to the help properly. * * @param bool $tours_ok * (optional) TRUE (default) if the user should see tours, FALSE if not. */
  

    $this->anyUser = $this->drupalCreateUser([]);
  }

  /** * Logs in users, tests help pages. */
  public function testHelp() {
    // Log in the root user to ensure as many admin links appear as possible on     // the module overview pages.     $this->drupalLogin($this->rootUser);
    $this->verifyHelp();

    // Log in the regular user.     $this->drupalLogin($this->anyUser);
    $this->verifyHelp(403);

    // Verify that introductory help text exists, goes for 100% module coverage.     $this->drupalLogin($this->adminUser);
    $this->drupalGet('admin/help');
    $this->assertSession()->responseContains('For more information, refer to the help listed on this page or to the <a href="https://www.drupal.org/documentation">online documentation</a> and <a href="https://www.drupal.org/support">support</a> pages at <a href="https://www.drupal.org">drupal.org</a>.');

    // Verify that hook_help() section title and description appear.
$this->anyUser = $this->createUser([]);
  }

  /** * Tests the main help page and individual pages for topics. */
  public function testHelp() {
    $session = $this->assertSession();

    // Log in the regular user.     $this->drupalLogin($this->anyUser);
    $this->verifyHelp(403);

    // Log in the admin user.     $this->drupalLogin($this->adminUser);
    $this->verifyHelp();
    $this->verifyBreadCrumb();

    // Verify that help topics text appears on admin/help, and cache tags.     $this->drupalGet('admin/help');
    $session->responseContains('<h2>Topics</h2>');
    $session->pageTextContains('Topics can be provided by modules or themes');
    $session->responseHeaderContains('X-Drupal-Cache-Tags', 'core.extension');

    
Home | Imprint | This part of the site doesn't use cookies.