'Help functionality', 'description' => 'Verify help display and user access to help based on permissions.', 'group' => 'Help', ); } /** * Enable modules and create users with specific permissions. */ function setUp() { parent::setUp('blog', 'poll'); $this->getModuleList(); // Create users. $this->big_user = $this->drupalCreateUser(array('access administration pages')); $this->any_user = $this->drupalCreateUser(array()); } /** * Login users, create dblog events, and test dblog functionality through the admin and user interfaces. */ function testHelp() { // Login the admin user. $this->drupalLogin($this->big_user); $this->verifyHelp(); // 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 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))); } } /** * Verify the logged in user has the desired access to the various help nodes and the nodes display help. * * @param integer $response HTTP response code. */ private function verifyHelp($response = 200) { foreach ($this->modules as $module => $name) { // View module help node. $this->drupalGet('admin/help/' . $module); $this->assertResponse($response); if ($response == 200) { $this->assertTitle($name . ' | Drupal', t('[' . $module . '] Title was displayed')); $this->assertRaw('