Index: modules/help/help.test =================================================================== RCS file: /cvs/drupal/drupal/modules/help/help.test,v retrieving revision 1.6 diff -u -p -r1.6 help.test --- modules/help/help.test 31 Mar 2009 01:49:52 -0000 1.6 +++ modules/help/help.test 2 Jun 2009 10:13:41 -0000 @@ -8,7 +8,7 @@ class HelpTestCase extends DrupalWebTest public static function getInfo() { return array( 'name' => t('Help functionality'), - 'description' => t('Verify help display and user access to help based on persmissions.'), + 'description' => t('Verify help display and user access to help based on permissions.'), 'group' => t('Help'), ); } @@ -17,11 +17,9 @@ class HelpTestCase extends DrupalWebTest * 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 @@ class HelpTestCase extends DrupalWebTest // 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))); + } } /** @@ -55,10 +69,6 @@ class HelpTestCase extends DrupalWebTest $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')); Index: modules/simpletest/tests/simpletest_test.info =================================================================== RCS file: modules/simpletest/tests/simpletest_test.info diff -N modules/simpletest/tests/simpletest_test.info --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ modules/simpletest/tests/simpletest_test.info 2 Jun 2009 10:13:41 -0000 @@ -0,0 +1,8 @@ +; $Id$ +name = "Simpletest test" +description = "Support module for testing the simpletest module." +package = Testing +version = VERSION +core = 7.x +files[] = simpletest_test.module +hidden = TRUE Index: modules/simpletest/tests/simpletest_test.module =================================================================== RCS file: modules/simpletest/tests/simpletest_test.module diff -N modules/simpletest/tests/simpletest_test.module --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ modules/simpletest/tests/simpletest_test.module 2 Jun 2009 10:13:41 -0000 @@ -0,0 +1,74 @@ + 'drupalPost test', + 'page callback' => 'simpletest_test_multiple_form', + 'access arguments' => array('access content'), + 'type' => MENU_CALLBACK, + ); + return $items; +} + +/** + * Implement hook_forms(). + */ +function simpletest_test_forms() { + $forms['simpletest_test_multiple_form_0'] = array('callback' => '_simpletest_test_form'); + $forms['simpletest_test_multiple_form_1'] = array('callback' => '_simpletest_test_form'); + return $forms; +} + +/** + * Build the form that contains multiple sub-forms. + */ +function simpletest_test_multiple_form() { + $build = array(); + for ($i = 0; $i < 2; $i++) { + $form_id = "simpletest_test_multiple_form_$i"; + $build[$form_id] = drupal_get_form($form_id, $i); + } + return $build; +} + +/** + * Create the form definition for our test values. + */ +function _simpletest_test_form($form_state, $i) { + $form['index'] = array( + '#type' => 'hidden', + '#value' => $i, + ); + + $form['test_field'] = array( + '#type' => 'textfield', + '#title' => "Test field $i", + '#default_value' => variable_get("simpletest_test_test_field_$i", 0), + ); + + $form['submit'] = array( + '#type' => 'submit', + '#value' => t('Submit'), + ); + + $form['#submit'][] = '_simpletest_test_form_submit'; + + return $form; +} + +/** + * Submit handler for _simpletest_test_form(). + */ +function _simpletest_test_form_submit($form, &$form_state) { + $i = $form_state['values']['index']; + variable_set("simpletest_test_test_field_$i", $form_state['values']['test_field']); +}