You are here

public function SpamWebTestCase::setUp in Spam 6

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 SpamWebTestCase::setUp()
SpamCustomFilterTestCase::setUp in filters/spam_filter_custom/tests/spam_filter_custom.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 SpamWebTestCase::setUp()
SpamCustomFilterTestCase::setUp in filters/spam_filter_custom/tests/spam_filter_custom.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/spam.test, line 20
Spam module functionality tests.

Class

SpamWebTestCase
Base class for all spam web test cases.

Code

public function setUp() {

  // From CCK CRUD test.
  $args = func_get_args();
  $modules = array_merge(array(
    'spam',
  ), $args);
  call_user_func_array(array(
    'parent',
    'setUp',
  ), $modules);

  //$this->spam = $this->randomString();
  $this->spam = $this
    ->randomString();
  $this->ham = $this
    ->randomString();
  $this->admin_user = $this
    ->drupalCreateUser(array(
    'administer spam',
    'bypass filters',
    'administer site configuration',
  ));
  $this->user = $this
    ->drupalCreateUser();

  // Login the admin.
  $this
    ->drupalLogin($this->admin_user);

  // We test spam in comments as default so we need a node of a node-type that
  // accepts comments.
  $this->node = $this
    ->drupalCreateNode(array(
    'type' => 'story',
  ));

  // For debugging put $this->debug = TRUE; in your tests setup method.
  if ($this->debug) {
    debug('Debugging is active.');
    $edit = array(
      'spam_log_level' => 5,
    );
    $this
      ->drupalPost('admin/settings/spam', $edit, t('Save configuration'));
  }
}