function CaptchaBaseWebTestCase::setUp in CAPTCHA 7
Same name and namespace in other branches
- 6.2 captcha.test \CaptchaBaseWebTestCase::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 DrupalWebTestCase::setUp
See also
DrupalWebTestCase::prepareDatabasePrefix()
DrupalWebTestCase::changeDatabasePrefix()
DrupalWebTestCase::prepareEnvironment()
1 call to CaptchaBaseWebTestCase::setUp()
- ImageCaptchaWebTestCase::setUp in image_captcha/
image_captcha.test - Sets up a Drupal site for running functional and integration tests.
1 method overrides CaptchaBaseWebTestCase::setUp()
- ImageCaptchaWebTestCase::setUp in image_captcha/
image_captcha.test - Sets up a Drupal site for running functional and integration tests.
File
- ./
captcha.test, line 61 - Tests for CAPTCHA module.
Class
- CaptchaBaseWebTestCase
- Base class for CAPTCHA tests.
Code
function setUp() {
// Load two modules: the captcha module itself and the comment module for testing anonymous comments.
$modules = func_get_args();
if (isset($modules[0]) && is_array($modules[0])) {
$modules = $modules[0];
}
parent::setUp(array_merge(array(
'captcha',
'comment',
), $modules));
module_load_include('inc', 'captcha');
// Create a normal user.
$permissions = array(
'access comments',
'post comments',
'skip comment approval',
'access content',
'create page content',
'edit own page content',
);
$this->normal_user = $this
->drupalCreateUser($permissions);
// Create an admin user.
$permissions[] = 'administer CAPTCHA settings';
$permissions[] = 'skip CAPTCHA';
$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);
}