Esempio n. 1
0
 /**
  * Returns contents of all tables right after installation.
  * @static
  * @return array  $table=>$records
  */
 protected static function get_tabledata()
 {
     $framework = self::get_framework();
     $datafile = self::get_dataroot() . '/' . $framework . '/tabledata.ser';
     if (!file_exists($datafile)) {
         // Not initialised yet.
         return array();
     }
     if (!isset(self::$tabledata)) {
         $data = file_get_contents($datafile);
         self::$tabledata = unserialize($data);
     }
     if (!is_array(self::$tabledata)) {
         testing_error(1, 'Can not read dataroot/' . $framework . '/tabledata.ser or invalid format, reinitialize test database.');
     }
     return self::$tabledata;
 }