public function testFactoryWithWrongTypeDoesNotThrowsAnException() { $logger = $this->getMock('Psr\\Log\\LoggerInterface'); $logger->expects($this->once())->method('error')->with($this->isType('string')); $factory = new StaticFileFactory($logger, true, 'wrong-type', self::$DI['app']['phraseanet.thumb-symlinker']); $this->assertInstanceOf('Alchemy\\Phrasea\\Http\\StaticFile\\NullMode', $factory->getMode(false)); }
/** * {@inheritdoc} */ protected function doExecute(InputInterface $input, OutputInterface $output) { $enabled = $input->getOption('enabled'); $type = strtolower($input->getArgument('type')); $factory = new StaticFileFactory($this->container['monolog'], true, $type, $this->container['phraseanet.thumb-symlinker']); $mode = $factory->getMode(true); $conf = array('enabled' => $enabled, 'type' => $type, 'mapping' => $mode->getMapping()); if ($input->getOption('write')) { $output->write("Writing configuration ..."); $this->container['phraseanet.configuration']['static-file'] = $conf; $output->writeln(" <info>OK</info>"); $output->writeln(""); $output->write("It is now strongly recommended to use <info>static-file:dump-configuration</info> command to upgrade your virtual-host"); } else { $output->writeln("Configuration will <info>not</info> be written, use <info>--write</info> option to write it"); $output->writeln(""); $output->writeln(Yaml::dump(array('static-file' => $conf), 4)); } return 0; }
/** * {@inheritDoc} */ public function register(Application $app) { $app['phraseanet.xsendfile-factory'] = $app->share(function ($app) { return XSendFileFactory::create($app); }); $app['phraseanet.h264-factory'] = $app->share(function ($app) { return H264Factory::create($app); }); $app['phraseanet.static-file-factory'] = $app->share(function ($app) { return StaticFileFactory::create($app); }); $app['phraseanet.h264'] = $app->share(function ($app) { return $app['phraseanet.h264-factory']->createMode(false); }); $app['phraseanet.static-file'] = $app->share(function ($app) { return $app['phraseanet.static-file-factory']->getMode(false); }); $app['phraseanet.file-serve'] = $app->share(function (Application $app) { return ServeFileResponseFactory::create($app); }); }