示例#1
0
 /**
  * @covers phpDocumentor\Parser\Parser::setLogger
  */
 public function testSettingALogger()
 {
     $logger = m::mock('Psr\\Log\\LoggerInterface');
     $this->assertAttributeEquals(null, 'logger', $this->fixture);
     $this->fixture->setLogger($logger);
     $this->assertAttributeSame($logger, 'logger', $this->fixture);
 }
 /**
  * Registers services on the given app.
  *
  * @param Application $app An Application instance
  *
  * @throws Exception\MissingDependencyException if the Descriptor Builder is not present.
  *
  * @return void
  */
 public function register(Application $app)
 {
     if (!isset($app['descriptor.builder'])) {
         throw new Exception\MissingDependencyException('The builder object that is used to construct the ProjectDescriptor is missing');
     }
     $app['parser'] = $app->share(function ($app) {
         $parser = new Parser();
         $parser->setStopwatch($app['kernel.stopwatch']);
         $parser->setLogger($app['monolog']);
         return $parser;
     });
     $app['markdown'] = $app->share(function () {
         return \Parsedown::instance();
     });
     /** @var Translator $translator  */
     $translator = $app['translator'];
     $translator->addTranslationFolder(__DIR__ . DIRECTORY_SEPARATOR . 'Messages');
     $app['parser.files'] = new Collection();
     $app->command(new ParseCommand($app['descriptor.builder'], $app['parser'], $translator, $app['parser.files']));
 }