Index: modules/help/help.test =================================================================== RCS file: /cvs/drupal/drupal/modules/help/help.test,v retrieving revision 1.8 diff -u -r1.8 help.test --- modules/help/help.test 13 Jul 2009 21:51:10 -0000 1.8 +++ modules/help/help.test 14 Jul 2009 22:02:53 -0000 @@ -8,7 +8,7 @@ public static function getInfo() { return array( 'name' => 'Help functionality', - 'description' => 'Verify help display and user access to help based on persmissions.', + 'description' => 'Verify help display and user access to help based on permissions.', 'group' => 'Help', ); } @@ -17,11 +17,9 @@ * Enable modules and create users with specific permissions. */ function setUp() { - parent::setUp(); + parent::setUp('blog', 'poll', 'help_test'); // Loading these (and other?) modules will result in failures? -// $this->drupalModuleEnable('blog'); -// $this->drupalModuleEnable('poll'); $this->getModuleList(); // Create users. @@ -40,6 +38,22 @@ // Login the regular user. $this->drupalLogin($this->any_user); $this->verifyHelp(403); + + // Check for css on admin/help. + $this->drupalLogin($this->big_user); + $this->drupalGet('admin/help'); + $this->assertRaw(drupal_get_path('module', 'help') . '/help.css', t('The help.css file is present in the HTML.')); + + // Verify that introductory help text exists, goes for 100% module coverage. + $this->assertRaw(t('For more information, please refer to the specific topics listed in the next section, or the online Drupal handbooks.', array('@drupal' => 'http://drupal.org/handbooks')), 'Help intro text correctly appears.'); + + // Verify that help topics text appears. + $this->assertRaw('

' . t('Help topics') . '

' . t('Help is available on the following items:') . '

', t('Help topics text correctly appears.')); + + // Make sure links are properly added for modules implementing hook_help(). + foreach ($this->modules as $module => $name) { + $this->assertLink($name, 0, t('Link properly added to @name (admin/help/@module)', array('@module' => $module, '@name' => $name))); + } } /** @@ -54,25 +68,16 @@ // View module help node. $this->drupalGet('admin/help/' . $module); $this->assertResponse($response); - if (drupal_function_exists($module . '_help')) { - // View module help node. - $this->drupalGet('admin/help/' . $module); - $this->assertResponse($response); - if ($response == 200) { - // NOTE: The asserts fail on blog and poll because the get returns the 'admin/help' node instead of the indicated node??? -// if ($module == 'blog' || $module == 'poll') { -// continue; -// } - $this->assertTitle($name . ' | Drupal', t('[' . $module . '] Title was displayed')); - $this->assertRaw('

' . t($name) . '

', t('[' . $module . '] Heading was displayed')); - $this->assertText(t('Home ' . $crumb . ' Administer ' . $crumb . ' Help'), t('[' . $module . '] Breadcrumbs were displayed')); - } + if ($response == 200) { + $this->assertTitle($name . ' | Drupal', t('[' . $module . '] Title was displayed')); + $this->assertRaw('

' . t($name) . '

', t('[' . $module . '] Heading was displayed')); + $this->assertText(t('Home ' . $crumb . ' Administer ' . $crumb . ' Help'), t('[' . $module . '] Breadcrumbs were displayed')); } } } /** - * Get list of enabled modules. + * Get list of enabled modules that implement hook_help(). * * @return array Enabled modules. */ @@ -80,10 +85,10 @@ $this->modules = array(); $result = db_query("SELECT name, filename, info FROM {system} WHERE type = 'module' AND status = 1 ORDER BY weight ASC, filename ASC"); foreach ($result as $module) { - if (file_exists($module->filename)) { + if (file_exists($module->filename) && drupal_function_exists($module->name . '_help')) { $fullname = unserialize($module->info); $this->modules[$module->name] = $fullname['name']; } } } -} +} \ No newline at end of file Index: modules/simpletest/tests/help_test.info =================================================================== RCS file: modules/simpletest/tests/help_test.info diff -N modules/simpletest/tests/help_test.info --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ modules/simpletest/tests/help_test.info 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,8 @@ +; $Id: session_test.info,v 1.1 2008/08/16 21:11:02 dries Exp $ +name = "Help Test" +description = "Support module for session data testing." +package = Testing +version = VERSION +core = 7.x +files[] = help_test.module +hidden = TRUE Index: modules/simpletest/tests/help_test.module =================================================================== RCS file: modules/simpletest/tests/help_test.module diff -N modules/simpletest/tests/help_test.module --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ modules/simpletest/tests/help_test.module 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,19 @@ +' . t('Dummy module implementing hook help to test help text availablity.') . '

'; + case 'admin/help/help_test': + return '

' . t('Dummy module implementing hook help to test help text availablity.') . '

'; + } +}