t('Help page tests'), 'description' => 'Visits the help pages and makes sure they exist and work properly.', 'group' => 'Help tests' ); } /** * An actual test function. Tests the help pages by visiting each page and confirming the help text exists. */ function testHelpPages() { $web_user = $this->drupalCreateUser(array('access administration pages')); $this->drupalLogin($web_user); $args = drupal_help_arg(); foreach (module_implements('help') as $module) { $help_text = module_invoke($module, 'help', 'admin/help#'. $module, $args); if (!empty($help_text)) { $this->assertHelp($module, $help_text); } } // Check the base help page too (I mean, why not?) $this->assertHelp('', help_help('admin/help', $args)); } /** * Helper function for testHelpPages(). * * @param $module * The name of the module whose test page we are testing. * @param $text * The help text that should appear on that page. * @return * None; instead, makes simpletest assertions. */ function assertHelp($module, $text) { $this->drupalGet('admin/help/'. $module); // We can't use assertText because that does wacky stuff with filter_xss. $this->assertFalse(strpos($this->_content, $text) === FALSE, 'Make sure the help text appears for '. $module); } }