function TrueFalseUnitTest::setUp in Quiz 7
Same name and namespace in other branches
- 6.6 question_types/truefalse/truefalse.test \TrueFalseUnitTest::setUp()
- 6.4 question_types/truefalse/truefalse.test \TrueFalseUnitTest::setUp()
- 7.4 question_types/truefalse/truefalse.test \TrueFalseUnitTest::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
- question_types/
truefalse/ truefalse.test, line 38
Class
Code
function setUp() {
parent::setUp('taxonomy', 'quiz', 'views', 'autoload', 'multichoice', 'quiz_directions', 'quiz_question', 'querypath', 'questions_import', 'short_answer', 'truefalse', 'long_answer', 'matching', 'questions_export');
// array of drupal user permission
$permission = array(
'administer site configuration',
'access administration pages',
'administer quiz',
'access quiz',
'administer blocks',
'import questions',
'create quiz',
'administer quiz configuration',
'use PHP for block visibility',
'administer blocks',
'create multichoice',
'edit any multichoice',
'administer taxonomy',
'allow multiple correct answers',
'allow any number of answers',
'export questions',
);
// Create and log in our test user. Should be cleaned up as I something
// was wrong with permissions and I basically kept adding potentially
// useful ones until it worked.
$user = $this
->drupalCreateUser($permission);
// login into drupal site
$this
->drupalLogin($user);
// create one quiz, which will be the default in the import form
$quiz_settings = array();
$quiz_settings['title'] = $this
->randomName($this
->getRandSize());
$quiz_settings['comment'] = $this
->randomName($this
->getRandSize());
$quiz_settings['type'] = 'quiz';
//$this->drupalCreateNode($quiz_settings);
}