/** * Constructor - sets up the log listener. * * @return \LogPanel */ public function __construct() { if (Log::config('debug_kit_log_panel')) { return; } Log::config('debug_kit_log_panel', array('engine' => 'DebugKit.DebugKit')); }
/** * Initialize hook - sets up the log listener. * * @return \LogPanel */ public function initialize() { if (Log::config('debug_kit_log_panel')) { return; } Log::config('debug_kit_log_panel', ['engine' => 'DebugKit.DebugKit']); }
/** * test config() with valid key name * * @return void */ public function testValidKeyName() { Log::config('stdout', ['engine' => 'File']); Queue::config('valid', ['url' => 'mysql://*****:*****@localhost:80/database']); $engine = Queue::engine('valid'); $this->assertInstanceOf('josegonzalez\\Queuesadilla\\Engine\\MysqlEngine', $engine); }
/** * Test that the worker is an instance of the correct object * * @return void */ public function testGetEngine() { Log::config('stdout', ['engine' => 'File']); Queue::config('default', ['url' => 'mysql://*****:*****@localhost:80/database']); $logger = new NullLogger(); $this->shell->params['config'] = 'default'; $engine = $this->shell->getEngine($logger); $this->assertInstanceOf('josegonzalez\\Queuesadilla\\Engine\\MysqlEngine', $engine); }
/** * Test that beforeDispatch call initialize on each panel * * @return void */ public function testBeforeDispatch() { $bar = new DebugBarFilter($this->events, []); $bar->setup(); $this->assertNull(Log::config('debug_kit_log_panel')); $event = new Event('Dispatcher.beforeDispatch'); $bar->beforeDispatch($event); $this->assertNotEmpty(Log::config('debug_kit_log_panel'), 'Panel attached logger.'); }
/** * testLogging * * @return void */ public function testLogging() { Log::config('dblogtest', ['className' => 'Burzum\\DatabaseLog\\Log\\Engine\\DatabaseLog', 'levels' => ['warning', 'error', 'critical', 'alert', 'emergency']]); Log::write('warning', 'testing'); $result = $this->Logs->find()->first(); $this->assertEquals($result->level, 'warning'); $this->assertEquals($result->message, 'testing'); $this->Logs->deleteAll([]); }
/** * Test log method. * * @return void */ public function testLog() { $mock = $this->getMockBuilder('Psr\\Log\\LoggerInterface')->getMock(); $mock->expects($this->at(0))->method('log')->with('error', 'Testing'); $mock->expects($this->at(1))->method('log')->with('debug', [1, 2]); Log::config('trait_test', ['engine' => $mock]); $subject = $this->getObjectForTrait('Cake\\Log\\LogTrait'); $subject->log('Testing'); $subject->log([1, 2], 'debug'); }
/** * Test log method. * * @return void */ public function testLog() { $mock = $this->getMock('Cake\\Log\\LogInterface'); $mock->expects($this->at(0))->method('write')->with('error', 'Testing'); $mock->expects($this->at(1))->method('write')->with('debug', print_r(array(1, 2), true)); Log::config('trait_test', ['engine' => $mock]); $subject = $this->getObjectForTrait('Cake\\Log\\LogTrait'); $subject->log('Testing'); $subject->log(array(1, 2), 'debug'); }
/** * {@inheritdoc} */ public function startup() { foreach (Config::get('cake_orm.datasources', []) as $name => $dataSource) { ConnectionManager::config($name, $dataSource); } Cache::config(Config::get('cake_orm.cache', [])); if (!is_dir($cakeLogPath = LOG_DIR . DS . 'cake')) { mkdir($cakeLogPath, 0777, true); } Log::config('queries', ['className' => 'File', 'path' => LOG_DIR . DS . 'cake' . DS, 'file' => 'queries.log', 'scopes' => ['queriesLog']]); $this->getEventManager()->addSubscriber(new CakeORMSubscriber()); }
/** * setup create a request object to get out of router later. * * @return void */ public function setUp() { parent::setUp(); Router::reload(); $request = new Request(); $request->base = ''; Router::setRequestInfo($request); Configure::write('debug', true); $this->_logger = $this->getMock('Psr\\Log\\LoggerInterface'); Log::reset(); Log::config('error_test', ['engine' => $this->_logger]); }
/** * Checks that sent email(s) contain `$content`. * * This requires the email profile(s) used to have `log` equals to * `['level' => 'info', 'scope' => 'email']` and a new `email` logging * configuration defined as follow: * * ``` * 'email' => [ * 'className' => 'Cake\Log\Engine\FileLog', * 'path' => LOGS, * 'file' => 'email', * 'levels' => ['info'], * 'scope' => ['email'], * ], * ``` * * Finally, it requires the `tests/bootstrap.php` to have: * * ``` * use Cake\Log\Log; * * $logTestConfig = ['path' => TMP . 'tests' . DS] + Log::config('email'); * Log::drop('email'); * Log::config('email', $logTestConfig); * ``` * * @param array|string $content Content to check for. * @return void */ public function seeSentEmailContains($content) { $logConfig = Log::config('email'); $path = $logConfig['path'] . $logConfig['file'] . '.log'; if (!file_exists($path) || !($log = file_get_contents($path))) { $this->fail('No email set, cannot assert content.'); } $contents = (array) $content; $this->debugSection('email.log', $log); foreach ($contents as $content) { $this->assertContains($content, $log); } unlink($path); }
public function onBootstrap(MvcEvent $e) { /* * pega as configurações */ $config = $e->getApplication()->getServiceManager()->get('Config'); /* * arruma a configuração do cakePHP */ $config['CakePHP']['Cache']['_cake_model_']['duration'] = $config['caches']['Zend\\Cache']['options']['ttl']; $config['CakePHP']['Datasources']['default']['host'] = $config['db']['adapters']['Zend\\Db\\Adapter']['host']; $config['CakePHP']['Datasources']['default']['username'] = $config['db']['adapters']['Zend\\Db\\Adapter']['username']; $config['CakePHP']['Datasources']['default']['password'] = $config['db']['adapters']['Zend\\Db\\Adapter']['password']; $config['CakePHP']['Datasources']['default']['database'] = $config['db']['adapters']['Zend\\Db\\Adapter']['dbname']; /* * seta o namespace padrão do CakePHP (App\Model) */ foreach ($config['CakePHP']['Configure'] as $configKey => $configValue) { Configure::write($configKey, $configValue); } /* * configura o cache do CakePHP */ foreach ($config['CakePHP']['Cache'] as $configKey => $configValue) { $cacheDir = sprintf('%s/%s', ROOT_PATH, $configValue['path']); if (!is_dir($cacheDir)) { @mkdir($cacheDir, 0755, true); } Cache::config($configKey, $configValue); } /* * configura o log do CakePHP */ foreach ($config['CakePHP']['Log'] as $configKey => $configValue) { $logDir = sprintf('%s/%s', ROOT_PATH, $configValue['path']); if (!is_dir($logDir)) { @mkdir($logDir, 0755, true); } Log::config($configKey, $configValue); } /* * setup da conexão com banco de dados no CakePHP */ foreach ($config['CakePHP']['Datasources'] as $configKey => $configValue) { ConnectionManager::config($configKey, $configValue); } }
/** * Test logging depends on fixture manager debug. * * @return void */ public function testLogSchemaWithDebug() { $db = ConnectionManager::get('test'); $restore = $db->logQueries(); $db->logQueries(true); $this->manager->setDebug(true); $buffer = new ConsoleOutput(); Log::config('testQueryLogger', ['className' => 'Console', 'stream' => $buffer]); $test = $this->getMock('Cake\\TestSuite\\TestCase'); $test->fixtures = ['core.articles']; $this->manager->fixturize($test); // Need to load/shutdown twice to ensure fixture is created. $this->manager->load($test); $this->manager->shutdown(); $this->manager->load($test); $this->manager->shutdown(); $db->logQueries($restore); $this->assertContains('CREATE TABLE', implode('', $buffer->messages())); }
/** * test convenience methods */ public function testConvenienceMethods() { $this->_deleteLogs(); Log::config('debug', array('engine' => 'File', 'types' => array('notice', 'info', 'debug'), 'file' => 'debug')); Log::config('error', array('engine' => 'File', 'types' => array('emergency', 'alert', 'critical', 'error', 'warning'), 'file' => 'error')); $testMessage = 'emergency message'; Log::emergency($testMessage); $contents = file_get_contents(LOGS . 'error.log'); $this->assertRegExp('/(Emergency|Critical): ' . $testMessage . '/', $contents); $this->assertFileNotExists(LOGS . 'debug.log'); $this->_deleteLogs(); $testMessage = 'alert message'; Log::alert($testMessage); $contents = file_get_contents(LOGS . 'error.log'); $this->assertRegExp('/(Alert|Critical): ' . $testMessage . '/', $contents); $this->assertFileNotExists(LOGS . 'debug.log'); $this->_deleteLogs(); $testMessage = 'critical message'; Log::critical($testMessage); $contents = file_get_contents(LOGS . 'error.log'); $this->assertContains('Critical: ' . $testMessage, $contents); $this->assertFileNotExists(LOGS . 'debug.log'); $this->_deleteLogs(); $testMessage = 'error message'; Log::error($testMessage); $contents = file_get_contents(LOGS . 'error.log'); $this->assertContains('Error: ' . $testMessage, $contents); $this->assertFileNotExists(LOGS . 'debug.log'); $this->_deleteLogs(); $testMessage = 'warning message'; Log::warning($testMessage); $contents = file_get_contents(LOGS . 'error.log'); $this->assertContains('Warning: ' . $testMessage, $contents); $this->assertFileNotExists(LOGS . 'debug.log'); $this->_deleteLogs(); $testMessage = 'notice message'; Log::notice($testMessage); $contents = file_get_contents(LOGS . 'debug.log'); $this->assertRegExp('/(Notice|Debug): ' . $testMessage . '/', $contents); $this->assertFileNotExists(LOGS . 'error.log'); $this->_deleteLogs(); $testMessage = 'info message'; Log::info($testMessage); $contents = file_get_contents(LOGS . 'debug.log'); $this->assertRegExp('/(Info|Debug): ' . $testMessage . '/', $contents); $this->assertFileNotExists(LOGS . 'error.log'); $this->_deleteLogs(); $testMessage = 'debug message'; Log::debug($testMessage); $contents = file_get_contents(LOGS . 'debug.log'); $this->assertContains('Debug: ' . $testMessage, $contents); $this->assertFileNotExists(LOGS . 'error.log'); $this->_deleteLogs(); }
/** * Tests using a callable for creating a Log engine * * @return void */ public function testCreateLoggerWithCallable() { $instance = new FileLog(); Log::config('default', function () use($instance) { return $instance; }); $this->assertSame($instance, Log::engine('default')); }
* @version 1.0.x * @copyright Copyright (C) by cool-code.ru * @license http://www.opensource.org/licenses/mit-license.php MIT License * @coder Segrey Kalistratov <*****@*****.**> */ use Cake\Log\Log; use Cake\Cache\Cache; use Cake\Core\Configure; use Union\Core\Event\EventManager; use Cake\Core\Plugin as CakePlugin; use Union\Extensions\Data\PluginConfig; Configure::write('Document.dir', 'ltr'); Configure::write('Html.iconPrefix', 'fa'); Configure::write('Html.btnPrefix', 'btn'); Configure::write('Cache.defaultConfig', ['className' => 'File', 'duration' => '+1 hour', 'path' => CACHE . 'queries' . DS, 'prefix' => 'un_']); Cache::config('short', ['className' => 'File', 'duration' => '+1 hours', 'path' => CACHE . 'short' . DS, 'prefix' => 'cache_short_']); Log::config('event', ['className' => 'File', 'path' => LOGS, 'scopes' => ['event'], 'file' => 'event.log']); $pluginPath = CakePlugin::path('Union/Core'); $eventConfig = $pluginPath . 'config' . DS . 'events.php'; if (file_exists($eventConfig)) { Configure::load('Union/Core.events'); } /** @noinspection PhpIncludeInspection */ require_once $pluginPath . 'src' . DS . 'basics.php'; /** @noinspection PhpIncludeInspection */ require_once $pluginPath . 'config' . DS . 'loader.php'; $config = PluginConfig::getInstance()->getGroup('union_core'); if ($config) { Configure::write('debug', (bool) $config->params()->get('debug', true)); } EventManager::loadListeners();
/** * Test that if a table already exists in the test database, it will dropped * before being recreated * * @return void */ public function testResetDbIfTableExists() { $db = ConnectionManager::get('test'); $restore = $db->logQueries(); $db->logQueries(true); $this->manager->setDebug(true); $buffer = new ConsoleOutput(); Log::config('testQueryLogger', ['className' => 'Console', 'stream' => $buffer]); $table = new Table('articles', ['id' => ['type' => 'integer', 'unsigned' => true], 'title' => ['type' => 'string', 'length' => 255]]); $table->addConstraint('primary', ['type' => 'primary', 'columns' => ['id']]); $sql = $table->createSql($db); foreach ($sql as $stmt) { $db->execute($stmt); } $test = $this->getMockBuilder('Cake\\TestSuite\\TestCase')->getMock(); $test->fixtures = ['core.articles']; $this->manager->fixturize($test); $this->manager->load($test); $db->logQueries($restore); $this->assertContains('DROP TABLE', implode('', $buffer->messages())); }
/** * Connects or disconnects the loggers to the console output. * * Used to enable or disable logging stream output to stdout and stderr * If you don't wish all log output in stdout or stderr * through Cake's Log class, call this function with `$enable=false`. * * @param int|bool $enable Use a boolean to enable/toggle all logging. Use * one of the verbosity constants (self::VERBOSE, self::QUIET, self::NORMAL) * to control logging levels. VERBOSE enables debug logs, NORMAL does not include debug logs, * QUIET disables notice, info and debug logs. * @return void */ public function setLoggers($enable) { Log::drop('stdout'); Log::drop('stderr'); if ($enable === false) { return; } $outLevels = ['notice', 'info']; if ($enable === static::VERBOSE || $enable === true) { $outLevels[] = 'debug'; } if ($enable !== static::QUIET) { $stdout = new ConsoleLog(['types' => $outLevels, 'stream' => $this->_out]); Log::config('stdout', ['engine' => $stdout]); } $stderr = new ConsoleLog(['types' => ['emergency', 'alert', 'critical', 'error', 'warning'], 'stream' => $this->_err]); Log::config('stderr', ['engine' => $stderr]); }
/** * testSendWithLogAndScope method * * @return void */ public function testSendWithLogAndScope() { $message = 'Logging This'; $log = $this->getMockBuilder('Cake\\Log\\Engine\\BaseLog')->setMethods(['log'])->setConstructorArgs(['scopes' => ['email']])->getMock(); $log->expects($this->once())->method('log')->with('debug', $this->logicalAnd($this->stringContains($message), $this->stringContains('*****@*****.**'), $this->stringContains('*****@*****.**'))); Log::config('email', $log); $this->CakeEmail->transport('debug'); $this->CakeEmail->to('*****@*****.**'); $this->CakeEmail->from('*****@*****.**'); $this->CakeEmail->subject('My title'); $this->CakeEmail->profile(['log' => ['scope' => 'email']]); $this->CakeEmail->send($message); }
/** * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * * Licensed under The MIT License * For full copyright and license information, please see the LICENSE.txt * Redistributions of files must retain the above copyright notice. * * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @link http://cakephp.org CakePHP(tm) Project * @since 3.0.0 * @license http://www.opensource.org/licenses/mit-license.php MIT License */ use Cake\Core\Configure; use Cake\Log\Log; use Cake\Datasource\ConnectionManager; /** * Additional bootstrapping and configuration for CLI environments should * be put here. */ // Set logs to different files so they don't have permission conflicts. Configure::write('Log.debug.file', 'cli-debug'); Configure::write('Log.error.file', 'cli-error'); class_alias('Cake\\ORM\\TableRegistry', 'T'); function pj($data) { echo json_encode($data, JSON_PRETTY_PRINT) . PHP_EOL; } // Console logging Log::config('queries', ['className' => 'Console', 'stream' => 'php://stdout', 'scopes' => ['queriesLog']]);
* Plugins need to be loaded manually, you can either load them one by one or all of them in a single call * Uncomment one of the lines below, as you need. make sure you read the documentation on Plugin to use more * advanced ways of loading plugins * * Plugin::loadAll(); // Loads all plugins at once * Plugin::load('Migrations'); //Loads a single plugin named Migrations * */ Plugin::load('Migrations'); // Only try to load DebugKit in development mode // Debug Kit should not be installed on a production system if (Configure::read('debug')) { Plugin::load('DebugKit', ['bootstrap' => true]); $conn = ConnectionManager::get('default'); $conn->logQueries(true); } // File logging Log::config('queries', ['className' => 'File', 'path' => LOGS, 'file' => 'queries.log', 'scopes' => ['queriesLog']]); /** * Connect middleware/dispatcher filters. */ DispatcherFactory::add('Asset'); DispatcherFactory::add('Routing'); DispatcherFactory::add('ControllerFactory'); /** * Enable default locale format parsing. * This is needed for matching the auto-localized string output of Time() class when parsing dates. */ Type::build('date')->useLocaleParser(); Type::build('datetime')->useLocaleParser(); Plugin::load('Admin', ['bootstrap' => true, 'routes' => true]);
<?php use Cake\Core\Configure; use Cake\Database\Type; use Cake\Log\Log; $className = Configure::read('Log.defaultClassName') ?: 'Cake\\Log\\Engine\\FileLog'; if (!Log::config('geo')) { Log::config('geo', ['className' => $className, 'path' => LOGS, 'levels' => ['debug'], 'scopes' => ['geocode'], 'file' => 'geocode']); } Type::map('object', 'Geo\\Database\\Type\\ObjectType');
<?php use Cake\Log\Log; Log::config('geo', ['engine' => 'File', 'types' => ['debug'], 'scopes' => ['geocode']]);
<?php use Cake\Datasource\ConnectionManager; use Cake\ORM\TableRegistry; use Cake\Log\Log; use Monolog\Logger; use Monolog\Handler\StreamHandler; require 'vendor/autoload.php'; ConnectionManager::config('default', ['url' => 'sqlite:///bookmarkr.db?log=true']); Log::config('default', function () { $log = new Logger('cli'); $log->pushHandler(new StreamHandler('php://stdout')); return $log; }); $table = TableRegistry::get('Bookmarks'); $bookmarks = $table->find()->toArray(); echo sprintf("Found %d bookmarks", count($bookmarks));
define('APP', rtrim(sys_get_temp_dir(), DS) . DS . APP_DIR . DS); if (!is_dir(APP)) { mkdir(APP, 0770, true); } Cake\Core\Configure::write('App', ['namespace' => 'App']); Cake\Core\Configure::write('debug', true); $TMP = new \Cake\Filesystem\Folder(TMP); $TMP->create(TMP . 'cache/models', 0777); $TMP->create(TMP . 'cache/persistent', 0777); $TMP->create(TMP . 'cache/views', 0777); $cache = ['default' => ['engine' => 'File'], '_cake_core_' => ['className' => 'File', 'prefix' => 'cakeptbr_myapp_cake_core_', 'path' => CACHE . 'persistent/', 'serialize' => true, 'duration' => '+10 seconds'], '_cake_model_' => ['className' => 'File', 'prefix' => 'cakeptbr_my_app_cake_model_', 'path' => CACHE . 'models/', 'serialize' => 'File', 'duration' => '+10 seconds']]; Cake\Cache\Cache::config($cache); Cake\Core\Configure::write('Session', ['defaults' => 'php']); Cake\Core\Plugin::load('CakePtbr', ['path' => ROOT . DS, 'autoload' => true]); Cake\Routing\DispatcherFactory::add('Routing'); Cake\Routing\DispatcherFactory::add('ControllerFactory'); // Ensure default test connection is defined if (!getenv('db_class')) { putenv('db_class=Cake\\Database\\Driver\\Sqlite'); putenv('db_dsn=sqlite::tmp/test'); } if (WINDOWS) { Cake\Datasource\ConnectionManager::config('test', ['className' => 'Cake\\Database\\Connection', 'driver' => 'Cake\\Database\\Driver\\Mysql', 'database' => 'test', 'username' => 'root', 'password' => '', 'timezone' => 'UTC', 'quoteIdentifiers' => false, 'cacheMetadata' => true]); return; } Cake\Datasource\ConnectionManager::config('test', ['className' => 'Cake\\Database\\Connection', 'driver' => getenv('db_class'), 'url' => getenv('db_dsn'), 'database' => getenv('db_database'), 'username' => getenv('db_username'), 'password' => getenv('db_password'), 'timezone' => 'UTC', 'quoteIdentifiers' => false, 'cacheMetadata' => true]); \Cake\Log\Log::config(['debug' => ['className' => 'Cake\\Log\\Engine\\FileLog', 'path' => LOGS, 'file' => 'debug', 'levels' => ['notice', 'info', 'debug']], 'error' => ['className' => 'Cake\\Log\\Engine\\FileLog', 'path' => LOGS, 'file' => 'error', 'levels' => ['warning', 'error', 'critical', 'alert', 'emergency']]]); // Reportar erros ini_set('error_reporting', E_ALL & ~E_STRICT); ini_set('display_errors', '1'); ini_set('display_startup_errors', '1');
use Monolog\Logger; /** * Additional bootstrapping and configuration for CLI environments should * be put here. */ try { Plugin::load('Bake'); } catch (MissingPluginException $e) { // Do not halt if the plugin is missing } /** * Cakebox: use Monolog to create a combined log (with all log levels) to enable * Logstash > Elasticsearch forwarding. This logger is different from the one in * bootstrap.php in that is uses the 'cli' prefix tag instead of 'app'. */ Log::config('default', function () { if (is_writable('/var/log/cakephp')) { $handler = new StreamHandler('/var/log/cakephp/cakebox.cli.log'); } else { $handler = new StreamHandler(LOGS . DS . 'cakebox.cli.log'); } $formatter = new LogstashFormatter('cakephp'); $handler->setFormatter($formatter); $log = new Logger('cli.cakebox', array($handler)); return $log; }); /** * Stop using the now redundant default CakePHP file loggers. */ Configure::delete('Log.debug'); Configure::delete('Log.error');
if (!Configure::read('App.fullBaseUrl')) { $s = null; if (env('HTTPS')) { $s = 's'; } $httpHost = env('HTTP_HOST'); if (isset($httpHost)) { Configure::write('App.fullBaseUrl', 'http' . $s . '://' . $httpHost); } unset($httpHost, $s); } Cache::config(Configure::consume('Cache')); ConnectionManager::config(Configure::consume('Datasources')); Email::configTransport(Configure::consume('EmailTransport')); Email::config(Configure::consume('Email')); Log::config(Configure::consume('Log')); Security::salt(Configure::consume('Security.salt')); /** * The default crypto extension in 3.0 is OpenSSL. * If you are migrating from 2.x uncomment this code to * use a more compatible Mcrypt based implementation */ // Security::engine(new \Cake\Utility\Crypto\Mcrypt()); /** * Setup detectors for mobile and tablet. */ Request::addDetector('mobile', function ($request) { $detector = new \Detection\MobileDetect(); return $detector->isMobile(); }); Request::addDetector('tablet', function ($request) {
/** * Connects or disconnects the loggers to the console output. * * Used to enable or disable logging stream output to stdout and stderr * If you don't wish all log output in stdout or stderr * through Cake's Log class, call this function with `$enable=false`. * * @param bool $enable Whether you want loggers on or off. * @return void */ public function setLoggers($enable) { Log::drop('stdout'); Log::drop('stderr'); if (!$enable) { return; } $stdout = new ConsoleLog(['types' => ['notice', 'info', 'debug'], 'stream' => $this->_out]); Log::config('stdout', ['engine' => $stdout]); $stderr = new ConsoleLog(['types' => ['emergency', 'alert', 'critical', 'error', 'warning'], 'stream' => $this->_err]); Log::config('stderr', ['engine' => $stderr]); }
$loader->addNamespace('App', APP); //@codingStandardsIgnoreStart @mkdir(LOGS); @mkdir(SESSIONS); @mkdir(CACHE); @mkdir(CACHE . 'views'); @mkdir(CACHE . 'models'); //@codingStandardsIgnoreEnd require_once CORE_PATH . 'config/bootstrap.php'; date_default_timezone_set('UTC'); mb_internal_encoding('UTF-8'); Configure::write('debug', true); Configure::write('App', ['namespace' => 'App', 'encoding' => 'UTF-8', 'base' => false, 'baseUrl' => false, 'dir' => APP_DIR, 'webroot' => 'webroot', 'wwwRoot' => WWW_ROOT, 'fullBaseUrl' => 'http://localhost', 'imageBaseUrl' => 'img/', 'jsBaseUrl' => 'js/', 'cssBaseUrl' => 'css/', 'paths' => ['plugins' => [TEST_APP . 'Plugin' . DS], 'templates' => [APP . 'Template' . DS], 'locales' => [APP . 'Locale' . DS]]]); Cache::config(['_cake_core_' => ['engine' => 'File', 'prefix' => 'cake_core_', 'serialize' => true], '_cake_model_' => ['engine' => 'File', 'prefix' => 'cake_model_', 'serialize' => true]]); // Ensure default test connection is defined if (!getenv('db_dsn')) { putenv('db_dsn=sqlite:///:memory:'); } ConnectionManager::config('test', ['url' => getenv('db_dsn')]); ConnectionManager::config('test_custom_i18n_datasource', ['url' => getenv('db_dsn')]); Configure::write('Session', ['defaults' => 'php']); Configure::write('EmailTransport', ['default' => ['className' => 'Debug']]); Configure::write('Email', ['default' => ['transport' => 'default', 'from' => 'you@localhost']]); Email::configTransport(Configure::consume('EmailTransport')); Email::config(Configure::consume('Email')); Log::config(['debug' => ['engine' => 'Cake\\Log\\Engine\\FileLog', 'levels' => ['notice', 'info', 'debug'], 'file' => 'debug'], 'error' => ['engine' => 'Cake\\Log\\Engine\\FileLog', 'levels' => ['warning', 'error', 'critical', 'alert', 'emergency'], 'file' => 'error']]); Router::reload(); Cake\Routing\DispatcherFactory::add('Routing'); Cake\Routing\DispatcherFactory::add('ControllerFactory'); Plugin::load('Users', ['path' => ROOT . DS, 'routes' => true]); Cake\Utility\Security::salt('8b61f851d8cb3dfcf3b447dc67bd7bf9fe2ed91a916d4457f4969a05a637473d');
/** * test log() depth * * @return void */ public function testLogDepth() { $mock = $this->getMock('Cake\\Log\\Engine\\BaseLog', ['log']); Log::config('test', ['engine' => $mock]); $mock->expects($this->at(0))->method('log')->with('debug', $this->logicalAnd($this->stringContains('DebuggerTest::testLog'), $this->stringContains('test'), $this->logicalNot($this->stringContains('val')))); $val = ['test' => ['key' => 'val']]; Debugger::log($val, 'debug', 0); }