public function test_should_generate_controller_and_auxiliary_files() { $files = array(AkConfig::getDir('controllers') . DS . 'credit_card_controller.php', AkConfig::getDir('helpers') . DS . 'credit_card_helper.php', AkConfig::getDir('test') . DS . 'functional' . DS . 'controllers' . DS . 'credit_card_controller_test.php', AkConfig::getDir('test') . DS . 'unit' . DS . 'helpers' . DS . 'credit_card_helper_test.php', AkConfig::getDir('views') . DS . 'credit_card' . DS . 'open.html.tpl', AkConfig::getDir('views') . DS . 'credit_card' . DS . 'debit.html.tpl', AkConfig::getDir('views') . DS . 'credit_card' . DS . 'credit.html.tpl', AkConfig::getDir('views') . DS . 'credit_card' . DS . 'close.html.tpl'); clearstatcache(); foreach ($files as $file) { file_exists($file) && unlink($file); $this->assertFalse(file_exists($file)); } AkFileSystem::file_put_contents(AkConfig::getDir('views') . DS . 'credit_card' . DS . 'credit.html.tpl', 'foo', array('base_path' => AK_FRAMEWORK_DIR)); clearstatcache(); $this->assertPattern('/collisions/', $this->runGeneratorCommand('controller CreditCard open debit credit close')); AkFileSystem::file_delete(AkConfig::getDir('views') . DS . 'credit_card' . DS . 'credit.html.tpl', array('base_path' => AK_FRAMEWORK_DIR)); clearstatcache(); foreach ($files as $file) { $this->assertFalse(file_exists($file)); } $this->assertPattern('/ files have been created/', $this->runGeneratorCommand('controller CreditCard open debit credit close')); clearstatcache(); foreach ($files as $file) { $this->assertTrue(file_exists($file)); if (!file_exists($file)) { AkDebug::trace($file); } @unlink($file); } }
public function _run_from_file($file_name, $all_in_one_test = true) { $multiple_expected_php = $multiple_sintags = ''; $tests = explode('===================================', file_get_contents(AkConfig::getDir('fixtures') . DS . $file_name)); foreach ($tests as $test) { list($sintags, $php) = explode('-----------------------------------', $test); $sintags = trim($sintags); $expected_php = trim($php); if (empty($sintags)) { return; } else { $multiple_sintags .= $sintags; $multiple_expected_php .= $expected_php; } $AkSintags = new AkSintagsParser(); $php = $AkSintags->parse($sintags); if ($php != $expected_php) { AkDebug::trace("GENERATED: \n" . $php); AkDebug::trace("EXPECTED: \n" . $expected_php); AkDebug::trace("SINTAGS: \n" . $sintags); } $this->assertEqual($php, $expected_php); } if ($all_in_one_test) { $AkSintags = new AkSintagsParser(); $php = $AkSintags->parse($multiple_sintags); if ($php != $multiple_expected_php) { AkDebug::trace("GENERATED: \n" . $php); AkDebug::trace("EXPECTED: \n" . $expected_php); AkDebug::trace("SINTAGS: \n" . $sintags); } $this->assertEqual($php, $multiple_expected_php); } }
public function dbugging($trace_this_on_debug_mode = null) { if (!empty($this->_Model->getAdapter()->debug) && !empty($trace_this_on_debug_mode)) { $message = !is_scalar($trace_this_on_debug_mode) ? var_export($trace_this_on_debug_mode, true) : (string) $trace_this_on_debug_mode; AkDebug::trace($message); } return !empty($this->_Model->getAdapter()->debug); }
public function log_memory($reset = false, $vervose = false) { if ($reset || empty($this->initial)) { $this->initial = memory_get_usage(); } $this->current = memory_get_usage(); $this->difference = $this->current - $this->initial; $this->difference && $vervose && AkDebug::trace($this->difference / 1048576 . ' MB increased'); return $this->difference; }
public function handleDisplayMessage($error_level, $message, $parameters = array()) { if (AkConfig::getOption('logger.display_message', true)) { if (!empty($this->options['print'])) { list($file, $line, $method) = AkDebug::getLastFileAndLineAndMethod(false, 3); AkDebug::trace("<strong>[{$error_level}]</strong> - " . AkTextHelper::html_escape($message), $line, $file, $method, false); if (!empty($parameters)) { AkDebug::trace($parameters, $line, $file, $method); } } } }
public function failTransaction() { if (AK_DEBUG && !empty($this->connection->debug) && function_exists('ak_backtrace')) { AkDebug::trace(ak_backtrace(), null, null, null, false); } return $this->connection->FailTrans(); }
/** * @deprecated * @uses AkDebug::trace */ static function trace($text = null, $line = null, $file = null, $method = null, $escape_html_entities = true) { Ak::deprecateMethod(__METHOD__, 'AkDebug::trace()'); return AkDebug::trace($text, $line, $file, $method, $escape_html_entities); }