本文整理汇总了PHP中DatabaseTest::log方法的典型用法代码示例。如果您正苦于以下问题:PHP DatabaseTest::log方法的具体用法?PHP DatabaseTest::log怎么用?PHP DatabaseTest::log使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DatabaseTest
的用法示例。
在下文中一共展示了DatabaseTest::log方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getenv
}
ActiveRecord\Config::initialize(function ($cfg) {
$cfg->set_model_directory(realpath(__DIR__ . '/../models'));
$cfg->set_connections(array('mysql' => getenv('PHPAR_MYSQL') ?: 'mysql://test:test@127.0.0.1/test', 'pgsql' => getenv('PHPAR_PGSQL') ?: 'pgsql://test:test@127.0.0.1/test', 'oci' => getenv('PHPAR_OCI') ?: 'oci://test:test@127.0.0.1/dev', 'sqlite' => getenv('PHPAR_SQLITE') ?: 'sqlite://test.db'));
$cfg->set_default_connection('mysql');
for ($i = 0; $i < count($GLOBALS['argv']); ++$i) {
if ($GLOBALS['argv'][$i] == '--adapter') {
$cfg->set_default_connection($GLOBALS['argv'][$i + 1]);
} elseif ($GLOBALS['argv'][$i] == '--slow-tests') {
$GLOBALS['slow_tests'] = true;
}
}
if (class_exists('Log_file')) {
$logger = new Log_file(dirname(__FILE__) . '/../log/query.log', 'ident', array('mode' => 0664, 'timeFormat' => '%Y-%m-%d %H:%M:%S'));
$cfg->set_logging(true);
$cfg->set_logger($logger);
} else {
if ($GLOBALS['show_warnings'] && !isset($GLOBALS['show_warnings_done'])) {
echo "(Logging SQL queries disabled, PEAR::Log not found.)\n";
}
DatabaseTest::$log = false;
}
if ($GLOBALS['show_warnings'] && !isset($GLOBALS['show_warnings_done'])) {
if (!extension_loaded('memcache')) {
echo "(Cache Tests will be skipped, Memcache not found.)\n";
}
}
date_default_timezone_set('UTC');
$GLOBALS['show_warnings_done'] = true;
});
error_reporting(E_ALL | E_STRICT);
示例2: dirname
<?php
require_once 'Log.php';
require_once 'PHPUnit/Framework/TestCase.php';
require_once 'SnakeCase_PHPUnit_Framework_TestCase.php';
require_once 'DatabaseTest.php';
require_once 'AdapterTest.php';
require_once dirname(__FILE__) . '/../../ActiveRecord.php';
// whether or not to run the slow non-crucial tests
$GLOBALS['slow_tests'] = false;
if (getenv('LOG') !== 'false') {
DatabaseTest::$log = true;
}
ActiveRecord\Config::initialize(function ($cfg) {
$cfg->set_model_directory(realpath(dirname(__FILE__) . '/../models'));
$cfg->set_connections(array('mysql' => getenv('PHPAR_MYSQL') ? getenv('PHPAR_MYSQL') : 'mysql://test:test@127.0.0.1/test', 'pgsql' => getenv('PHPAR_PGSQL') ? getenv('PHPAR_PGSQL') : 'pgsql://test:test@127.0.0.1/test', 'oci' => getenv('PHPAR_OCI') ? getenv('PHPAR_OCI') : 'oci://test:test@127.0.0.1/dev', 'sqlite' => getenv('PHPAR_SQLITE') ? getenv('PHPAR_SQLITE') : 'sqlite://test.db'));
$cfg->set_default_connection('mysql');
for ($i = 0; $i < count($GLOBALS['argv']); ++$i) {
if ($GLOBALS['argv'][$i] == '--adapter') {
$cfg->set_default_connection($GLOBALS['argv'][$i + 1]);
} elseif ($GLOBALS['argv'][$i] == '--slow-tests') {
$GLOBALS['slow_tests'] = true;
}
}
$logger = Log::singleton('file', dirname(__FILE__) . '/../log/query.log', 'ident', array('mode' => 0664, 'timeFormat' => '%Y-%m-%d %H:%M:%S'));
$cfg->set_logging(true);
$cfg->set_logger($logger);
});
error_reporting(E_ALL | E_STRICT);