예제 #1
0
파일: model.php 프로젝트: ssrsfs/blg
 public function setUp()
 {
     if (!$this->modelClass) {
         throw new Exception("modelClass needs to be defined in the constructor.");
     }
     if (!class_exists($this->modelClass) || !is_subclass_of($this->modelClass, 'Dbi_Model')) {
         throw new Exception("'{$this->modelClass}' is not a valid Dbi_Model.");
     }
     self::$OldSource = Dbi_Source::GetGlobalSource();
     // Mock source
     self::$Source = new MockDbi_Source();
     $cls = $this->modelClass;
     self::$Source->returns('select', array(new Dbi_Record(new $cls(), $this->mockRecordData())));
     self::$Source->returns('insert', $this->mockRecordData());
     // Replace the configured global source with the mock
     Dbi_Source::SetGlobalSource(self::$Source);
 }
예제 #2
0
파일: Typeframe.php 프로젝트: ssrsfs/blg
 /**
  * Get a reference to the global database interface.
  * @return Dbi_Source
  */
 public static function Database()
 {
     return Dbi_Source::GetGlobalSource();
 }