/**
  * @param array $dbVersionErrors
  *
  * @dataProvider aroundDispatchExceptionDataProvider
  * @expectedException \Magento\Framework\Exception\LocalizedException
  * @expectedExceptionMessage Please upgrade your database:
  */
 public function testAroundDispatchException(array $dbVersionErrors)
 {
     $this->_cacheMock->expects($this->once())->method('load')->with('db_is_up_to_date')->will($this->returnValue(false));
     $this->_cacheMock->expects($this->never())->method('save');
     $this->dbVersionInfoMock->expects($this->any())->method('getDbVersionErrors')->will($this->returnValue($dbVersionErrors));
     $this->_model->aroundDispatch($this->subjectMock, $this->closureMock, $this->requestMock);
 }
 public function testExecuteNotInstalled()
 {
     $this->deploymentConfig->expects($this->once())->method('isAvailable')->will($this->returnValue(false));
     $this->dbVersionInfo->expects($this->never())->method('getDbVersionErrors');
     $tester = new CommandTester($this->command);
     $tester->execute([]);
     $this->assertStringMatchesFormat('No information is available: the Magento application is not installed.%w', $tester->getDisplay());
 }
 /**
  * @param \Magento\Framework\App\FrontController $subject
  * @param \Closure $proceed
  * @param \Magento\Framework\App\RequestInterface $request
  *
  * @throws \Magento\Framework\Module\Exception
  * @return \Magento\Framework\App\ResponseInterface
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function aroundDispatch(\Magento\Framework\App\FrontController $subject, \Closure $proceed, \Magento\Framework\App\RequestInterface $request)
 {
     if (!$this->cache->load('db_is_up_to_date')) {
         $errors = $this->dbVersionInfo->getDbVersionErrors();
         if ($errors) {
             $formattedErrors = $this->formatErrors($errors);
             throw new \Magento\Framework\Module\Exception('Please update your database: Run "php -f index.php update" from the Magento root/setup directory.' . PHP_EOL . 'The following modules are outdated:' . PHP_EOL . implode(PHP_EOL, $formattedErrors));
         } else {
             $this->cache->save('true', 'db_is_up_to_date');
         }
     }
     return $proceed($request);
 }
 /**
  * @param \Magento\Framework\App\FrontController $subject
  * @param \Closure $proceed
  * @param \Magento\Framework\App\RequestInterface $request
  *
  * @throws \Magento\Framework\Exception\LocalizedException
  * @return \Magento\Framework\App\ResponseInterface
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function aroundDispatch(\Magento\Framework\App\FrontController $subject, \Closure $proceed, \Magento\Framework\App\RequestInterface $request)
 {
     if (!$this->cache->load('db_is_up_to_date')) {
         $errors = $this->dbVersionInfo->getDbVersionErrors();
         if ($errors) {
             $formattedErrors = $this->formatErrors($errors);
             throw new \Magento\Framework\Exception\LocalizedException(new \Magento\Framework\Phrase('Please upgrade your database: Run "bin/magento setup:upgrade" from the Magento root directory.' . ' %1The following modules are outdated:%2%3', [PHP_EOL, PHP_EOL, implode(PHP_EOL, $formattedErrors)]));
         } else {
             $this->cache->save('true', 'db_is_up_to_date');
         }
     }
     return $proceed($request);
 }
 /**
  * @expectedException \UnexpectedValueException
  * @expectedExceptionMessage Setup version for module 'Module_No_Schema' is not specified
  */
 public function testIsDbDataUpToDateException()
 {
     $this->dbVersionInfo->isDataUpToDate('Module_No_Schema');
 }
Beispiel #6
0
 public function testUpdateDataNoUpdates()
 {
     $this->_dbVersionInfo->expects($this->once())->method('isDataUpToDate')->with('Test_Module', 'catalog_setup')->will($this->returnValue(true));
     $this->_factoryMock->expects($this->never())->method('create');
     $this->_model->updateData();
 }