Changeset 217

Show
Ignore:
Timestamp:
04/26/07 17:55:27 (2 years ago)
Author:
bermiferrer
Message:

First take on the Logging engine. Just define the constant AK_LOG_EVENTS as true in your config/development.php file and a log for all the Active Record SQL queries will be generated at "logs/localhost.log". Added also workaround to avoid calling static functions that break the tests on PHP 5.1.6 +

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/config/boot.php

    r172 r217  
    196196ak_define('MODE_DIE', 16); 
    197197 
     198ak_define('LOG_EVENTS', false); 
    198199 
    199200ak_define('ROUTES_MAPPING_FILE', AK_CONFIG_DIR.DS.'routes.php'); 
  • trunk/lib/Ak.php

    r204 r217  
    499499    function url_get_contents($url, $options = array()) 
    500500    { 
    501         Ak::compat('http_build_query'); 
     501        ak_compat('http_build_query'); 
    502502 
    503503        $default_options = array( 
     
    733733 
    734734 
    735  
    736     /** 
    737     * Log a system message into the database. 
    738     * 
    739     * @param $type The category to which this message belongs. Usually a model or a controller. 
    740     * @param $message The message to store in the log. 
    741     * @param $severity The severity of the message. One of the following values: 
    742     * - AK_LOG_NOTICE 
    743     * - AK_LOG_WARNING 
    744     * - AK_LOG_ERROR 
    745     * @param $link A link to associate with the message. 
    746     */ 
    747     function log($type, $message, $severity = AK_LOG_NOTICE, $link = NULL) 
    748     { 
    749         $DB =& Ak::db(); 
    750         $DB->debug=true; 
    751  
    752         /** 
    753         * @todo use a function like Ak::get_user_id() to fetch user id and insert it into the log. 
    754         * meanwhile we will use user 0; 
    755         */ 
    756         $user_id = 0; 
    757  
    758         $sql = "INSERT INTO log ( user_id, type, message, severity, link, location, hostname, created ) 
    759                 VALUES (". 
    760         $user_id.', '. 
    761         $DB->qstr($type).', '. 
    762         $DB->qstr($message).', '. 
    763         $severity.', '. 
    764         $DB->qstr($link).', '. 
    765         $DB->qstr(AK_REQUEST_URI).', '. 
    766         $DB->qstr($_SERVER['REMOTE_ADDR']).', '. 
    767         $DB->DBTimeStamp(Ak::time()). 
    768         ');'; 
    769         if ($DB->Execute($sql) === false) { 
    770             trigger_error('Error inserting: '.$DB->ErrorMsg(),E_USER_WARNING); 
    771         } 
    772     } 
    773  
    774  
     735    function &getLogger() 
     736    { 
     737        static $Logger; 
     738        if(empty($Logger)){ 
     739            require_once(AK_LIB_DIR.DS.'AkLogger.php'); 
     740            $Logger =& new AkLogger(); 
     741        } 
     742        return $Logger; 
     743    } 
    775744 
    776745 
     
    10991068            switch ($xml_elem['type']) { 
    11001069                case 'open': 
    1101                 $tag_or_id = (array_key_exists ('attributes', $xml_elem)) ? @$xml_elem['attributes']['ID'] : $xml_elem['tag']; 
    1102                 $ptrs[$level][$tag_or_id][] = array (); 
    1103                 $ptrs[$level+1] = & $ptrs[$level][$tag_or_id][count($ptrs[$level][$tag_or_id])-1]; 
    1104                 break; 
     1070                    $tag_or_id = (array_key_exists ('attributes', $xml_elem)) ? @$xml_elem['attributes']['ID'] : $xml_elem['tag']; 
     1071                    $ptrs[$level][$tag_or_id][] = array (); 
     1072                    $ptrs[$level+1] = & $ptrs[$level][$tag_or_id][count($ptrs[$level][$tag_or_id])-1]; 
     1073                    break; 
    11051074                case 'complete': 
    1106                 $ptrs[$level][$xml_elem['tag']] = (isset ($xml_elem['value'])) ? $xml_elem['value'] : ''; 
    1107                 break; 
     1075                    $ptrs[$level][$xml_elem['tag']] = (isset ($xml_elem['value'])) ? $xml_elem['value'] : ''; 
     1076                    break; 
    11081077            } 
    11091078        } 
     
    13321301    function compat($function_name) 
    13331302    { 
    1334         if(!function_exists($function_name)){ 
    1335             require_once(AK_VENDOR_DIR.DS.'pear'.DS.'PHP'.DS.'Compat'.DS.'Function'.DS.$function_name.'.php'); 
    1336         } 
     1303        ak_compat($function_name); 
    13371304    } 
    13381305 
     
    16081575    { 
    16091576        static $mime_types; 
    1610         Ak::compat('mime_content_type'); 
     1577        ak_compat('mime_content_type'); 
    16111578 
    16121579        $mime = mime_content_type($file); 
     
    17141681    function test($test_case_name, $use_sessions = false) 
    17151682    { 
    1716         if(!defined('ALL_TESTS_CALL')){ 
    1717             $use_sessions ? @session_start() : null; 
    1718             $test = &new $test_case_name(); 
    1719             if (defined('AK_CLI') && AK_CLI || TextReporter::inCli() || (defined('AK_CONSOLE_MODE') && AK_CONSOLE_MODE) || (defined('AK_WEB_REQUEST') && !AK_WEB_REQUEST)) { 
    1720                 $test->run(new TextReporter()); 
    1721             }else{ 
    1722                 $test->run(new HtmlReporter()); 
    1723             } 
    1724         } 
     1683        ak_test($test_case_name, $use_sessions); 
    17251684    } 
    17261685 
     
    17851744 
    17861745 
     1746function ak_test($test_case_name, $use_sessions = false) 
     1747{ 
     1748    if(!defined('ALL_TESTS_CALL')){ 
     1749        $use_sessions ? @session_start() : null; 
     1750        $test = &new $test_case_name(); 
     1751        if (defined('AK_CLI') && AK_CLI || TextReporter::inCli() || (defined('AK_CONSOLE_MODE') && AK_CONSOLE_MODE) || (defined('AK_WEB_REQUEST') && !AK_WEB_REQUEST)) { 
     1752            $test->run(new TextReporter()); 
     1753        }else{ 
     1754            $test->run(new HtmlReporter()); 
     1755        } 
     1756    } 
     1757} 
     1758 
     1759function ak_compat($function_name) 
     1760{ 
     1761        if(!function_exists($function_name)){ 
     1762        require_once(AK_VENDOR_DIR.DS.'pear'.DS.'PHP'.DS.'Compat'.DS.'Function'.DS.$function_name.'.php'); 
     1763    } 
     1764} 
     1765 
     1766function ak_generate_mock($name) 
     1767{ 
     1768        static $Mock; 
     1769        if(empty($Mock)){ 
     1770                $Mock = new Mock(); 
     1771        } 
     1772        $Mock->generate($name); 
     1773} 
     1774 
     1775 
    17871776AK_PHP5 ? null : eval('function clone($object){return $object;}'); 
    17881777 
  • trunk/lib/AkActiveRecord.php

    r214 r217  
    3131ak_define('POST_CODE_REGULAR_EXPRESSION',"/^[0-9A-Za-z  -]{2,9}$/"); 
    3232 
    33 Ak::compat('array_combine'); 
     33ak_compat('array_combine'); 
    3434 
    3535/** 
     
    228228    function init($attributes = array()) 
    229229    { 
     230        AK_LOG_EVENTS ? ($this->Logger =& Ak::getLogger()) : null; 
     231         
    230232        $this->_internationalize = is_null($this->_internationalize) ? count($this->getAvaliableLocales()) > 1 : $this->_internationalize; 
    231233 
     
    408410            $this->setConnection(); 
    409411        } 
     412         
     413        AK_LOG_EVENTS ? ($this->Logger->message($this->getModelName().' executing SQL: '.$sql)) : null; 
    410414        $rs = $this->_db->Execute($sql); 
    411415 
     
    510514        $sql = 'UPDATE '.$this->getTableName().' SET '.$updates; 
    511515        $sql  .= isset($conditions) ? ' WHERE '.$conditions : ''; 
    512         if(!$this->_db->Execute($sql) && AK_DEBUG){ 
    513             trigger_error($this->_db->ErrorMsg(), E_USER_NOTICE); 
    514         } 
     516        $this->_executeSql($sql); 
    515517        return $this->_db->Affected_Rows(); 
    516518    } 
     
    577579 
    578580        $sql  .= isset($conditions) ? ' WHERE '.$conditions : ($this->_getDatabaseType() == 'sqlite' ? ' WHERE 1' : ''); // (HACK) If where clause is not included sqlite_changes will not get the right result 
    579         if(!$this->_db->Execute($sql) && AK_DEBUG){ 
    580             trigger_error($this->_db->ErrorMsg(), E_USER_NOTICE); 
    581         } 
     581        $this->_executeSql($sql); 
    582582        return $this->_db->Affected_Rows() > 0; 
    583583    } 
     
    621621 
    622622                    $sql = 'DELETE FROM '.$this->getTableName().' WHERE '.$this->getPrimaryKey().' = '.$this->_db->qstr($this->getId()); 
    623  
    624                     if(!$this->_db->Execute($sql) && AK_DEBUG){ 
    625                         trigger_error($this->_db->ErrorMsg(), E_USER_NOTICE); 
    626                     } 
     623                    $this->_executeSql($sql); 
    627624                    $had_success = ($this->_db->Affected_Rows() > 0); 
    628625                    if(!$had_success || ($had_success && !$this->afterDestroy())){ 
     
    10751072        } 
    10761073        $this->setConnection(); 
     1074         
     1075        AK_LOG_EVENTS ? $this->_startSqlBlockLog() : null; 
     1076                 
    10771077        $objects = array(); 
    10781078        if(is_integer($limit)){ 
     
    10851085            $results = !empty($bindings) ? $this->_db->Execute($sql, $bindings) : $this->_db->Execute($sql); 
    10861086        } 
     1087         
     1088        AK_LOG_EVENTS ? $this->_endSqlBlockLog() : null; 
    10871089 
    10881090        if(!$results){ 
     
    30823084            } 
    30833085 
    3084             if(!$this->_db->Execute($sql)){ 
     3086            if(!$this->_executeSql($sql, false)){ 
    30853087                $this->transactionFail(); 
    30863088                AK_DEBUG ? trigger_error($this->_db->ErrorMsg(), E_USER_NOTICE) : null; 
     
    32093211            'VALUES ('.join(',',array_values($attributes)).')'; 
    32103212 
    3211             if(!$this->_db->Execute($sql)){ 
     3213            if(!$this->_executeSql($sql, false)){ 
    32123214                AK_DEBUG ? trigger_error($this->_db->ErrorMsg(), E_USER_NOTICE) : null; 
    32133215            } 
     
    49354937        } 
    49364938    } 
     4939     
    49374940} 
    49384941 
  • trunk/lib/AkActiveRecord/AkAssociatedActiveRecord.php

    r173 r217  
    344344        } 
    345345        $this->setConnection(); 
     346 
     347        AK_LOG_EVENTS ? $this->_startSqlBlockLog() : null; 
     348         
    346349        $objects = array(); 
    347350        $_included_results = array(); // Used only in conjuntion with virtual limits for doing find('first',...include'=>... 
     
    362365        } 
    363366 
     367        AK_LOG_EVENTS ? $this->_endSqlBlockLog() : null; 
     368         
    364369        if(!$results && AK_DEBUG){ 
    365370            trigger_error($this->_db->ErrorMsg(), E_USER_NOTICE); 
  • trunk/lib/AkBaseModel.php

    r111 r217  
    1616 * @license GNU Lesser General Public License <http://www.gnu.org/copyleft/lesser.html> 
    1717 */ 
     18 
     19ak_define('LOG_EVENTS', false); 
    1820 
    1921require_once(AK_LIB_DIR.DS.'Ak.php'); 
     
    144146        return $models; 
    145147    } 
     148     
     149    function _executeSql($sql, $trigger_error = true) 
     150    { 
     151        AK_LOG_EVENTS ? ($this->Logger->message($this->getModelName().' executing SQL: '.$sql)) : null; 
     152        if(!$result = $this->_db->Execute($sql) && AK_DEBUG){ 
     153            AK_LOG_EVENTS ? ($this->Logger->error($this->getModelName().': '.$this->_db->ErrorMsg())) : null; 
     154            $trigger_error ? trigger_error($this->_db->ErrorMsg(), E_USER_NOTICE) : false; 
     155        } 
     156        return $result; 
     157    } 
     158     
     159    function _startSqlBlockLog() 
     160    { 
     161        $this->__original_dbug = $this->_db->debug; 
     162        $this->_db->debug = true; 
     163        ob_start(); 
     164    } 
     165     
     166    function _endSqlBlockLog() 
     167    { 
     168        $sql_debug = ob_get_clean(); 
     169        $this->Logger->message($this->getModelName().' executing SQL: '.preg_replace('/^\([a-z]+\): /','',trim(Ak::html_entity_decode(strip_tags($sql_debug)),"\n- "))); 
     170        if($this->__original_dbug){ 
     171            echo $sql_debug; 
     172        } 
     173        $this->_db->debug = $this->__original_dbug; 
     174    } 
    146175} 
    147176 
  • trunk/lib/AkLogger.php

    r2 r217  
    3535defined('AK_LOGGER_DEBUG')      ? null : define('AK_LOGGER_DEBUG',      AK_MODE_FILE    | AK_MODE_DISPLAY); 
    3636defined('AK_LOGGER_INFO')       ? null : define('AK_LOGGER_INFO',       AK_MODE_DISPLAY); 
    37 defined('AK_LOGGER_MESSAGE')    ? null : define('AK_LOGGER_MESSAGE',    AK_MODE_DISPLAY | AK_MODE_FILE); 
     37defined('AK_LOGGER_MESSAGE')    ? null : define('AK_LOGGER_MESSAGE',    AK_MODE_FILE); 
    3838defined('AK_LOGGER_NOTICE')     ? null : define('AK_LOGGER_NOTICE',     AK_MODE_DISPLAY | AK_MODE_FILE | AK_MODE_DIE); 
    3939defined('AK_LOGGER_WARNING')    ? null : define('AK_LOGGER_WARNING',    AK_MODE_DISPLAY | AK_MODE_FILE | AK_MODE_DIE); 
     
    5353    var $_log_params                = array(); 
    5454    var $print_display_message      = true; 
    55     var $extended_details           = true; 
     55    var $extended_details           = false; 
    5656    var $default_mail_destination   = AK_LOGER_DEFAULT_MAIL_DESTINATION; 
    5757    var $default_mail_sender        = AK_LOGER_DEFAULT_MAIL_SENDER; 
     
    6969        $type = strtoupper($type); 
    7070        $event_code = empty ($event_code) ? (defined('AK_LOGGER_'.$type) ? 'AK_LOGGER_'.$type : AK_LOGGER_INFO) : $event_code; 
    71  
    72  
    73         $this->_log($message, $error_message, $filename, $line_number, $vars); 
     71        $this->_log($type, $message, $vars, $event_code); 
    7472    } 
    7573 
     
    109107    } 
    110108 
    111     function _log($error_number, $error_message, $filename, $line_number, $vars=array()
     109    function _log($error_mode, $error_message, $vars=array(), $event_code = null
    112110    { 
    113111        $this->setLogParams($vars); 
    114         $this->mode = defined('AK_LOG_'.$error_number) ? constant('AK_LOG_'.$error_number) : $this->default_log_settings; 
     112        $this->mode = defined('AK_LOG_'.$error_mode) ? constant('AK_LOG_'.$error_mode) : $this->default_log_settings; 
    115113        $type = $this->log_type; 
    116         $this->mode & AK_MODE_DISPLAY ? $this->_displayLog($type, $error_number, $error_message, $filename, $line_number) : null; 
    117         $this->mode & AK_MODE_MAIL ? $this->_mailLog($type, $error_number, $error_message, $filename, $line_number) : null; 
    118         $this->mode & AK_MODE_FILE ? $this->_appendLogToFile($type, $error_number, $error_message, $filename, $line_number) : null; 
    119         $this->mode & AK_MODE_DATABASE ? $this->_saveLogInDatabase($type, $error_number, $error_message, $filename, $line_number) : null; 
     114        $this->mode & AK_MODE_DISPLAY ? $this->_displayLog($type, $error_mode, $error_message) : null; 
     115        $this->mode & AK_MODE_FILE ? $this->_appendLogToFile($type, $error_mode, $error_message) : null; 
     116        $this->mode & AK_MODE_DATABASE ? $this->_saveLogInDatabase($type, $error_mode, $error_message) : null; 
     117        $this->mode & AK_MODE_MAIL ? $this->_mailLog($type, $error_mode, $error_message) : null; 
    120118        $this->mode & AK_MODE_DIE ? exit : null; 
    121119    } 
    122120 
    123     function _displayLog($type, $error_number, $error_message, $filename, $line_number
    124     { 
    125         $message = $this->_getLogFormatedAsHtml($type, $error_number, $error_message, $filename, $line_number); 
     121    function _displayLog($type, $error_mode, $error_message
     122    { 
     123        $message = $this->_getLogFormatedAsHtml($type, $error_mode, $error_message); 
    126124        if($this->print_display_message){ 
    127             echo  $result
     125            Ak::trace($message)
    128126        } 
    129127        return $message; 
    130128    } 
    131     function _mailLog($type, $error_number, $error_message, $filename, $line_number
     129    function _mailLog($type, $error_mode, $error_message
    132130    { 
    133131        if(!empty($this->default_mail_destination)){ 
    134             $message = $this->_getLogFormatedAsString($type, $error_number, $error_message, $filename, $line_number); 
     132            $message = $this->_getLogFormatedAsString($type, $error_mode, $error_message); 
    135133            $message = strip_tags(str_replace('<li>',' - ',$message)); 
    136134            Ak::mail($this->default_mail_sender, $this->default_mail_destination, $this->default_mail_subject, $message); 
    137135        } 
    138136    } 
    139     function _appendLogToFile($type, $error_number, $error_message, $filename, $line_number
     137    function _appendLogToFile($type, $error_mode, $error_message
    140138    { 
    141139        $filename = $this->error_file; 
    142  
    143         if (is_writable($filename) || (Ak::file_put_contents(AK_MODE_DIR.DS.$filename.'.log','') && (clearstatcache() && is_writable($filename)))){ 
    144             $message = $this->_getLogFormatedAsString($type, $error_number, $error_message, $filename, $line_number); 
    145             if(!$fp = fopen($filename, 'a')) { 
    146                 die($this->internalError($this->t('Cannot open file (%file)', array('%file'=>$filename)),__FILE__,__LINE__)); 
     140        if(!is_writable($filename)){ 
     141            clearstatcache(); 
     142            Ak::file_put_contents($filename,''); 
     143            if(!is_writable($filename)){ 
     144                trigger_error($this->internalError($this->t('Error writing file: %filename Description:',array('%filename'=>$filename)).$error_message,__FILE__,__LINE__), E_USER_NOTICE); 
     145                return ; 
    147146            } 
    148             @flock($fp, LOCK_EX); 
    149             if (@fwrite($fp, "\r\n".$message) === FALSE) { 
    150                 @flock ($fp, LOCK_UN); 
    151                 die($this->internalError($this->t('Error writing file: %filename Description:',array('%filename'=>$filename)).$error_message,__FILE__,__LINE__)); 
    152             } 
     147        } 
     148 
     149        $message = $this->_getLogFormatedAsString($type, $error_mode, $error_message); 
     150        if(!$fp = fopen($filename, 'a')) { 
     151            die($this->internalError($this->t('Cannot open file (%file)', array('%file'=>$filename)),__FILE__,__LINE__)); 
     152        } 
     153        @flock($fp, LOCK_EX); 
     154        if (@fwrite($fp, $message) === FALSE) { 
    153155            @flock ($fp, LOCK_UN); 
    154             @fclose($fp); 
    155         } else { 
    156156            die($this->internalError($this->t('Error writing file: %filename Description:',array('%filename'=>$filename)).$error_message,__FILE__,__LINE__)); 
    157157        } 
    158     } 
    159  
    160     function _saveLogInDatabase($type, $error_number, $error_message, $filename, $line_number) 
     158        @flock ($fp, LOCK_UN); 
     159        @fclose($fp); 
     160    } 
     161 
     162    function _saveLogInDatabase($type, $error_mode, $error_message) 
    161163    { 
    162164        $db =& Ak::db(); 
    163         $message = $this->_getLogFormatedAsRawText($type, $error_number, $error_message, $filename, $line_number); 
     165        $message = $this->_getLogFormatedAsRawText($type, $error_mode, $error_message); 
    164166        $sql = 'INSERT INTO log (user_id, type, message, severity, location, hostname, created) '. 
    165167        " VALUES (0, ".$db->qstr($type).", ".$db->qstr($message).', '.($this->mode & AK_MODE_DIE ? 100 : 0).', '. 
     
    170172    } 
    171173 
    172     function _getLogFormatedAsHtml($type, $error_number, $error_message, $filename, $line_number
    173     { 
    174         $error_type = $error_number ? 'error' : 'info'; 
    175         $message = "\n<div id='logger_$error_type'>\n<p>".$this->t(ucfirst($error_type)).": [$error_number] - $error_message</p>\n"; 
    176         $params = array_merge($this->_log_params, ($this->extended_details ? array('file'=>$filename, 'line_number'=>$line_number, 'remote_address'=>$_SERVER['REMOTE_ADDR'], 'browser'=>$_SERVER['HTTP_USER_AGENT']) : array() )); 
     174    function _getLogFormatedAsHtml($type, $error_mode, $error_message
     175    { 
     176        $error_type = $error_mode ? 'error' : 'info'; 
     177        $message = "\n<div id='logger_$error_type'>\n<p>".$this->t(ucfirst($error_type)).": [$error_mode] - $error_message</p>\n"; 
     178        $params = array_merge($this->_log_params, ($this->extended_details ? array('remote_address'=>$_SERVER['REMOTE_ADDR'], 'browser'=>$_SERVER['HTTP_USER_AGENT']) : array() )); 
    177179        $details = ''; 
    178180        foreach ($params as $k=>$v){ 
     
    182184    } 
    183185 
    184     function _getLogFormatedAsString($type, $error_number, $error_message, $filename, $line_number, $serialized = false) 
    185     { 
    186         $message = Ak::getTimestamp()."\t[$error_number]\t$error_message"; 
    187         $params = array_merge($this->_log_params, ($this->extended_details ? array('file'=>$filename, 'line_number'=>$line_number, 'remote_address'=>$_SERVER['REMOTE_ADDR'], 'browser'=>$_SERVER['HTTP_USER_AGENT']) : array() )); 
     186    function _getLogFormatedAsString($type, $error_mode, $error_message, $serialized = false) 
     187    { 
     188        $message = date('r')."\t[$error_mode]\t$error_message"; 
     189        $params = array_merge($this->_log_params, ($this->extended_details ? array('remote_address'=>$_SERVER['REMOTE_ADDR'], 'browser'=>$_SERVER['HTTP_USER_AGENT']) : array() )); 
    188190 
    189191        if($serialized){ 
     
    199201    } 
    200202 
    201     function _getLogFormatedAsRawText($type, $error_number, $error_message, $filename, $line_number
    202     { 
    203         return $this->_getLogFormatedAsString($type, $error_number, $error_message, $filename, $line_number, true); 
     203    function _getLogFormatedAsRawText($type, $error_mode, $error_message
     204    { 
     205        return $this->_getLogFormatedAsString($type, $error_mode, $error_message, $filename, $line_number, true); 
    204206    } 
    205207 
  • trunk/lib/AkRouter.php

    r154 r217  
    99// +----------------------------------------------------------------------+ 
    1010 
    11 Ak::compat('http_build_query'); 
     11ak_compat('http_build_query'); 
    1212 
    1313/** 
  • trunk/script/generators/controller/templates/functional_test.tpl

    r155 r217  
    1414 
    1515 
    16 Ak::test('<?php  echo $class_name?>ControllerTest',true); 
     16ak_test('<?php  echo $class_name?>ControllerTest',true); 
    1717 
    1818?> 
  • trunk/script/generators/model/templates/unit_test.tpl

    r155 r217  
    2424 
    2525 
    26 Ak::test('<?php  echo $class_name?>Test',true); 
     26ak_test('<?php  echo $class_name?>Test',true); 
    2727 
    2828?> 
  • trunk/script/generators/scaffold/templates/model_unit_test.tpl

    r155 r217  
    2424 
    2525 
    26 Ak::test('<?php  echo $model_name?>Test',true); 
     26ak_test('<?php  echo $model_name?>Test',true); 
    2727 
    2828?> 
  • trunk/test/unit/lib/AkActionController/_AkActionController_filters.php

    r126 r217  
    334334if(!defined('ALL_TESTS_CALL')){ 
    335335    ob_start(); 
    336     Ak::test('Test_of_AkActionControllerFilters'); 
     336    ak_test('Test_of_AkActionControllerFilters'); 
    337337    ob_end_flush(); 
    338338} 
  • trunk/test/unit/lib/AkActionController/_AkActionController_locale_detection.php

    r126 r217  
    8787} 
    8888 
    89 Ak::test('_AkActionController_locale_detection'); 
     89ak_test('_AkActionController_locale_detection'); 
    9090 
    9191?> 
  • trunk/test/unit/lib/AkActionController/_AkActionController_partials.php

    r126 r217  
    6262} 
    6363 
    64 Ak::test('Test_of_AkActionController_partials'); 
     64ak_test('Test_of_AkActionController_partials'); 
    6565 
    6666 
  • trunk/test/unit/lib/AkActionView/AkActionViewHelper.php

    r2 r217  
    1010 
    1111 
    12 Ak::test('test_AkActionViewHelper',true); 
     12ak_test('test_AkActionViewHelper',true); 
    1313 
    1414?> 
  • trunk/test/unit/lib/AkActionView/TemplateEngines/AkSintags.php

    r149 r217  
    5858 
    5959 
    60 Ak::test('Test_of_AkSintags'); 
     60ak_test('Test_of_AkSintags'); 
    6161 
    6262?> 
  • trunk/test/unit/lib/AkActionView/helpers/active_record_helper.php

    r211 r217  
    1111require_once(AK_LIB_DIR.DS.'AkRequest.php'); 
    1212 
    13 Mock::generate('AkRequest'); 
     13ak_generate_mock('AkRequest'); 
    1414 
    1515 
     
    110110 
    111111 
    112 Ak::test('ActiveRecordHelperTests'); 
     112ak_test('ActiveRecordHelperTests'); 
    113113 
    114114?> 
  • trunk/test/unit/lib/AkActionView/helpers/asset_tag_helper.php

    r205 r217  
    55require_once(AK_LIB_DIR.DS.'AkRequest.php'); 
    66 
    7 Mock::generate('AkRequest'); 
     7ak_generate_mock('AkRequest'); 
    88 
    99class AssetTagHelperTests extends HelpersUnitTester 
     
    183183} 
    184184 
    185 Ak::test('AssetTagHelperTests'); 
     185ak_test('AssetTagHelperTests'); 
    186186 
    187187?> 
  • trunk/test/unit/lib/AkActionView/helpers/capture_helper.php

    r206 r217  
    77require_once(AK_LIB_DIR.DS.'AkRequest.php'); 
    88 
    9 Mock::generate('AkRequest'); 
     9ak_generate_mock('AkRequest'); 
    1010 
    1111 
     
    5454 
    5555 
    56 Ak::test('CaptureHelperTests'); 
     56ak_test('CaptureHelperTests'); 
    5757 
    5858?> 
  • trunk/test/unit/lib/AkActionView/helpers/date_helper.php

    r208 r217  
    119119} 
    120120 
    121 Ak::test('DateHelperTests'); 
     121ak_test('DateHelperTests'); 
    122122 
    123123?> 
  • trunk/test/unit/lib/AkActionView/helpers/file_upload_helper.php

    r2 r217  
    1818 
    1919 
    20 Ak::test('FileUploadHelperTests'); 
     20ak_test('FileUploadHelperTests'); 
    2121 
    2222?> 
  • trunk/test/unit/lib/AkActionView/helpers/form_helper.php

    r208 r217  
    253253} 
    254254 
    255 Ak::test('FormHelperTests', true); 
     255ak_test('FormHelperTests', true); 
    256256 
    257257?> 
  • trunk/test/unit/lib/AkActionView/helpers/form_options_helper.php

    r212 r217  
    306306} 
    307307 
    308 Ak::test('FormOptionsHelperTests', true); 
     308ak_test('FormOptionsHelperTests', true); 
    309309 
    310310?> 
  • trunk/test/unit/lib/AkActionView/helpers/form_tag_helper.php

    r160 r217  
    4343} 
    4444 
    45 Ak::test('FormTagHelperTests'); 
     45ak_test('FormTagHelperTests'); 
    4646 
    4747?> 
  • trunk/test/unit/lib/AkActionView/helpers/javascript_helper.php

    r200 r217  
    5353 
    5454 
    55 Ak::test('JavaScriptHelperTests'); 
     55ak_test('JavaScriptHelperTests'); 
    5656 
    5757?> 
  • trunk/test/unit/lib/AkActionView/helpers/javascript_macros_helper.php

    r208 r217  
    66require_once(AK_LIB_DIR.DS.'AkRequest.php'); 
    77 
    8 Mock::generate('AkRequest'); 
     8ak_generate_mock('AkRequest'); 
    99 
    1010 
     
    7474 
    7575 
    76 Ak::test('JavaScriptMacrosHelperTests'); 
     76ak_test('JavaScriptMacrosHelperTests'); 
    7777 
    7878?> 
  • trunk/test/unit/lib/AkActionView/helpers/menu_helper.php

    r210 r217  
    77require_once(AK_CONTROLLERS_DIR.DS.'..'.DS.'application_controller.php'); 
    88 
    9 Mock::generate('AkRequest'); 
     9ak_generate_mock('AkRequest'); 
    1010 
    1111class MenuHelperTests extends HelpersUnitTester  
     
    7373} 
    7474 
    75 Ak::test('MenuHelperTests'); 
     75ak_test('MenuHelperTests'); 
    7676 
    7777?> 
  • trunk/test/unit/lib/AkActionView/helpers/number_helper.php

    r2 r217  
    5555 
    5656 
    57 Ak::test('NumberHelperTests'); 
     57ak_test('NumberHelperTests'); 
    5858 
    5959?> 
  • trunk/test/unit/lib/AkActionView/helpers/pagination_helper.php

    r2 r217  
    1818 
    1919 
    20 Ak::test('PaginationHelperTests'); 
     20ak_test('PaginationHelperTests'); 
    2121 
    2222?> 
  • trunk/test/unit/lib/AkActionView/helpers/prototype_helper.php

    r199 r217  
    66require_once(AK_LIB_DIR.DS.'AkRequest.php'); 
    77 
    8 Mock::generate('AkRequest'); 
     8ak_generate_mock('AkRequest'); 
    99 
    1010class PrototypeHelperTests extends HelpersUnitTester 
     
    138138} 
    139139 
    140 Ak::test('PrototypeHelperTests');