/**
  * {@inheritdoc}
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $configuration = $this->getConfiguration(array(), $container);
     $config = $this->processConfiguration($configuration, $configs);
     $loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config/'));
     $loader->load('console.yml');
     $loader->load('version_strategy.yml');
     $loader->load('manifest.yml');
     if ($config['livereload']['enabled']) {
         $loader->load('livereload.yml');
         $container->getDefinition($this->id('livereload.listener'))->addArgument($config['livereload']['url']);
     }
     $helper = Util::hasAssetComponent() ? new AssetExtensionHelper($this->getAlias(), $container, $loader) : new TemplatingExtensionHelper($this->getAlias(), $container, $loader);
     if ($config['override_default_package']) {
         $loader->load('fallback.yml');
         $defaultPackage = $helper->createPackage('default', array('prefix' => $config['prefix'], 'manifest' => $config['manifest']));
         $defaultPackageId = $helper->getPackageId('default');
         $container->setDefinition($defaultPackageId, $defaultPackage);
         $fallbackPackage = $helper->createFallbackPackage($config['fallback_patterns'], new Reference($defaultPackageId));
         $container->setDefinition($this->id('package.fallback'), $fallbackPackage);
     }
     foreach ($config['packages'] as $name => $packageConfig) {
         $package = $helper->createPackage($name, $packageConfig)->addTag($helper->getPackageTag(), array('alias' => $name));
         $container->setDefinition($helper->getPackageId($name), $package);
     }
 }
 public function getQuestion($question)
 {
     $class = Util::hasQuestionHelper() ? 'Symfony\\Component\\Console\\Question\\ChoiceQuestion' : 'Rj\\FrontendBundle\\Command\\Options\\Legacy\\ChoiceQuestion';
     $question = new $class("<question>{$question}</question>", $this->allowedValues, $this->defaultValue);
     $question->setErrorMessage($this->errorMessage);
     return $question;
 }
 private function addConsoleHelpers(FrameworkApplication $app)
 {
     if (!Util::hasQuestionHelper()) {
         $helper = $app->getKernel()->getContainer()->get('rj_frontend.console.helper.question_legacy');
         $app->getHelperSet()->set($helper, 'question');
     }
 }
 /**
  * @runInSeparateProcess
  */
 public function testNoRequestScope()
 {
     if (Util::hasAssetComponent()) {
         return $this->markTestSkipped();
     }
     $this->doTest('packages_default', '/assets/css/foo.css', array('framework' => array('templating' => array('assets_base_urls' => array('http' => array('https://example.com/somethingelse'), 'ssl' => array('https://example.com/somethingelse'))))));
 }
 protected function setUp()
 {
     if (Util::hasAssetComponent()) {
         return $this->markTestSkipped();
     }
     parent::setup();
     $this->container->setParameter('kernel.root_dir', 'root_dir');
 }
 public function setUp()
 {
     if (!Util::hasAssetComponent()) {
         return $this->markTestSkipped();
     }
     parent::setUp();
     $this->registerPackagesService();
 }
 public function setUp()
 {
     if (Util::hasAssetComponent()) {
         $packageBuilder = $this->getMockBuilder('Rj\\FrontendBundle\\Asset\\PathPackage');
         $defaultBuilder = $this->getMockBuilder('Symfony\\Component\\Asset\\PathPackage');
     } else {
         $packageBuilder = $this->getMockBuilder('Rj\\FrontendBundle\\Templating\\PathPackage');
         $defaultBuilder = $this->getMockBuilder('Symfony\\Component\\Templating\\Asset\\PathPackage');
     }
     $this->package = $packageBuilder->disableOriginalConstructor()->getMock();
     $this->default = $defaultBuilder->disableOriginalConstructor()->getMock();
     $this->fallbackPackage = new FallbackPackage(array('must_fallback\\/'), $this->package);
     $this->fallbackPackage->setFallback($this->default);
 }
 protected function setUp()
 {
     $fs = new Filesystem();
     $fs->remove($this->baseDir = sys_get_temp_dir() . '/rj_frontend');
     mkdir($this->baseDir);
     $application = new Application();
     if (!Util::hasQuestionHelper()) {
         $helper = new \Rj\FrontendBundle\Command\Options\Legacy\QuestionHelper();
         $application->getHelperSet()->set($helper, 'question');
     }
     $application->add($this->getInstallCommand());
     $application->add($command = new SetupCommand());
     $this->command = $application->find($command->getName());
     $this->command->setRootDir($this->baseDir);
     $this->commandTester = new CommandTester($this->command);
 }
 public function createPackage($name, $config)
 {
     $prefixes = $config['prefix'];
     $isUrl = Util::containsUrl($prefixes);
     return $this->getPackageDefinition($isUrl)->addArgument($isUrl ? $prefixes : $prefixes[0])->addArgument($this->createVersionStrategy($name, $config['manifest']))->setPublic(false);
 }
 /**
  * Returns true if the manifest's path has not been defined AND:
  *  - a prefix has not been defined
  *  - OR if a prefix has been defined, it's not a URL
  *
  * Note that the manifest's configuration can be a string, in which case it
  * represents the path to the manifest file.
  *
  * This method is public because of the inability to use $this in closures
  * in PHP 5.3.
  *
  * @param  array   $config
  * @return boolean
  */
 public function mustApplyManifestDefaultPath($config)
 {
     return isset($config['manifest']) && !is_string($config['manifest']) && !isset($config['manifest']['path']) && (!isset($config['prefix']) || !Util::containsUrl($config['prefix']));
 }
 public function getQuestion($question)
 {
     $class = Util::hasQuestionHelper() ? 'Symfony\\Component\\Console\\Question\\Question' : 'Rj\\FrontendBundle\\Command\\Options\\Legacy\\Question';
     return new $class("<question>{$question}</question>", $this->defaultValue);
 }