예제 #1
0
 public function test_database_to_pdo()
 {
     $fixutres = new Functest_Fixture();
     $pdo = $fixutres->database_to_pdo(Kohana::TESTING);
     $this->assertInstanceOf('PDO', $pdo);
     $pdo = $fixutres->database_to_pdo('pdo_test');
     $this->assertInstanceOf('PDO', $pdo);
     $this->setExpectedException('Kohana_Exception');
     $pdo = $fixutres->database_to_pdo('pdo_not_exists');
 }
예제 #2
0
 public static function instance()
 {
     if (!Functest_Fixture::$_instance) {
         Functest_Fixture::$_instance = new Functest_Fixture();
     }
     return Functest_Fixture::$_instance;
 }
예제 #3
0
 public static function load_fixtures()
 {
     $fixture = Functest_Fixture::instance();
     $import_sql = Kohana::cache(Functest_Tests::FIXTURE_CACHE);
     if ($import_sql) {
         $fixture->replace($import_sql);
     } else {
         $fixture->truncate_all();
         $fixture->execute_import_files(Functest_Tests::fixture_files());
         Kohana::cache(Functest_Tests::FIXTURE_CACHE, $fixture->dump(), Date::HOUR);
     }
 }