/**
  *
  */
 public function testAddStrategyException()
 {
     $this->setExpectedException('InvalidArgumentException');
     $mapping = $this->getMapping();
     $manager = new PackageBuilder();
     $manager->addMapping($mapping);
     $manager->addMapping($mapping);
 }
Example #2
0
 /**
  * @param  Project           $project
  * @param  Package           $package
  * @param  StrategyInterface $strategy
  * @return bool
  */
 protected function buildPackage(Project $project, Package $package, StrategyInterface $strategy)
 {
     $this->builder->build($package, $project->getTargetDir(), $strategy);
 }
Example #3
0
 /**
  * @return Container
  */
 public static function create()
 {
     $container = new Container();
     $container['locker_file'] = $container->factory(function () {
         return new JsonFile("composer.lock");
     });
     $container['locker'] = $container->factory(function (Container $container) {
         $config = new Config();
         $io = new NullIO();
         $repositoryManager = new RepositoryManager($io, $config);
         $installationManager = new InstallationManager();
         return new Locker($io, $container['locker_file'], $repositoryManager, $installationManager, "");
     });
     $container['repository'] = $container->factory(function (Container $container) {
         return $container->getLocker()->getLockedRepository(true);
     });
     $container['logger'] = $container->factory(function () {
         $logger = new Logger("magebuild");
         return $logger;
     });
     $container['builder'] = $container->factory(function (Container $container) {
         $builder = new PackageBuilder();
         $builder->addMapping(new ModmanMapping());
         $builder->setFilesystem($container->getFilesystem());
         $manager = new Builder($builder);
         $manager->addStrategy('copy', new CopyStrategy());
         $manager->addStrategy('symlink', new SymlinkStrategy());
         $manager->setFilesystem($container->getFilesystem());
         return $manager;
     });
     $container['root_package'] = $container->factory(function (Container $container) {
         $config = $container->getRootPackageFile();
         return $container->getRootPackageLoader()->load($config->read());
     });
     $container['root_package_loader'] = $container->factory(function () {
         return new RootPackageLoader();
     });
     $container['root_package_file'] = $container->factory(function () {
         return new JsonFile("composer.json");
     });
     $container['filesystem'] = $container->factory(function () {
         return new Filesystem();
     });
     return $container;
 }