Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function getContent()
 {
     $formulae = array();
     /** @var $config ConfigurationInterface */
     foreach ($this->bowerManager->getBundles() as $bundle => $config) {
         try {
             $mapping = $this->bower->getDependencyMapping($config);
         } catch (FileNotFoundException $ex) {
             throw $ex;
         } catch (RuntimeException $ex) {
             throw new RuntimeException('Dependency cache keys not yet generated, run "app/console sp:bower:install" to initiate the cache: ' . $ex->getMessage());
         }
         $extensionFormulae = array();
         foreach ($mapping as $package) {
             $packageName = $this->namingStrategy->translateName($package->getName());
             foreach ($this->extensions as $extension) {
                 $packageFormulae = $this->createPackageFormulae($package, $packageName, $extension);
                 if (!empty($packageFormulae)) {
                     $formulaName = sprintf('%s_%s', $packageName, $extension);
                     $formulae[$formulaName] = $packageFormulae;
                     $extensionFormulae[$extension][] = $formulaName;
                 }
             }
         }
         $bundleFormulae = $this->createBundleFormulae($bundle, $extensionFormulae);
         $formulae = array_merge($formulae, $bundleFormulae);
     }
     return $formulae;
 }
Exemplo n.º 2
0
 public function testGetDependencyMapping()
 {
     $configDir = self::$fixturesDirectory . "/config";
     $config = new Configuration($configDir);
     $config->setCache($this->cache);
     $arrayDependencyMapping = (require self::$fixturesDirectory . '/simple_dependency_mapping.php');
     $this->cache->expects($this->once())->method('contains')->will($this->returnValue(true));
     $this->cache->expects($this->once())->method('fetch')->will($this->returnValue($arrayDependencyMapping));
     $this->dependencyMapper->expects($this->once())->method('map')->with($this->equalTo($arrayDependencyMapping));
     $this->bower->getDependencyMapping($config);
 }