コード例 #1
0
ファイル: Runner.php プロジェクト: imjerrybao/phpbu
 /**
  * Create and register all configured loggers.
  *
  * @param  \phpbu\App\Configuration $configuration
  */
 protected function setupLoggers(Configuration $configuration)
 {
     foreach ($configuration->getLoggers() as $log) {
         // this is a already fully setup Listener so just add it
         if (is_a($log, '\\phpbu\\App\\Listener')) {
             $logger = $log;
         } else {
             // this is a configuration blueprint for a logger, so create and add it
             /** @var \phpbu\App\Configuration\Logger $log */
             /** @var \phpbu\App\Listener $logger */
             $logger = $this->factory->createLogger($log->type, $log->options);
         }
         $this->result->addListener($logger);
     }
 }
コード例 #2
0
ファイル: FactoryTest.php プロジェクト: todiadiyatmo/phpbu
 /**
  * Tests Factory::createLogger
  *
  * @expectedException \phpbu\App\Exception
  */
 public function testCreateLoggerThatIsLoggerButNoListener()
 {
     Factory::register('logger', 'nothing', '\\phpbu\\App\\phpbuAppFactoryTestLoggerButNoListener', true);
     $factory = new Factory();
     $factory->createLogger('nothing');
     $this->assertFalse(true, 'Exception should be thrown');
 }