public function testCleanupDb()
 {
     $this->config->expects($this->once())->method('isAvailable')->willReturn(true);
     $this->config->expects($this->once())->method('getSegment')->with(DbConfig::CONFIG_KEY)->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('Recreating database `magento`');
     $this->object->cleanupDb();
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 public function logSuccess($message)
 {
     return $this->subject->logSuccess($message);
 }
Example #3
0
 /**
  * Removes deployment configuration
  *
  * @return void
  */
 private function deleteDeploymentConfig()
 {
     $configDir = $this->filesystem->getDirectoryWrite(DirectoryList::CONFIG);
     $file = 'config.php';
     $absolutePath = $configDir->getAbsolutePath($file);
     if (!$configDir->isFile($file)) {
         $this->log->log("The file '{$absolutePath}' doesn't exist - skipping cleanup");
         return;
     }
     try {
         $this->log->log($absolutePath);
         $configDir->delete($file);
     } catch (FilesystemException $e) {
         $this->log->log($e->getMessage());
     }
 }
Example #4
0
 /**
  * Include file by path
  * This method should perform only file inclusion.
  * Implemented to prevent possibility of changing important and used variables
  * inside the setup model while installing
  *
  * @param string $fileName
  * @return mixed
  */
 private function includeFile($fileName)
 {
     $this->logger->log("Include {$fileName}");
     return include $fileName;
 }