Issue #1533244 by amitgoyal, krishworks: Coder clean-up for Help module
parent
623621ff7e
commit
93a03822b2
|
@ -11,7 +11,7 @@
|
|||
* @see help_menu()
|
||||
*/
|
||||
function help_main() {
|
||||
// Add CSS
|
||||
// Add CSS.
|
||||
drupal_add_css(drupal_get_path('module', 'help') . '/help.css');
|
||||
$output = '<h2>' . t('Help topics') . '</h2><p>' . t('Help is available on the following items:') . '</p>' . help_links_as_list();
|
||||
return $output;
|
||||
|
@ -87,4 +87,3 @@ function help_links_as_list() {
|
|||
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
|
|
@ -48,11 +48,11 @@
|
|||
*/
|
||||
function hook_help($path, $arg) {
|
||||
switch ($path) {
|
||||
// Main module help for the block module
|
||||
// Main module help for the block module.
|
||||
case 'admin/help#block':
|
||||
return '<p>' . t('Blocks are boxes of content rendered into an area, or region, of a web page. The default theme Bartik, for example, implements the regions "Sidebar first", "Sidebar second", "Featured", "Content", "Header", "Footer", etc., and a block may appear in any one of these areas. The <a href="@blocks">blocks administration page</a> provides a drag-and-drop interface for assigning a block to a region, and for controlling the order of blocks within regions.', array('@blocks' => url('admin/structure/block'))) . '</p>';
|
||||
|
||||
// Help for another path in the block module
|
||||
// Help for another path in the block module.
|
||||
case 'admin/structure/block':
|
||||
return '<p>' . t('This page provides a drag-and-drop interface for assigning a block to a region, and for controlling the order of blocks within regions. Since not all themes implement the same regions, or display regions in the same way, blocks are positioned on a per-theme basis. Remember that your changes will not be saved until you click the <em>Save blocks</em> button at the bottom of the page.') . '</p>';
|
||||
}
|
||||
|
|
|
@ -27,12 +27,12 @@ class HelpTest extends WebTestBase {
|
|||
/**
|
||||
* The admin user that will be created.
|
||||
*/
|
||||
protected $big_user;
|
||||
protected $adminUser;
|
||||
|
||||
/**
|
||||
* The anonymous user that will be created.
|
||||
*/
|
||||
protected $any_user;
|
||||
protected $anyUser;
|
||||
|
||||
public static function getInfo() {
|
||||
return array(
|
||||
|
@ -42,30 +42,30 @@ class HelpTest extends WebTestBase {
|
|||
);
|
||||
}
|
||||
|
||||
function setUp() {
|
||||
public function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
$this->getModuleList();
|
||||
|
||||
// Create users.
|
||||
$this->big_user = $this->drupalCreateUser(array('access administration pages', 'view the administration theme', 'administer permissions'));
|
||||
$this->any_user = $this->drupalCreateUser(array());
|
||||
$this->adminUser = $this->drupalCreateUser(array('access administration pages', 'view the administration theme', 'administer permissions'));
|
||||
$this->anyUser = $this->drupalCreateUser(array());
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs in users, creates dblog events, and tests dblog functionality.
|
||||
*/
|
||||
function testHelp() {
|
||||
public function testHelp() {
|
||||
// Login the admin user.
|
||||
$this->drupalLogin($this->big_user);
|
||||
$this->drupalLogin($this->adminUser);
|
||||
$this->verifyHelp();
|
||||
|
||||
// Login the regular user.
|
||||
$this->drupalLogin($this->any_user);
|
||||
$this->drupalLogin($this->anyUser);
|
||||
$this->verifyHelp(403);
|
||||
|
||||
// Check for css on admin/help.
|
||||
$this->drupalLogin($this->big_user);
|
||||
$this->drupalLogin($this->adminUser);
|
||||
$this->drupalGet('admin/help');
|
||||
$this->assertRaw(drupal_get_path('module', 'help') . '/help.css', 'The help.css file is present in the HTML.');
|
||||
|
||||
|
@ -95,7 +95,7 @@ class HelpTest extends WebTestBase {
|
|||
if ($response == 200) {
|
||||
$this->assertTitle($name . ' | Drupal', format_string('%module title was displayed', array('%module' => $module)));
|
||||
$this->assertRaw('<h1 class="page-title">' . t($name) . '</h1>', format_string('%module heading was displayed', array('%module' => $module)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ class NoHelpTest extends WebTestBase {
|
|||
/**
|
||||
* The user who will be created.
|
||||
*/
|
||||
protected $big_user;
|
||||
protected $adminUser;
|
||||
|
||||
public static function getInfo() {
|
||||
return array(
|
||||
|
@ -36,16 +36,16 @@ class NoHelpTest extends WebTestBase {
|
|||
);
|
||||
}
|
||||
|
||||
function setUp() {
|
||||
public function setUp() {
|
||||
parent::setUp();
|
||||
$this->big_user = $this->drupalCreateUser(array('access administration pages'));
|
||||
$this->adminUser = $this->drupalCreateUser(array('access administration pages'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures modules not implementing help do not appear on admin/help.
|
||||
*/
|
||||
function testMainPageNoHelp() {
|
||||
$this->drupalLogin($this->big_user);
|
||||
public function testMainPageNoHelp() {
|
||||
$this->drupalLogin($this->adminUser);
|
||||
|
||||
$this->drupalGet('admin/help');
|
||||
$this->assertNoText('Hook menu tests', 'Making sure the test module menu_test does not display a help link in admin/help');
|
||||
|
|
Loading…
Reference in New Issue