public function testGetFor_SameInstance() { $config = new LoggerConfig(array()); $logger1 = $config->getFor("something"); $logger2 = $config->getFor("something"); $this->assertSame($logger1, $logger2); }
public function testGetFor_IgnoresAlternativeHandlers() { $expectedHandler = new \Monolog\Handler\NullHandler(); $alternativeHandler = new \Monolog\Handler\NullHandler(); $config = new LoggerConfig(array("Specific" => function () use($expectedHandler) { return array($expectedHandler); }, "Other" => function () use($alternativeHandler) { return array($alternativeHandler); })); /** @var \Monolog\Logger $logger */ $logger = $config->getFor("Specific"); $actualHandler = $logger->popHandler(); $this->assertSame($expectedHandler, $actualHandler); $this->assertNotSame($alternativeHandler, $actualHandler); }
$message = 'PHPCI has not yet been installed - Please use the command "./console phpci:install" '; $message .= '(or "php ./console phpci:install" for Windows) to install it.'; die($message); } // If composer has not been run, fail at this point and tell the user to install: if (!file_exists(dirname(__FILE__) . '/vendor/autoload.php') && defined('PHPCI_IS_CONSOLE') && PHPCI_IS_CONSOLE) { $message = 'Please install PHPCI with "composer install" (or "php composer.phar install"'; $message .= ' for Windows) before using console'; file_put_contents('php://stderr', $message); exit(1); } // Load Composer autoloader: require_once dirname(__FILE__) . '/vendor/autoload.php'; \PHPCI\ErrorHandler::register(); if (defined('PHPCI_IS_CONSOLE') && PHPCI_IS_CONSOLE) { $loggerConfig = LoggerConfig::newFromFile(__DIR__ . "/loggerconfig.php"); } // Load configuration if present: $conf = array(); $conf['b8']['app']['namespace'] = 'PHPCI'; $conf['b8']['app']['default_controller'] = 'Home'; $conf['b8']['view']['path'] = dirname(__FILE__) . '/PHPCI/View/'; $config = new b8\Config($conf); if (file_exists($configFile)) { $config->loadYaml($configFile); } /** * Allow to modify PHPCI configuration without modify versioned code. * Dameons should be killed to apply changes in the file. * * @ticket 781