MDL-35272 Fix typo in qformat_blackboard_six.php
[moodle.git] / lib / simpletest / testunittestusingdb.php
blob7bc487bce51ee86af7ec6b8db5f1d35178eaf470
1 <?php
2 if (!defined('MOODLE_INTERNAL')) {
3 die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
6 class UnitTestCaseUsingDatabase_test extends UnitTestCaseUsingDatabase {
8 function test_stuff() {
9 global $CFG, $DB;
10 $dbman = $this->testdb->get_manager();
12 $this->assertFalse($dbman->table_exists('quiz_attempts'));
13 $this->assertFalse($dbman->table_exists('quiz'));
14 $this->create_test_table('quiz_attempts', 'mod/quiz');
15 $this->assertTrue($dbman->table_exists('quiz_attempts'));
16 $this->assertFalse($dbman->table_exists('quiz'));
18 $this->load_test_data('quiz_attempts',
19 array('quiz', 'uniqueid', 'attempt', 'preview', 'layout'), array(
20 array( 1 , 1 , 1 , 0 , '1,2,3,0'),
21 array( 1 , 2 , 2 , 1 , '2,3,1,0')));
23 $this->switch_to_test_db();
24 require_once($CFG->dirroot . '/mod/quiz/locallib.php');
25 $this->assertTrue(quiz_has_attempts(1));
26 $this->revert_to_real_db();
28 $this->drop_test_table('quiz_attempts');
29 $this->assertFalse($dbman->table_exists('quiz_attempts'));