Esempio n. 1
0
 public function testSetBuilder()
 {
     $services = new ServiceManager();
     $builder = ServiceBuilder::factory(array());
     $services->setBuilder('newbuilder', $builder);
     $this->assertEquals($builder, $services->getBuilder('newbuilder'));
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $configFile = $input->getArgument('config-file');
     if (pathinfo($configFile, PATHINFO_EXTENSION) != 'json') {
         throw new \InvalidArgumentException('Configuration file must be a JSON document');
     }
     $dialog = $this->getHelperSet()->get('dialog');
     if (!($identifier = $input->getOption('identifier'))) {
         $identifier = $dialog->ask($output, 'Acquia Network Identifier: ');
     }
     if (!($key = $input->getOption('key'))) {
         $key = $dialog->ask($output, 'Acquia Network Key: ');
     }
     $network = AcquiaNetworkClient::factory(array('network_id' => $identifier, 'network_key' => $key));
     $acquiaServices = Services::ACQUIA_SEARCH;
     $subscription = $network->checkSubscription($acquiaServices);
     $search = AcquiaSearchService::factory($subscription);
     $services = new ServiceManager(array('conf_dir' => dirname($configFile)));
     $group = basename($configFile, '.json');
     $services->setBuilder($group, $search);
     $services->save();
 }