示例#1
0
 protected function setUp()
 {
     date_default_timezone_set('Europe/London');
     $config = json_decode(file_get_contents($this->getConfigLocation()), true);
     if (getenv('TRIPOD_DATASOURCE_RS1_CONFIG')) {
         $config['data_sources']['rs1'] = json_decode(getenv('TRIPOD_DATASOURCE_RS1_CONFIG'), true);
     }
     if (getenv('TRIPOD_DATASOURCE_RS2_CONFIG')) {
         $config['data_sources']['rs2'] = json_decode(getenv('TRIPOD_DATASOURCE_RS2_CONFIG'), true);
     }
     \Tripod\Mongo\Config::setConfig($config);
     $className = get_class($this);
     $testName = $this->getName();
     echo "\nTest: {$className}->{$testName}\n";
     // make sure log statements don't go to stdout during tests...
     $log = new \Monolog\Logger("unittest");
     $log->pushHandler(new \Monolog\Handler\NullHandler());
     \Tripod\Mongo\DriverBase::$logger = $log;
 }
示例#2
0
<?php

require_once dirname(__FILE__) . '/common.inc.php';
require dirname(__FILE__) . "/../../src/tripod.inc.php";
// the global is necessary for Resque worker to send statements to
$logger = new \Monolog\Logger("TRIPOD-WORKER");
$logger->pushHandler(new \Monolog\Handler\StreamHandler('php://stderr', Psr\Log\LogLevel::WARNING));
// resque too chatty on NOTICE & INFO. YMMV
// this is so tripod itself uses the same logger
\Tripod\Mongo\DriverBase::$logger = new \Monolog\Logger("TRIPOD-JOB", array(new \Monolog\Handler\StreamHandler('php://stderr', Psr\Log\LogLevel::DEBUG)));