function SimplenewsSourceTestCase::setUp in Simplenews 7
Same name and namespace in other branches
- 7.2 tests/simplenews.test \SimplenewsSourceTestCase::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 SimplenewsTestCase::setUp
See also
DrupalWebTestCase::prepareDatabasePrefix()
DrupalWebTestCase::changeDatabasePrefix()
DrupalWebTestCase::prepareEnvironment()
File
- tests/
simplenews.test, line 2573 - Simplenews test functions.
Class
- SimplenewsSourceTestCase
- Test cases for creating and sending newsletters.
Code
function setUp() {
parent::setUp();
// Create the filtered_html text format.
$filtered_html_format = array(
'format' => 'filtered_html',
'name' => 'Filtered HTML',
'weight' => 0,
'filters' => array(
// URL filter.
'filter_url' => array(
'weight' => 0,
'status' => 1,
),
// HTML filter.
'filter_html' => array(
'weight' => 1,
'status' => 1,
),
// Line break filter.
'filter_autop' => array(
'weight' => 2,
'status' => 1,
),
// HTML corrector filter.
'filter_htmlcorrector' => array(
'weight' => 10,
'status' => 1,
),
),
);
$filtered_html_format = (object) $filtered_html_format;
filter_format_save($filtered_html_format);
// Refresh permissions.
$this
->checkPermissions(array(), TRUE);
$this->user = $this
->drupalCreateUser(array(
'administer newsletters',
'send newsletter',
'administer nodes',
'administer simplenews subscriptions',
'create simplenews content',
'edit any simplenews content',
'view own unpublished content',
'delete any simplenews content',
'administer simplenews settings',
filter_permission_name($filtered_html_format),
));
$this
->drupalLogin($this->user);
}