Exemplo n.º 1
0
 /**
  * Returns structure of all tables right after installation.
  * @static
  * @return array $table=>$records
  */
 public static function get_tablestructure()
 {
     global $CFG;
     if (!file_exists("{$CFG->dataroot}/phpunit/tablestructure.ser")) {
         // not initialised yet
         return array();
     }
     if (!isset(self::$tablestructure)) {
         $data = file_get_contents("{$CFG->dataroot}/phpunit/tablestructure.ser");
         self::$tablestructure = unserialize($data);
     }
     if (!is_array(self::$tablestructure)) {
         phpunit_bootstrap_error(1, 'Can not read dataroot/phpunit/tablestructure.ser or invalid format, reinitialize test database.');
     }
     return self::$tablestructure;
 }