Changeset 3099

Show
Ignore:
Timestamp:
05/16/07 11:20:19 (3 days ago)
Author:
demian
Message:

allowing tests to execute SQL

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/0.6-bugfix/tests/classes/TestEnv.php

    r3065 r3099  
    7676    function buildSchema() 
    7777    { 
    78         $dbType = $GLOBALS['_STR']['CONF']['database']['type']; 
    79  
    8078        // get schema files 
    8179        $aSchemaFiles = $GLOBALS['_STR']['CONF']['schemaFiles']; 
     
    9694    function loadData() 
    9795    { 
    98         $dbType = $GLOBALS['_STR']['CONF']['database']['type']; 
    99  
    100         // get schema files 
     96        // get datda files 
    10197        $aDataFiles = $GLOBALS['_STR']['CONF']['dataFiles']; 
    10298 
     
    104100            foreach ($aDataFiles as $dataFile) { 
    105101                SGL_Sql::parse(STR_PATH .'/'. $dataFile, E_ALL, array('SGL_Sql', 'execute')); 
     102            } 
     103        } 
     104        //  shell_exec raw sql if exists 
     105        $aSqlFiles = $GLOBALS['_STR']['CONF']['rawSqlFiles']; 
     106        if (is_array($aSqlFiles) && count($aSqlFiles)) { 
     107            foreach ($aSqlFiles as $sqlFile) { 
     108                $file = STR_PATH .'/'. $sqlFile; 
     109                $cmd= "/usr/bin/mysql -u{$GLOBALS['_STR']['CONF']['database']['user']} {$GLOBALS['_STR']['CONF']['database']['name']} < $file"; 
     110                $ok = `$cmd`; 
    106111            } 
    107112        }