public function testExecute()
 {
     $this->deploymentConfig->expects($this->once())->method('isAvailable')->will($this->returnValue(true));
     $this->installer->expects($this->once())->method('installUserConfig');
     $this->installerFactory->expects($this->once())->method('create')->will($this->returnValue($this->installer));
     $tester = new CommandTester($this->command);
     $tester->execute([]);
 }
コード例 #2
0
ファイル: InstallTest.php プロジェクト: nja78/magento2
 public function testStartActionWithSampleDataError()
 {
     $this->webLogger->expects($this->once())->method('clear');
     $this->webLogger->expects($this->once())->method('logError');
     $this->installer->method('install')->will($this->throwException(new \LogicException));
     $jsonModel = $this->controller->startAction();
     $this->assertInstanceOf('\Zend\View\Model\JsonModel', $jsonModel);
     $variables = $jsonModel->getVariables();
     $this->assertArrayHasKey('success', $variables);
     $this->assertFalse($variables['success']);
 }
コード例 #3
0
 public function testStartActionWithSampleDataError()
 {
     $this->webLogger->expects($this->once())->method('clear');
     $this->webLogger->expects($this->never())->method('logError');
     $this->installer->method('install');
     $this->sampleDataState->expects($this->once())->method('hasError')->willReturn(true);
     $jsonModel = $this->controller->startAction();
     $this->assertInstanceOf('\\Zend\\View\\Model\\JsonModel', $jsonModel);
     $variables = $jsonModel->getVariables();
     $this->assertArrayHasKey('success', $variables);
     $this->assertTrue($variables['success']);
     $this->assertTrue($jsonModel->getVariable('isSampleDataError'));
 }
コード例 #4
0
ファイル: Install.php プロジェクト: vasiljok/magento2
 /**
  * Index Action
  *
  * @return JsonModel
  * @SuppressWarnings(PHPMD.NPathComplexity)
  */
 public function startAction()
 {
     $this->log->clear();
     $json = new JsonModel;
     try {
         $data = array_merge(
             $this->importDeploymentConfigForm(),
             $this->importUserConfigForm(),
             $this->importAdminUserForm()
         );
         $this->installer->install($data);
         $json->setVariable(
             'key',
             $this->installer->getInstallInfo()[SetupConfigOptionsList::KEY_ENCRYPTION_KEY]
         );
         $json->setVariable('success', true);
         $json->setVariable('messages', $this->installer->getInstallInfo()[Installer::INFO_MESSAGE]);
     } catch (\Exception $e) {
         $this->log->logError($e);
         $json->setVariable('success', false);
         if ($e instanceof \Magento\Setup\SampleDataException) {
             $json->setVariable('isSampleDataError', true);
         }
     }
     return $json;
 }
コード例 #5
0
ファイル: Install.php プロジェクト: shabbirvividads/magento2
 /**
  * Index Action
  *
  * @return JsonModel
  */
 public function startAction()
 {
     $this->log->clear();
     $json = new JsonModel();
     try {
         $data = array_merge($this->importDeploymentConfigForm(), $this->importUserConfigForm(), $this->importAdminUserForm());
         $this->installer->install($data);
         $json->setVariable('key', $this->installer->getInstallInfo()[EncryptConfig::KEY_ENCRYPTION_KEY]);
         $json->setVariable('success', true);
         $json->setVariable('messages', $this->installer->getInstallInfo()[Installer::INFO_MESSAGE]);
     } catch (\Exception $e) {
         $this->log->logError($e);
         $json->setVariable('success', false);
     }
     return $json;
 }
コード例 #6
0
ファイル: Install.php プロジェクト: pradeep-wagento/magento2
 /**
  * Get Deployment Config
  *
  * @return \Magento\Framework\App\DeploymentConfig
  *
  * @deprecated
  */
 private function getDeploymentConfig()
 {
     if ($this->deploymentConfig === null) {
         $this->deploymentConfig = $this->installer->getObjectManagerProvider()->get()->get(\Magento\Framework\App\DeploymentConfig::class);
     }
     return $this->deploymentConfig;
 }
コード例 #7
0
 /**
  * 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);
 }
コード例 #8
0
 public function testCleanupDb()
 {
     $this->config->expects($this->once())->method('get')->with(ConfigOptionsListConstants::CONFIG_PATH_DB_CONNECTION_DEFAULT)->willReturn(self::$dbConfig);
     $this->connection->expects($this->at(0))->method('quoteIdentifier')->with('magento')->willReturn('`magento`');
     $this->connection->expects($this->at(1))->method('query')->with('DROP DATABASE IF EXISTS `magento`');
     $this->connection->expects($this->at(2))->method('query')->with('CREATE DATABASE IF NOT EXISTS `magento`');
     $this->logger->expects($this->once())->method('log')->with('Cleaning up database `magento`');
     $this->object->cleanupDb();
 }
コード例 #9
0
ファイル: Install.php プロジェクト: Doability/magento2dev
 /**
  * Index Action
  *
  * @return JsonModel
  */
 public function startAction()
 {
     $this->log->clear();
     $json = new JsonModel();
     try {
         $this->checkForPriorInstall();
         $content = $this->getRequest()->getContent();
         $source = $content ? $source = Json::decode($content, Json::TYPE_ARRAY) : [];
         $data = $this->requestDataConverter->convert($source);
         $this->installer->install($data);
         $json->setVariable('key', $this->installer->getInstallInfo()[SetupConfigOptionsList::KEY_ENCRYPTION_KEY]);
         $json->setVariable('success', true);
         if ($this->sampleDataState->hasError()) {
             $json->setVariable('isSampleDataError', true);
         }
         $json->setVariable('messages', $this->installer->getInstallInfo()[Installer::INFO_MESSAGE]);
     } catch (\Exception $e) {
         $this->log->logError($e);
         $json->setVariable('messages', $e->getMessage());
         $json->setVariable('success', false);
     }
     return $json;
 }
コード例 #10
0
 public function testUninstallAction()
 {
     $this->installer->expects($this->once())->method('uninstall');
     $this->controller->uninstallAction();
 }
コード例 #11
0
 /**
  * @expectedException \Magento\Setup\Exception
  * @expectedExceptionMessage Sorry, but we support MySQL version
  */
 public function testCheckDatabaseConnectionIncompatible()
 {
     $this->connection->expects($this->once())->method('fetchOne')->with('SELECT version()')->willReturn('5.5.40-0ubuntu0.12.04.1');
     $this->object->checkDatabaseConnection('name', 'host', 'user', 'password');
 }
コード例 #12
0
 /**
  * Controller for Uninstall Command
  *
  * @return void
  */
 public function uninstallAction()
 {
     $this->installer->uninstall();
 }
コード例 #13
0
 public function testIndexActionCheckPrefix()
 {
     $this->installer->expects($this->once())->method('checkDatabaseTablePrefix');
     $this->controller->indexAction();
 }
コード例 #14
0
 public function testExecuteInteractionNo()
 {
     $this->installer->expects($this->exactly(0))->method('uninstall');
     $this->installerFactory->expects($this->exactly(0))->method('create');
     $this->checkInteraction(false);
 }