Пример #1
0
 /**
  * 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
<?php

// Set up project
$projectRoot = realpath(dirname(__FILE__) . '/../../..');
require_once $projectRoot . '/lib/Meshing/Paths.php';
require_once $projectRoot . '/tests/unit/Meshing_Test_Paths.php';
require_once $projectRoot . '/lib/Meshing/Utils.php';
Meshing_Utils::reinitialise(new Meshing_Test_Paths());
define('CHILD_TOKEN', 'meshing_test');
define('LOCKING_TEST_LOG', 'log.log');
// If we're running the child here, we'll pass an token
global $argv;
$token = array_key_exists(1, $argv) ? $argv[1] : null;
if ($token == CHILD_TOKEN) {
    // Initialise database (normally done by DatabaseTestCase)
    Meshing_Utils::initialiseDb($testMode = true);
    Meshing_Utils::initialiseNodeDbs('test_model', $testMode);
    // Run child test
    new LockingTestCaseChild($argv[2]);
    exit;
} else {
    // Init simpletest
    require_once 'simpletest/autorun.php';
}
class LockingTestCase extends Meshing_Test_ModelTestCase
{
    public function __construct($label = false)
    {
        // Same package name as test 2
        parent::__construct('test_model', $label);
        $this->node = $this->createKnownNode(new TestModelKnownNode(), $this->conNode);