You are here

function BotchaBaseWebTestCase::setUp in BOTCHA Spam Prevention 6.2

Same name and namespace in other branches
  1. 6 botcha.test \BotchaBaseWebTestCase::setUp()
  2. 6.3 tests/botcha.simpletest.test \BotchaBaseWebTestCase::setUp()
  3. 7 botcha.test \BotchaBaseWebTestCase::setUp()
  4. 7.2 botcha.test \BotchaBaseWebTestCase::setUp()
  5. 7.3 tests/botcha.simpletest.test \BotchaBaseWebTestCase::setUp()

Generates a random database prefix, runs the install scripts on the prefixed database and enable the specified modules. After installation many caches are flushed and the internal browser is setup so that the page requests will run on the new prefix. A temporary files directory is created with the same name as the database prefix.

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

1 call to BotchaBaseWebTestCase::setUp()
BotchaTestCase::setUp in ./botcha.test
Generates a random database prefix, runs the install scripts on the prefixed database and enable the specified modules. After installation many caches are flushed and the internal browser is setup so that the page requests will run on the new prefix.…
1 method overrides BotchaBaseWebTestCase::setUp()
BotchaTestCase::setUp in ./botcha.test
Generates a random database prefix, runs the install scripts on the prefixed database and enable the specified modules. After installation many caches are flushed and the internal browser is setup so that the page requests will run on the new prefix.…

File

./botcha.test, line 59
Tests for BOTCHA module.

Class

BotchaBaseWebTestCase
Base class for BOTCHA tests.

Code

function setUp() {

  // Load two modules: the botcha module itself and the comment module
  // for testing anonymous comments.
  parent::setUp(array(
    'comment',
    'botcha',
  ));

  // Clean the environment.
  Botcha::clean();

  // Create a normal user.
  $permissions = array(
    'access comments',
    'post comments',
    // @todo Abstract it.

    //'skip comment approval',
    'post comments without approval',
    'access content',
    'create page content',
    'edit own page content',
  );
  $this->normal_user = $this
    ->drupalCreateUser($permissions);

  // Create an admin user.
  $permissions[] = 'administer BOTCHA settings';
  $permissions[] = 'skip BOTCHA';
  $permissions[] = 'administer permissions';
  $permissions[] = 'administer content types';
  $this->admin_user = $this
    ->drupalCreateUser($permissions);

  // Put comments on page nodes on a separate page (default in D7: below post).
  variable_set('comment_form_location_page', COMMENT_FORM_SEPARATE_PAGE);
}