/**
  * {@inheritdoc}
  */
 protected function initialize(InputInterface $input, OutputInterface $output)
 {
     $inputOptions = $input->getOptions();
     $errors = $this->configModel->validate($inputOptions);
     if (!empty($errors)) {
         foreach ($errors as $error) {
             $output->writeln("<error>{$error}</error>");
         }
         throw new \InvalidArgumentException('Parameter validation failed');
     }
 }
Exemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 protected function initialize(InputInterface $input, OutputInterface $output)
 {
     $inputOptions = $input->getOptions();
     $configOptionsToValidate = [];
     foreach ($this->configModel->getAvailableOptions() as $option) {
         if (array_key_exists($option->getName(), $inputOptions)) {
             $configOptionsToValidate[$option->getName()] = $inputOptions[$option->getName()];
         }
     }
     $errors = $this->configModel->validate($configOptionsToValidate);
     $errors = array_merge($errors, $this->adminUser->validate($input));
     if (!empty($errors)) {
         foreach ($errors as $error) {
             $output->writeln("<error>{$error}</error>");
         }
         throw new \InvalidArgumentException('Parameters validation is failed');
     }
 }
Exemplo n.º 3
0
 /**
  * @expectedException \Exception
  * @expectedExceptionMessage Missing write permissions to the following paths:
  */
 public function testWritePermissionErrors()
 {
     $this->filePermissions->expects($this->once())->method('getMissingWritablePathsForInstallation')->willReturn(['/a/ro/dir', '/media']);
     $this->configModel->process([]);
 }
Exemplo n.º 4
0
 public function testExecuteInteractiveWithNo()
 {
     $this->deploymentConfig->expects($this->once())->method('get')->will($this->returnValue('localhost'));
     $this->configModel->expects($this->once())->method('process')->with([]);
     $this->checkInteraction(false);
 }
 /**
  * Installs deployment configuration
  *
  * @param \ArrayObject|array $data
  * @return void
  */
 public function installDeploymentConfig($data)
 {
     $this->checkInstallationFilePermissions();
     $this->createModulesConfig($data);
     $userData = is_array($data) ? $data : $data->getArrayCopy();
     $this->setupConfigModel->process($userData);
     if ($this->deploymentConfig->isAvailable()) {
         $deploymentConfigData = $this->deploymentConfig->get(ConfigOptionsListConstants::CONFIG_PATH_CRYPT_KEY);
         if (isset($deploymentConfigData)) {
             $this->installInfo[ConfigOptionsListConstants::KEY_ENCRYPTION_KEY] = $deploymentConfigData;
         }
     }
     // reset object manager now that there is a deployment config
     $this->objectManagerProvider->reset();
 }