You are here

public function BotchaTestCase::setUp in BOTCHA Spam Prevention 6.3

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

5 calls to BotchaTestCase::setUp()
BotchaHoneypot2TestCase::setUp in tests/botcha.simpletest.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.…
BotchaHoneypotTestCase::setUp in tests/botcha.simpletest.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.…
BotchaNoResubmitTestCase::setUp in tests/botcha.simpletest.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.…
BotchaObscureUrlTestCase::setUp in tests/botcha.simpletest.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.…
BotchaTimegateTestCase::setUp in tests/botcha.simpletest.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.…
5 methods override BotchaTestCase::setUp()
BotchaHoneypot2TestCase::setUp in tests/botcha.simpletest.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.…
BotchaHoneypotTestCase::setUp in tests/botcha.simpletest.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.…
BotchaNoResubmitTestCase::setUp in tests/botcha.simpletest.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.…
BotchaObscureUrlTestCase::setUp in tests/botcha.simpletest.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.…
BotchaTimegateTestCase::setUp in tests/botcha.simpletest.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

tests/botcha.simpletest.test, line 991
Simpletest-tests for BOTCHA module.

Class

BotchaTestCase
Testing general BOTCHA functionality.

Code

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

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

  // @todo Debug this situation: tests don't have any content types at the moment of the BOTCHA enabling.
  // It causes lack of some form protection: comment_node_page_form as an example.
  // For some reason we don't find this form after installation - but we should.
  // So fix it manually.
  $form_controller = $this->application
    ->getController(Botcha::CONTROLLER_TYPE_FORM);
  $botcha_form = $form_controller
    ->getForm('comment_node_page_form', TRUE)
    ->setRecipebook('default')
    ->setEnabled(TRUE);
  $this
    ->assertEqual($botcha_form, $form_controller
    ->save($botcha_form), 'Form object correctly saved.', 'BOTCHA');

  // Create recipebook "test" + bind all forms to it.
  $recipebook_controller = $this->application
    ->getController(Botcha::CONTROLLER_TYPE_RECIPEBOOK);
  $recipebook = $recipebook_controller
    ->getRecipebook('test', TRUE)
    ->setTitle('Test recipebook')
    ->setDescription("Created for {$this->testId}");
  $default_recipebook = $recipebook_controller
    ->getRecipebook();
  foreach ($default_recipebook
    ->getForms() as $form_id) {
    $recipebook = $recipebook
      ->setForm($form_id);
  }
  $this
    ->assertEqual($recipebook, $recipebook_controller
    ->save($recipebook), 'Recipebook object correctly saved.', 'BOTCHA');
}