You are here

function MenuAttributesTestHelper::setUp in Menu Attributes 7

Sets up a Drupal site for running functional and integration tests.

Generates a random database prefix and installs Drupal with the specified installation profile in DrupalWebTestCase::$profile into the prefixed database. Afterwards, installs any additional modules specified by the test.

After installation all caches are flushed and several configuration values are reset to the values of the parent site executing the test, since the default values may be incompatible with the environment in which tests are being executed.

Parameters

...: List of modules to enable for the duration of the test. This can be either a single array or a variable number of string arguments.

Overrides DrupalWebTestCase::setUp

See also

DrupalWebTestCase::prepareDatabasePrefix()

DrupalWebTestCase::changeDatabasePrefix()

DrupalWebTestCase::prepareEnvironment()

2 calls to MenuAttributesTestHelper::setUp()
MenuAttributesNodeTestCase::setUp in ./menu_attributes.test
Sets up a Drupal site for running functional and integration tests.
MenuAttributesTestCase::setUp in ./menu_attributes.test
Sets up a Drupal site for running functional and integration tests.
2 methods override MenuAttributesTestHelper::setUp()
MenuAttributesNodeTestCase::setUp in ./menu_attributes.test
Sets up a Drupal site for running functional and integration tests.
MenuAttributesTestCase::setUp in ./menu_attributes.test
Sets up a Drupal site for running functional and integration tests.

File

./menu_attributes.test, line 18
Functionality tests for Menu attributes.

Class

MenuAttributesTestHelper
Helper test class with some added functions for testing.

Code

function setUp(array $modules = array()) {
  $modules[] = 'menu';
  $modules[] = 'menu_attributes';
  parent::setUp($modules);

  // Create and login user.
  $this->admin_user = $this
    ->drupalCreateUser(array(
    'administer menu attributes',
    'access administration pages',
    'administer content types',
    'administer menu',
    'create page content',
    'edit any page content',
    'delete any page content',
  ));
  $this->menu_attributes_new = array(
    'title' => $this
      ->randomName(10),
    'id' => $this
      ->randomName(10),
    'name' => $this
      ->randomName(10),
    'rel' => $this
      ->randomName(10),
    'class' => $this
      ->randomName(10),
    'style' => $this
      ->randomName(10),
    'target' => '_top',
    'accesskey' => $this
      ->randomName(1),
  );
  $this->menu_attributes_edit = array(
    'title' => $this
      ->randomName(10),
    'id' => $this
      ->randomName(10),
    'name' => $this
      ->randomName(10),
    'rel' => $this
      ->randomName(10),
    'class' => $this
      ->randomName(10),
    'style' => $this
      ->randomName(10),
    'target' => '_self',
    'accesskey' => $this
      ->randomName(1),
  );
}