You are here

public function BotchaBaseWebTestCase::setUp in BOTCHA Spam Prevention 6.3

Same name and namespace in other branches
  1. 6 botcha.test \BotchaBaseWebTestCase::setUp()
  2. 6.2 botcha.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

2 calls to BotchaBaseWebTestCase::setUp()
BotchaAdminTestCase::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.…
BotchaTestCase::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.…
2 methods override BotchaBaseWebTestCase::setUp()
BotchaAdminTestCase::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.…
BotchaTestCase::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 53
Simpletest-tests for BOTCHA module.

Class

BotchaBaseWebTestCase
Base class for BOTCHA tests.

Code

public function setUp() {

  // Backward compatibility together with support of new way of passing modules parameter.
  // @link DrupalWebTestCase::setUp() @endlink
  $modules = func_get_args();
  if (isset($modules[0]) && is_array($modules[0])) {
    $modules = $modules[0];
  }
  parent::setUp(array_merge($modules, array(
    'comment',
    'autoload',
    'moopapi',
    'dbtng',
  )));

  // @todo Abstract it.
  // @todo Keep an eye on the issue, that will make it unnecessary.
  // @see http://drupal.org/node/1843018
  dbtng_boot();
  drupal_install_modules(array(
    'botcha',
  ));
  $this
    ->resetAll();

  // Fill in the application.
  $this->application = ComponentFactory::get('Botcha', Component::TYPE_CONTROLLER, Component::ID_APPLICATION);

  // Create a normal user.
  $permissions = array(
    'access comments',
    'post comments',
    // @todo Abstract it.
    'post comments without approval',
    //'skip comment 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';

  // It is for admin test case.
  $permissions[] = 'access site reports';
  $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);
}