public function testLogError()
 {
     $e1 = new \Exception('Dummy Exception1');
     $e2 = new \Exception('Dummy Exception2');
     $this->webLogger->logError($e1);
     $this->assertContains('[ERROR] exception \'Exception\' with message \'Dummy Exception1\'', self::$log);
     $this->webLogger->logError($e2);
     $this->assertContains('[ERROR] exception \'Exception\' with message \'Dummy Exception1\'', self::$log);
     $this->assertContains('[ERROR] exception \'Exception\' with message \'Dummy Exception2\'', self::$log);
 }
 public function testLogError()
 {
     $e1 = new \Exception('Dummy Exception1');
     $e2 = new \Exception('Dummy Exception2');
     $this->webLogger->logError($e1);
     $this->assertContains('[ERROR]', self::$log);
     $this->assertContains('Exception', self::$log);
     $this->assertContains($e1->getMessage(), self::$log);
     $this->webLogger->logError($e2);
     $this->assertContains('[ERROR]', self::$log);
     $this->assertContains('Exception', self::$log);
     $this->assertContains($e1->getMessage(), self::$log);
     $this->assertContains($e2->getMessage(), self::$log);
 }
Example #3
0
 /**
  * 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;
 }
Example #4
0
 /**
  * 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;
 }
Example #5
0
 /**
  * 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;
 }