コード例 #1
0
ファイル: Tests.php プロジェクト: halfer/Meshing
 /**
  * Builds a system db for the test environment
  * 
  * @todo This replicates some code in Command/System/Build - needs to be much more DRY
  */
 protected function buildTestSystemDatabase()
 {
     // Load the Meshing_Test_Paths class
     $projectRoot = Meshing_Utils::getProjectRoot();
     require_once $projectRoot . '/tests/unit/Meshing_Test_Paths.php';
     Meshing_Utils::reinitialise(new Meshing_Test_Paths());
     $paths = Meshing_Utils::getPaths();
     // Build a system connection file
     $task = new Meshing_Propel_ConfBuilder();
     $task->addSchemas($projectRoot . $paths->getPathDbConfig(), $paths->getLeafStandardSchema());
     $task->setXmlFile($projectRoot . $paths->getFileRuntimeXml());
     $task->setPropelConnection(Meshing_Utils::CONN_SYSTEM_TEST);
     $task->setOutputDir($projectRoot . $paths->getPathConnsSystem());
     $task->setOutputFile($paths->getLeafRuntimePhp());
     $task->run();
     // Build the SQL for a test system database
     $task = new Meshing_Propel_SqlBuilder();
     $task->addSchemas($projectRoot . $paths->getPathDbConfig(), $paths->getLeafStandardSchema());
     $task->setOutputDir($projectRoot . $paths->getPathSqlSystem());
     $task->setPropelConnection(Meshing_Utils::CONN_SYSTEM_TEST);
     $task->run();
     // Run the sql
     $task = new Meshing_Propel_SqlRunner();
     $task->setSqlDir($projectRoot . $paths->getPathSqlSystem());
     $task->setMapFile($projectRoot . $paths->getFileDbMap());
     $task->setPropelConnection(Meshing_Utils::CONN_SYSTEM_TEST);
     $task->run();
 }
コード例 #2
0
ファイル: Regen.php プロジェクト: halfer/Meshing
 /**
  * Takes an XML config file and converts it to PHP config files
  * 
  * @param string $runTime Full pathname of the XML config file
  * @param string $outputDir Path of the output directory
  * @param string $outputFile Base leafname of the output PHP file
  */
 protected function convertConf($runTime, $outputDir, $outputFile)
 {
     $schemaDir = $this->projectRoot . Meshing_Utils::getPaths()->getPathDbConfig();
     $schemas = "schema.xml";
     $task = new Meshing_Propel_ConfBuilder();
     $task->addSchemas($schemaDir, $schemas);
     $task->setXmlFile($runTime);
     $task->setOutputDir($outputDir);
     $task->setOutputFile($outputFile);
     $task->setPropelConnection();
     $task->run();
 }
コード例 #3
0
ファイル: Add.php プロジェクト: halfer/Meshing
 /**
  * Creates a PHP configuration and classmaps files
  * 
  * @todo Merge this with Regen::convertConf, put them both in
  * Meshing_Console_Command_Connection_Base.
  */
 protected function convertConf($runTime, $outputDir, $outputFile)
 {
     $schemas = "schema.xml";
     $task = new Meshing_Propel_ConfBuilder();
     $task->setPropelConnection();
     $task->addSchemas($this->schemaDir, $schemas);
     $task->setXmlFile($runTime);
     $task->setOutputDir($outputDir);
     $task->setOutputFile($outputFile);
     $task->setPropelConnection();
     $task->run();
 }
コード例 #4
0
ファイル: DatabaseTestCase.php プロジェクト: halfer/Meshing
 /**
  * Build runtime configuration files, optionally testing them
  * 
  * @param type $runTests 
  */
 protected function _testConfBuilder($runTests = true)
 {
     $xmlFile = $this->projectRoot . $this->paths->getFileRuntimeXml();
     $outputFile = $this->paths->getLeafRuntimePhp();
     $task = new Meshing_Propel_ConfBuilder();
     $task->addSchemas($this->outputSchemaDir, $this->paths->getLeafStandardSchema());
     $task->setXmlFile($xmlFile);
     $task->setOutputDir($this->connNodeDir);
     $task->setOutputFile($outputFile);
     $task->setPropelConnection(Meshing_Utils::CONN_NODE_TEST_1);
     $task->run();
     if ($runTests) {
         $this->assertTrue(file_exists($this->connNodeDir . '/' . $outputFile), 'Check connections file has been generated');
         $this->assertTrue(file_exists($this->connNodeDir . '/classmap-' . $outputFile), 'Check classmap file has been generated');
     }
 }