コード例 #1
0
ファイル: testdmllib.php プロジェクト: r007/PMoodle
 function setUp()
 {
     global $CFG, $db;
     parent::setUp();
     load_test_table($CFG->prefix . $this->table, $this->data, $db);
     $keys = reset($this->data);
     foreach ($this->data as $row => $datum) {
         if ($row == 0) {
             continue;
         }
         $this->objects[$datum[0]] = (object) array_combine($keys, $datum);
     }
 }
コード例 #2
0
 function setUp()
 {
     // Set db prefix for testing
     global $CFG, $USER;
     $this->beforeprefix = $CFG->prefix;
     $this->beforeuser = $USER;
     $CFG->prefix = self::TESTPREFIX;
     // Delete existing tables
     $this->delete_tables();
     // Install new wiki tables and core user table
     ob_start();
     install_from_xmldb_file(dirname(__FILE__) . '/../db/install.xml');
     ob_end_clean();
     load_test_table(self::TESTPREFIX . 'user', array(array('id', 'username', 'firstname', 'lastname'), array(1, 'u1', 'user', 'one'), array(2, 'u2', 'user', 'two'), array(3, 'u3', 'user', 'three')));
     $USER = get_record('user', 'id', 1);
 }