Beispiel #1
0
 public static function suite()
 {
     $suite = new TestSuite('onPHP-' . ONPHP_VERSION);
     foreach (self::$paths as $testPath) {
         foreach (glob($testPath . '*Test' . EXT_CLASS, GLOB_BRACE) as $file) {
             $suite->addTestFile($file);
         }
     }
     // meta, DB and DAOs ordered tests portion
     if (self::$dbs) {
         try {
             Singleton::getInstance('DBTestPool', self::$dbs)->connect();
         } catch (Exception $e) {
             Singleton::dropInstance('DBTestPool');
             Singleton::getInstance('DBTestPool');
         }
         // build stuff from meta
         $metaDir = ONPHP_TEST_PATH . 'meta' . DIRECTORY_SEPARATOR;
         $path = ONPHP_META_PATH . 'bin' . DIRECTORY_SEPARATOR . 'build.php';
         $_SERVER['argv'] = array();
         $_SERVER['argv'][0] = $path;
         $_SERVER['argv'][1] = $metaDir . 'config.inc.php';
         $_SERVER['argv'][2] = $metaDir . 'config.meta.xml';
         $_SERVER['argv'][] = '--force';
         $_SERVER['argv'][] = '--no-schema-check';
         $_SERVER['argv'][] = '--drop-stale-files';
         include $path;
         // provide paths to autogenerated stuff
         set_include_path(get_include_path() . PATH_SEPARATOR . ONPHP_META_AUTO_BUSINESS_DIR . PATH_SEPARATOR . ONPHP_META_AUTO_DAO_DIR . PATH_SEPARATOR . ONPHP_META_AUTO_PROTO_DIR . PATH_SEPARATOR . ONPHP_META_DAO_DIR . PATH_SEPARATOR . ONPHP_META_BUSINESS_DIR . PATH_SEPARATOR . ONPHP_META_PROTO_DIR);
         $daoTest = new DAOTest();
         $out = MetaConfiguration::me()->getOutput();
         foreach (DBTestPool::me()->getPool() as $connector => $db) {
             DBPool::me()->setDefault($db);
             $out->info('Using ')->info(get_class($db), true)->infoLine(' connector.');
             try {
                 $daoTest->drop();
             } catch (DatabaseException $e) {
                 // previous shutdown was clean
             }
             $daoTest->create()->fill(false);
             MetaConfiguration::me()->checkIntegrity();
             $out->newLine();
             $daoTest->drop();
         }
         DBPool::me()->dropDefault();
     }
     $suite->addTestSuite('DAOTest');
     return $suite;
 }
Beispiel #2
0
 public static function tearDownAfterClass()
 {
     self::$sqLite = NULL;
     self::$DAO = NULL;
 }
Beispiel #3
0
    {
        return UserDAOImpl::find($pageNum, $pageSize);
    }
    public static function testGetAllCols()
    {
        return $fields = R::inspect('user');
    }
    public static function testGetAllCount()
    {
        return UserDAOImpl::getAllCount();
    }
    public static function testFindByKeyword()
    {
        return UserDAOImpl::findByKeyword('uid', 'x');
    }
    public static function testFindOne($uid, $password)
    {
        $user = UserDAOImpl::doLogin($uid, $password);
        if (null == $user) {
            echo "no matched record";
        } else {
            echo $user->uid . " \t " . $user->password . " \t " . $user->age . "\n";
        }
    }
}
$daoTest = new DAOTest();
$daoTest->testFindOne('xinerd', 'test');
//foreach ($users as $user) {
//}
//$logs = R::getLogs(); //obtain logs
//print_r($logs);