コード例 #1
0
 /**
  * @return EnumClassPattern
  **/
 public function build(MetaClass $class)
 {
     $userFile = ONPHP_META_BUSINESS_DIR . $class->getName() . EXT_CLASS;
     if (MetaConfiguration::me()->isForcedGeneration() || !file_exists($userFile)) {
         $this->dumpFile($userFile, Format::indentize(EnumClassBuilder::build($class)));
     }
     return $this;
 }
コード例 #2
0
ファイル: AllTests.php プロジェクト: rero26/onphp-framework
 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;
 }
コード例 #3
0
 public static function suite()
 {
     $suite = new TestSuite('onPHP-' . ONPHP_VERSION);
     // meta, DB and DAOs ordered tests portion
     if (self::$dbs) {
         try {
             /**
              * @todo fail - constructor with argument, but static method 'me' - without
              */
             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;
         AutoloaderPool::get('onPHP')->addPaths(array(ONPHP_META_AUTO_BUSINESS_DIR, ONPHP_META_AUTO_DAO_DIR, ONPHP_META_AUTO_PROTO_DIR, ONPHP_META_DAO_DIR, ONPHP_META_BUSINESS_DIR, ONPHP_META_PROTO_DIR));
         $dBCreator = DBTestCreator::create()->setSchemaPath(ONPHP_META_AUTO_DIR . 'schema.php')->setTestPool(DBTestPool::me());
         $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.');
             $dBCreator->dropDB(true);
             $dBCreator->createDB()->fillDB();
             MetaConfiguration::me()->checkIntegrity();
             $out->newLine();
             $dBCreator->dropDB();
         }
         DBPool::me()->dropDefault();
     }
     foreach (self::$paths as $testPath) {
         foreach (glob($testPath . '*Test' . EXT_CLASS, GLOB_BRACE) as $file) {
             $suite->addTestFile($file);
         }
     }
     return $suite;
 }
コード例 #4
0
 /**
  * @return BasePattern
  **/
 protected function buildDao(MetaClass $class)
 {
     $this->dumpFile(ONPHP_META_AUTO_DAO_DIR . 'Auto' . $class->getName() . 'DAO' . EXT_CLASS, Format::indentize(AutoDaoBuilder::build($class)));
     $userFile = ONPHP_META_DAO_DIR . $class->getName() . 'DAO' . EXT_CLASS;
     if (MetaConfiguration::me()->isForcedGeneration() || !file_exists($userFile)) {
         $this->dumpFile($userFile, Format::indentize(DaoBuilder::build($class)));
     }
     return $this;
 }
コード例 #5
0
 /**
  * @return MetaClass
  **/
 public function getClass()
 {
     return MetaConfiguration::me()->getClassByName($this->className);
 }
コード例 #6
0
 public function hasChilds()
 {
     foreach (MetaConfiguration::me()->getClassList() as $class) {
         if ($class->getParent() && $class->getParent()->getName() == $this->getName()) {
             return true;
         }
     }
     return false;
 }
コード例 #7
0
ファイル: build.php プロジェクト: rero26/onphp-framework
        if (file_exists($path)) {
            $pathMeta = $path;
            $out->remark($path)->logLine('.');
            break;
        }
    }
    if (!$pathMeta) {
        $out->errorLine('failed.');
    }
}
if ($pathMeta && $pathConfig) {
    require $pathConfig;
    init();
    $out->newLine()->infoLine('onPHP-' . ONPHP_VERSION . ': MetaConfiguration builder.', true)->newLine();
    try {
        $meta = MetaConfiguration::me()->setOutput($out)->load(ONPHP_META_PATH . 'internal.xml', false);
        $out->info('Known internal classes: ');
        foreach ($meta->getClassList() as $class) {
            $out->info($class->getName() . ', ', true);
        }
        $out->infoLine("that's all.")->newLine();
        $meta->setDryRun($metaDryRun)->load($pathMeta)->setForcedGeneration($metaForce);
        if ($metaOnlyContainers) {
            $meta->buildContainers();
        } else {
            $meta->buildClasses()->buildContainers();
            if (!$metaNoSchema) {
                $meta->buildSchema();
            }
            if (!$metaNoSchemaCheck) {
                $meta->buildSchemaChanges();