home | career | drupal | java | mac | mysql | perl | php | scala | uml | unix

Drupal example source code file (menu_example.test)

This example Drupal source code file (menu_example.test) is included in the DevDaily.com "Drupal Source Code Warehouse" project. The intent of this project is to help you "Learn Drupal by Example".

PHP - Drupal tags/keywords

arguments, entry, example, function, in, is, menu, name, of, php, public, tabs, the, web_user

The menu_example.test Drupal example source code


 * @file
 * Tests for menu example module.
class MenuExampleTestCase extends DrupalWebTestCase {
  protected $web_user;

  public static function getInfo() {
    return array(
      'name' => 'Menu example functionality',
      'description' => 'Checks behavior of Menu Example.',
      'group' => 'Examples',

   * Enable modules and create user with specific permissions.
  public function setUp() {

   * Test the various menus.
  function testMenuExample() {
    $this->clickLink(t('Menu Example'));
    $this->assertText(t('This is the base page of the Menu Example'));

    $this->clickLink(t('Permissioned Example'));
    $this->assertText(t('Permissioned Example'));



    $this->clickLink(t('MENU_CALLBACK example'));

    $this->assertText(t('The menu entry for this page is of type MENU_CALLBACK'));

    $this->assertText(t('This is the "tabs" menu entry'));

    $this->assertText(t('This is the tab "second" in the "basic tabs" example'));

    $this->assertText(t('This is the tab "third" in the "basic tabs" example'));

    $this->clickLink(t('Extra Arguments'));

    $this->assertText(t('Argument 1=one'));

    $this->clickLink(t('Placeholder Arguments'));


    $this->clickLink(t('Processed Placeholder Arguments'));
    $this->assertText(t('Loaded value was jackpot! default'));

    // Create a user with permissions to access protected menu entry.
    $web_user = $this->drupalCreateUser(array('access protected menu example'));
    // Check that our title callback changing /user dynamically is working.
    $this->assertRaw(t("@name's account", array('@name' => $web_user->name)));

    $this->clickLink(t('Permissioned Example'));
    $this->assertText('This menu entry will not show');

    // Verify that the 'logout' link has been changed to 'salir'.
    $this->clickLink(t('Create new account'));

Other Drupal examples (source code examples)

Here is a short list of links related to this Drupal menu_example.test source code file:

new blog posts

"Drupal" is a registered trademark of Dries Buytaert.

my drupal tutorials and examples  

Copyright 1998-2016 Alvin Alexander, alvinalexander.com
All Rights Reserved.

Beginning in 2016, a portion of the proceeds from pages under the '/drupal-code-examples/' URI will be donated to charity.