예제 #1
0
 /**
  * Default Constructor
  *
  * @param WebLogger $logger
  * @param InstallerFactory $installerFactory
  * @param ProgressFactory $progressFactory
  * @param \Magento\Framework\Setup\SampleData\State $sampleDataState
  */
 public function __construct(WebLogger $logger, InstallerFactory $installerFactory, ProgressFactory $progressFactory, \Magento\Framework\Setup\SampleData\State $sampleDataState)
 {
     $this->log = $logger;
     $this->installer = $installerFactory->create($logger);
     $this->progressFactory = $progressFactory;
     $this->sampleDataState = $sampleDataState;
 }
예제 #2
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $installer = $this->installerFactory->create(new ConsoleLogger($output));
     $installer->updateModulesSequence();
     $installer->installSchema();
     $installer->installDataFixtures();
 }
 public function testExecuteNotInstalled()
 {
     $this->deploymentConfig->expects($this->once())->method('isAvailable')->will($this->returnValue(false));
     $this->installerFactory->expects($this->never())->method('create');
     $tester = new CommandTester($this->command);
     $tester->execute([]);
     $this->assertStringMatchesFormat("Store settings can't be saved because the Magento application is not installed.%w", $tester->getDisplay());
 }
예제 #4
0
 public function testExecuteNoConfig()
 {
     $this->deploymentConfig->expects($this->once())->method('isAvailable')->will($this->returnValue(false));
     $this->installerFactory->expects($this->never())->method('create');
     $commandTester = new CommandTester(new DbDataUpgradeCommand($this->installerFactory, $this->deploymentConfig));
     $commandTester->execute([]);
     $this->assertStringMatchesFormat('No information is available: the application is not installed.%w', $commandTester->getDisplay());
 }
예제 #5
0
 /**
  * Default Constructor
  *
  * @param WebLogger $logger
  * @param InstallerFactory $installerFactory
  * @param ProgressFactory $progressFactory
  * @param \Magento\Framework\Setup\SampleData\State $sampleDataState
  * @param \Magento\Framework\App\DeploymentConfig $deploymentConfig
  * @param RequestDataConverter $requestDataConverter
  */
 public function __construct(WebLogger $logger, InstallerFactory $installerFactory, ProgressFactory $progressFactory, \Magento\Framework\Setup\SampleData\State $sampleDataState, DeploymentConfig $deploymentConfig, RequestDataConverter $requestDataConverter)
 {
     $this->log = $logger;
     $this->installer = $installerFactory->create($logger);
     $this->progressFactory = $progressFactory;
     $this->sampleDataState = $sampleDataState;
     $this->deploymentConfig = $deploymentConfig;
     $this->requestDataConverter = $requestDataConverter;
 }
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if (!$this->deploymentConfig->isAvailable()) {
         $output->writeln("<info>Store settings can't be saved because the Magento application is not installed.</info>");
         return;
     }
     $installer = $this->installerFactory->create(new ConsoleLogger($output));
     $installer->installUserConfig($input->getOptions());
 }
예제 #7
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if (!$this->deploymentConfig->isAvailable()) {
         $output->writeln("<info>No information is available: the application is not installed.</info>");
         return;
     }
     $installer = $this->installFactory->create(new ConsoleLogger($output));
     $installer->installSchema();
 }
예제 #8
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $helper = $this->getHelper('question');
     $question = new ConfirmationQuestion('Are you sure you want to uninstall Magento?[y/N]', false);
     if ($helper->ask($input, $output, $question) || !$input->isInteractive()) {
         $installer = $this->installerFactory->create(new ConsoleLogger($output));
         $installer->uninstall();
     }
 }
예제 #9
0
 /**
  * Default Constructor
  *
  * @param WebLogger $logger
  * @param InstallerFactory $installerFactory
  * @param ProgressFactory $progressFactory
  */
 public function __construct(
     WebLogger $logger,
     InstallerFactory $installerFactory,
     ProgressFactory $progressFactory
 ) {
     $this->log = $logger;
     $this->installer = $installerFactory->create($logger);
     $this->progressFactory = $progressFactory;
 }
예제 #10
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $errors = $this->validate($input);
     if ($errors) {
         throw new \InvalidArgumentException(implode("\n", $errors));
     }
     $installer = $this->installerFactory->create(new ConsoleLogger($output));
     $installer->installAdminUser($input->getOptions());
     $output->writeln('<info>Created admin user ' . $input->getOption(AdminAccount::KEY_USER) . '</info>');
 }
예제 #11
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if (!$this->deploymentConfig->isAvailable()) {
         $output->writeln("<info>No information is available: the Magento application is not installed.</info>");
         // we must have an exit code higher than zero to indicate something was wrong
         return \Magento\Framework\Console\Cli::RETURN_FAILURE;
     }
     $installer = $this->installFactory->create(new ConsoleLogger($output));
     $installer->installDataFixtures();
 }
 public function testExecute()
 {
     $options = ['--' . AdminAccount::KEY_USER => 'user', '--' . AdminAccount::KEY_PASSWORD => '123123q', '--' . AdminAccount::KEY_EMAIL => '*****@*****.**', '--' . AdminAccount::KEY_FIRST_NAME => 'John', '--' . AdminAccount::KEY_LAST_NAME => 'Doe'];
     $data = [AdminAccount::KEY_USER => 'user', AdminAccount::KEY_PASSWORD => '123123q', AdminAccount::KEY_EMAIL => '*****@*****.**', AdminAccount::KEY_FIRST_NAME => 'John', AdminAccount::KEY_LAST_NAME => 'Doe', InitParamListener::BOOTSTRAP_PARAM => null];
     $commandTester = new CommandTester($this->command);
     $installerMock = $this->getMock('Magento\\Setup\\Model\\Installer', [], [], '', false);
     $installerMock->expects($this->once())->method('installAdminUser')->with($data);
     $this->installerFactoryMock->expects($this->once())->method('create')->willReturn($installerMock);
     $commandTester->execute($options);
     $this->assertEquals('Created Magento administrator user named user' . PHP_EOL, $commandTester->getDisplay());
 }
예제 #13
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $errors = $this->validate($input);
     if ($errors) {
         $output->writeln('<error>' . implode('</error>' . PHP_EOL . '<error>', $errors) . '</error>');
         return;
     }
     $installer = $this->installerFactory->create(new ConsoleLogger($output));
     $installer->installAdminUser($input->getOptions());
     $output->writeln('<info>Created Shop123 Administrator user named ' . $input->getOption(AdminAccount::KEY_USER) . '</info>');
 }
예제 #14
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $keepGenerated = $input->getOption(self::INPUT_KEY_KEEP_GENERATED);
     $installer = $this->installerFactory->create(new ConsoleLogger($output));
     $installer->updateModulesSequence($keepGenerated);
     $installer->installSchema();
     $installer->installDataFixtures();
     if (!$keepGenerated) {
         $output->writeln('<info>Please re-run Magento compile command</info>');
     }
 }
예제 #15
0
 /**
  * Result of checking DB credentials
  *
  * @return JsonModel
  */
 public function indexAction()
 {
     $params = Json::decode($this->getRequest()->getContent(), Json::TYPE_ARRAY);
     try {
         $installer = $this->installerFactory->create($this->webLogger);
         $password = isset($params['password']) ? $params['password'] : '';
         $installer->checkDatabaseConnection($params['name'], $params['host'], $params['user'], $password);
         return new JsonModel(['success' => true]);
     } catch (\Exception $e) {
         return new JsonModel(['success' => false, 'error' => $e->getMessage()]);
     }
 }
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $errors = $this->validate($input);
     if ($errors) {
         $output->writeln('<error>' . implode('</error>' . PHP_EOL . '<error>', $errors) . '</error>');
         // we must have an exit code higher than zero to indicate something was wrong
         return \Magento\Framework\Console\Cli::RETURN_FAILURE;
     }
     $installer = $this->installerFactory->create(new ConsoleLogger($output));
     $installer->installAdminUser($input->getOptions());
     $output->writeln('<info>Created Magento administrator user named ' . $input->getOption(AdminAccount::KEY_USER) . '</info>');
 }
 public function testCreate()
 {
     $returnValueMap = [['Magento\\Setup\\Model\\FilePermissions', $this->getMock('Magento\\Setup\\Model\\FilePermissions', [], [], '', false)], ['Magento\\Framework\\App\\DeploymentConfig\\Writer', $this->getMock('Magento\\Framework\\App\\DeploymentConfig\\Writer', [], [], '', false)], ['Magento\\Framework\\App\\DeploymentConfig\\Reader', $this->getMock('Magento\\Framework\\App\\DeploymentConfig\\Reader', [], [], '', false)], ['Magento\\Framework\\App\\DeploymentConfig', $this->getMock('Magento\\Framework\\App\\DeploymentConfig', [], [], '', false)], ['Magento\\Framework\\Module\\ModuleList', $this->getMock('Magento\\Framework\\Module\\ModuleList', [], [], '', false)], ['Magento\\Framework\\Module\\ModuleList\\Loader', $this->getMock('Magento\\Framework\\Module\\ModuleList\\Loader', [], [], '', false)], ['Magento\\Setup\\Model\\AdminAccountFactory', $this->getMock('Magento\\Setup\\Model\\AdminAccountFactory', [], [], '', false)], ['Magento\\Setup\\Module\\ConnectionFactory', $this->getMock('Magento\\Setup\\Module\\ConnectionFactory', [], [], '', false)], ['Magento\\Framework\\App\\MaintenanceMode', $this->getMock('Magento\\Framework\\App\\MaintenanceMode', [], [], '', false)], ['Magento\\Framework\\Filesystem', $this->getMock('Magento\\Framework\\Filesystem', [], [], '', false)], ['Magento\\Setup\\Model\\ObjectManagerProvider', $this->getMock('Magento\\Setup\\Model\\ObjectManagerProvider', [], [], '', false)], ['Magento\\Framework\\Model\\ResourceModel\\Db\\TransactionManager', $this->getMock('Magento\\Framework\\Model\\ResourceModel\\Db\\TransactionManager', [], [], '', false)], ['Magento\\Framework\\Model\\ResourceModel\\Db\\ObjectRelationProcessor', $this->getMock('Magento\\Framework\\Model\\ResourceModel\\Db\\ObjectRelationProcessor', [], [], '', false)], ['Magento\\Setup\\Model\\ConfigModel', $this->getMock('Magento\\Setup\\Model\\ConfigModel', [], [], '', false)], ['Magento\\Framework\\App\\State\\CleanupFiles', $this->getMock('Magento\\Framework\\App\\State\\CleanupFiles', [], [], '', false)], ['Magento\\Setup\\Validator\\DbValidator', $this->getMock('Magento\\Setup\\Validator\\DbValidator', [], [], '', false)], ['Magento\\Setup\\Module\\SetupFactory', $this->getMock('Magento\\Setup\\Module\\SetupFactory', [], [], '', false)], ['Magento\\Setup\\Module\\DataSetupFactory', $this->getMock('Magento\\Setup\\Module\\DataSetupFactory', [], [], '', false)], ['Magento\\Framework\\Setup\\SampleData\\State', $this->getMock('Magento\\Framework\\Setup\\SampleData\\State', [], [], '', false)]];
     $serviceLocatorMock = $this->getMockForAbstractClass('Zend\\ServiceManager\\ServiceLocatorInterface', ['get']);
     $serviceLocatorMock->expects($this->any())->method('get')->will($this->returnValueMap($returnValueMap));
     $log = $this->getMockForAbstractClass('Magento\\Framework\\Setup\\LoggerInterface');
     $resourceFactoryMock = $this->getMock('Magento\\Setup\\Module\\ResourceFactory', [], [], '', false);
     $resourceFactoryMock->expects($this->any())->method('create')->will($this->returnValue($this->getMock('Magento\\Framework\\App\\ResourceConnection', [], [], '', false)));
     $installerFactory = new InstallerFactory($serviceLocatorMock, $resourceFactoryMock);
     $installer = $installerFactory->create($log);
     $this->assertInstanceOf('Magento\\Setup\\Model\\Installer', $installer);
 }
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if (!$this->deploymentConfig->isAvailable()) {
         $output->writeln("<info>Store settings can't be saved because the Magento application is not installed.</info>");
         // we must have an exit code higher than zero to indicate something was wrong
         return \Magento\Framework\Console\Cli::RETURN_FAILURE;
     }
     $errors = $this->validate($input);
     if ($errors) {
         $output->writeln($errors);
         // we must have an exit code higher than zero to indicate something was wrong
         return \Magento\Framework\Console\Cli::RETURN_FAILURE;
     }
     $installer = $this->installerFactory->create(new ConsoleLogger($output));
     $installer->installUserConfig($input->getOptions());
 }
 /**
  * Test install command with invalid sales_order_increment_prefix value
  *
  * @expectedException \InvalidArgumentException
  * @dataProvider validateWithExceptionDataProvider
  * @param $prefixValue
  */
 public function testValidateWithException($prefixValue)
 {
     $this->installerFactory->expects($this->never())->method('create')->will($this->returnValue($this->installer));
     $this->installer->expects($this->never())->method('install');
     $this->input['--' . InstallCommand::INPUT_KEY_SALES_ORDER_INCREMENT_PREFIX] = $prefixValue;
     $commandTester = new CommandTester($this->command);
     $commandTester->execute($this->input);
 }
 /**
  * @dataProvider validateDataProvider
  * @param array $option
  * @param string $error
  */
 public function testExecuteInvalidData(array $option, $error)
 {
     $url = $this->getMock('Magento\\Framework\\Url\\Validator', [], [], '', false);
     $url->expects($this->any())->method('isValid')->will($this->returnValue(false));
     if (!isset($option['--' . StoreConfigurationDataMapper::KEY_BASE_URL_SECURE])) {
         $url->expects($this->any())->method('getMessages')->will($this->returnValue([Validator::INVALID_URL => 'Invalid URL.']));
     }
     $localeLists = $this->getMock('Magento\\Framework\\Validator\\Locale', [], [], '', false);
     $localeLists->expects($this->any())->method('isValid')->will($this->returnValue(false));
     $timezoneLists = $this->getMock('Magento\\Framework\\Validator\\Timezone', [], [], '', false);
     $timezoneLists->expects($this->any())->method('isValid')->will($this->returnValue(false));
     $currencyLists = $this->getMock('Magento\\Framework\\Validator\\Currency', [], [], '', false);
     $currencyLists->expects($this->any())->method('isValid')->will($this->returnValue(false));
     $returnValueMapOM = [['Magento\\Framework\\Url\\Validator', $url], ['Magento\\Framework\\Validator\\Locale', $localeLists], ['Magento\\Framework\\Validator\\Timezone', $timezoneLists], ['Magento\\Framework\\Validator\\Currency', $currencyLists]];
     $this->objectManager->expects($this->any())->method('get')->will($this->returnValueMap($returnValueMapOM));
     $this->deploymentConfig->expects($this->once())->method('isAvailable')->will($this->returnValue(true));
     $this->installerFactory->expects($this->never())->method('create');
     $commandTester = new CommandTester($this->command);
     $commandTester->execute($option);
     $this->assertEquals($error . PHP_EOL, $commandTester->getDisplay());
 }
 public function testExecuteInteractionNo()
 {
     $this->installer->expects($this->exactly(0))->method('uninstall');
     $this->installerFactory->expects($this->exactly(0))->method('create');
     $this->checkInteraction(false);
 }
예제 #22
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $consoleLogger = new ConsoleLogger($output);
     $installer = $this->installerFactory->create($consoleLogger);
     $installer->install($input->getOptions());
 }
예제 #23
0
 /**
  * Constructor
  *
  * @param ConsoleLogger $consoleLogger
  * @param Lists $options
  * @param InstallerFactory $installerFactory
  * @param MaintenanceMode $maintenanceMode
  * @param ObjectManagerProvider $objectManagerProvider
  */
 public function __construct(ConsoleLogger $consoleLogger, Lists $options, InstallerFactory $installerFactory, MaintenanceMode $maintenanceMode, ObjectManagerProvider $objectManagerProvider)
 {
     $this->log = $consoleLogger;
     $this->options = $options;
     $this->installer = $installerFactory->create($consoleLogger);
     $this->maintenanceMode = $maintenanceMode;
     $this->objectManagerProvider = $objectManagerProvider;
     // By default we use our customized error handler, but for CLI we want to display all errors
     restore_error_handler();
 }
예제 #24
0
 /**
  * Constructor
  *
  * @param ConsoleLogger $consoleLogger
  * @param Lists $options
  * @param InstallerFactory $installerFactory
  * @param MaintenanceMode $maintenanceMode
  */
 public function __construct(ConsoleLogger $consoleLogger, Lists $options, InstallerFactory $installerFactory, MaintenanceMode $maintenanceMode)
 {
     $this->log = $consoleLogger;
     $this->options = $options;
     $this->installer = $installerFactory->create($consoleLogger);
     $this->maintenanceMode = $maintenanceMode;
 }