示例#1
0
 /**
  *
  */
 public function testAddStrategyException()
 {
     $this->setExpectedException('InvalidArgumentException');
     $manager = new Builder($this->getPackageBuilder());
     $manager->addStrategy('test', $this->getStrategy());
     $manager->addStrategy('test', $this->getStrategy());
 }
示例#2
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;
 }