You are here

function BotchaTestCase::setUp in BOTCHA Spam Prevention 7.2

Same name and namespace in other branches
  1. 6.2 botcha.test \BotchaTestCase::setUp()
  2. 6.3 tests/botcha.simpletest.test \BotchaTestCase::setUp()
  3. 7.3 tests/botcha.simpletest.test \BotchaTestCase::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 BotchaBaseWebTestCase::setUp

See also

DrupalWebTestCase::prepareDatabasePrefix()

DrupalWebTestCase::changeDatabasePrefix()

DrupalWebTestCase::prepareEnvironment()

5 calls to BotchaTestCase::setUp()
BotchaHoneypot2TestCase::setUp in ./botcha.test
Sets up a Drupal site for running functional and integration tests.
BotchaHoneypotTestCase::setUp in ./botcha.test
Sets up a Drupal site for running functional and integration tests.
BotchaNoResubmitTestCase::setUp in ./botcha.test
Sets up a Drupal site for running functional and integration tests.
BotchaObscureUrlTestCase::setUp in ./botcha.test
Sets up a Drupal site for running functional and integration tests.
BotchaTimegateTestCase::setUp in ./botcha.test
Sets up a Drupal site for running functional and integration tests.
5 methods override BotchaTestCase::setUp()
BotchaHoneypot2TestCase::setUp in ./botcha.test
Sets up a Drupal site for running functional and integration tests.
BotchaHoneypotTestCase::setUp in ./botcha.test
Sets up a Drupal site for running functional and integration tests.
BotchaNoResubmitTestCase::setUp in ./botcha.test
Sets up a Drupal site for running functional and integration tests.
BotchaObscureUrlTestCase::setUp in ./botcha.test
Sets up a Drupal site for running functional and integration tests.
BotchaTimegateTestCase::setUp in ./botcha.test
Sets up a Drupal site for running functional and integration tests.

File

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

Class

BotchaTestCase
Testing general BOTCHA functionality.

Code

function setUp() {
  parent::setUp();

  // Allow comment posting for guests.
  $this
    ->allowCommentPostingForAnonymousVisitors();

  // For some reason we don't find this form after installation - but we should.
  // So fix it manually.
  Botcha::getForm('comment_node_page_form', TRUE)
    ->setEnabled(TRUE)
    ->save();

  // Create recipebook "test" + bind all forms to it.
  $recipebook = Botcha::getRecipebook('test', TRUE)
    ->setTitle('Test recipebook')
    ->setDescription("Created for {$this->testId}");
  foreach (Botcha::getForms() as $form) {
    $recipebook = $recipebook
      ->setForm($form->id);
  }
  $recipebook
    ->save();
}