function QuestionsImportTestCase::setUp in Quiz 6.6
Generates a random database prefix, runs the install scripts on the prefixed database and enable the specified modules. After installation many caches are flushed and the internal browser is setup so that the page requests will run on the new prefix. A temporary files directory is created with the same name as the database prefix.
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
File
- includes/
questions_import/ questions_import.test, line 28
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');
// 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(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',
));
$this
->drupalLogin($user);
// create one quiz, which will be the default in the import form
$quiz_settings = array();
$quiz_settings['title'] = $this
->randomName(128);
$quiz_settings['comment'] = $this
->randomName(256);
$quiz_settings['type'] = 'quiz';
$this
->drupalCreateNode($quiz_settings);
}