protected function AmazonBaseTest::setUp in Amazon Product Advertisement API 7.2
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()
2 calls to AmazonBaseTest::setUp()
- AmazonNodesTest::setUp in tests/
amazon.nodes.test - Sets up a Drupal site for running functional and integration tests.
- AmazonTemplatesTest::setUp in tests/
amazon.templates.test - Sets up a Drupal site for running functional and integration tests.
2 methods override AmazonBaseTest::setUp()
- AmazonNodesTest::setUp in tests/
amazon.nodes.test - Sets up a Drupal site for running functional and integration tests.
- AmazonTemplatesTest::setUp in tests/
amazon.templates.test - Sets up a Drupal site for running functional and integration tests.
File
- tests/
amazon.base.test, line 10 - Base tests for Amazon module.
Class
- AmazonBaseTest
- @file Base tests for Amazon module.
Code
protected function setUp($modules = array()) {
$modules = array_merge(array(
'amazon',
'asin',
'node',
'field_ui',
'amazon_test',
), $modules);
parent::setUp($modules);
// Create Admin user.
$this->admin_user = $this
->drupalCreateUser(array(
'administer content types',
'administer nodes',
'create article content',
'edit any article content',
'administer fields',
'administer amazon',
));
$this
->drupalLogin($this->admin_user);
// Generate and store an Id.
$id = _amazon_test_random_id($this
->randomString());
// Module settings.
variable_set('amazon_refresh_schedule', REQUEST_TIME + 3600);
variable_set('amazon_aws_access_key', $id);
variable_set('amazon_aws_secret_access_key', $id);
variable_set('amazon_default_locale', 'US');
variable_set('amazon_locale_US_associate_id', 'test-20');
variable_set('amazon_locale_UK_associate_id', 'test-21');
}