You are here

public function ShoutboxBaseTestCase::setUp in Shoutbox 7

Same name and namespace in other branches
  1. 7.2 shoutbox.test \ShoutboxBaseTestCase::setUp()

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()

4 calls to ShoutboxBaseTestCase::setUp()
ShoutboxBaseWithShoutsTestCase::setUp in ./shoutbox.test
Sets up a Drupal site for running functional and integration tests.
ShoutboxDeleteTestCase::setUp in ./shoutbox.test
Sets up a Drupal site for running functional and integration tests.
ShoutboxEditTestCase::setUp in ./shoutbox.test
Sets up a Drupal site for running functional and integration tests.
ShoutboxViewTestCase::setUp in ./shoutbox.test
Sets up a Drupal site for running functional and integration tests.
4 methods override ShoutboxBaseTestCase::setUp()
ShoutboxBaseWithShoutsTestCase::setUp in ./shoutbox.test
Sets up a Drupal site for running functional and integration tests.
ShoutboxDeleteTestCase::setUp in ./shoutbox.test
Sets up a Drupal site for running functional and integration tests.
ShoutboxEditTestCase::setUp in ./shoutbox.test
Sets up a Drupal site for running functional and integration tests.
ShoutboxViewTestCase::setUp in ./shoutbox.test
Sets up a Drupal site for running functional and integration tests.

File

./shoutbox.test, line 14
Shoutbox testing.

Class

ShoutboxBaseTestCase
@file Shoutbox testing.

Code

public function setUp() {
  parent::setUp('shoutbox');

  // Enable any modules required for the test
  // Create and log in our user. The user has the arbitrary privilege
  // 'extra special edit any simpletest_example' which the code uses
  // to grant access.
  $this->sb_view_user = $this
    ->drupalCreateUser(array(
    'access shoutbox',
  ));

  // Shoutbox super user.
  $this->sb_super_user = $this
    ->drupalCreateUser(array(
    'administer shoutbox',
    'access shoutbox',
  ));
  $this->sb_non_user = $this
    ->drupalCreateUser(array());
  $this->sb_edit_user = $this
    ->drupalCreateUser(array(
    'access shoutbox',
    'post shouts',
    'edit own shouts',
    'post shouts without approval',
  ));

  // Admin user for configuring blocks.
  $admin_user = $this
    ->drupalCreateUser(array(
    'administer blocks',
  ));
  $this
    ->drupalLogin($admin_user);

  // Set block title to confirm that the interface is available.
  $this
    ->drupalPost('admin/structure/block/manage/shoutbox/configure', array(
    'title' => $this
      ->randomName(8),
  ), t('Save block'));

  // $this->assertText(t('The block configuration has been saved.'), t('Block configuration set.'));
  // Set the block to a region to confirm block is available.
  $edit = array();
  $edit['blocks[shoutbox_shoutbox][region]'] = 'footer';
  $this
    ->drupalPost('admin/structure/block', $edit, t('Save blocks'));

  // $this->assertText(t('The block settings have been updated.'), t('Block successfully move to footer region.'));
  $this
    ->drupalLogout();
}