public function Profile2RegpathAccessTest::setUp in Profile2 Registration Path 7.2
Same name and namespace in other branches
- 7 tests/Profile2RegpathAccessTest.test \Profile2RegpathAccessTest::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()
File
- tests/
Profile2RegpathAccessTest.test, line 25 - Contains Profile2RegpathAccessTest.
Class
- Profile2RegpathAccessTest
- @file Contains Profile2RegpathAccessTest.
Code
public function setUp() {
$modules[] = 'profile2';
$modules[] = 'profile2_regpath';
parent::setUp($modules);
// Set up a profile.
$profile_type = new ProfileType(array(
'type' => 'registration_path',
'label' => 'Registration Path',
));
profile2_type_save($profile_type);
// Configure a registration path.
$profile_id = profile2_regpath_get_profile_id($profile_type
->identifier());
$fields = array(
'profile_type' => $profile_type
->identifier(),
'path' => 'reg-path',
'status' => 1,
'weight' => 0,
'roles' => serialize(array()),
'misc' => serialize(array(
'fieldset_wrap' => 0,
'custom_titles' => 0,
'login_title' => 'User Account',
'register_title' => 'User Account',
'password_title' => 'User Account',
'confirmation_display' => 0,
'confirmation_message' => '',
)),
);
db_merge('profile2_regpath')
->key(array(
'profile_id' => $profile_id,
))
->fields($fields)
->execute();
}