public function setUp()
 {
     $this->dbValidator = $this->getMock('Magento\\Setup\\Validator\\DbValidator', [], [], '', false);
     $this->deploymentConfig = $this->getMock('Magento\\Framework\\App\\DeploymentConfig', [], [], '', false);
     $this->deploymentConfig->expects($this->once())->method('get')->willReturn([ConfigOptionsListConstants::KEY_NAME => 'dbname', ConfigOptionsListConstants::KEY_HOST => 'host', ConfigOptionsListConstants::KEY_USER => 'username', ConfigOptionsListConstants::KEY_PASSWORD => 'password']);
     $this->filesystem = $this->getMock('Magento\\Framework\\Filesystem', [], [], '', false);
     $this->write = $this->getMock('Magento\\Framework\\Filesystem\\Directory\\Write', [], [], '', false);
     $this->filesystem->expects($this->once())->method('getDirectoryWrite')->willReturn($this->write);
     $this->phpReadinessCheck = $this->getMock('Magento\\Setup\\Model\\PhpReadinessCheck', [], [], '', false);
     $this->readinessCheck = new ReadinessCheck($this->dbValidator, $this->deploymentConfig, $this->filesystem, $this->phpReadinessCheck);
     $this->phpReadinessCheck->expects($this->once())->method('checkPhpVersion')->willReturn(['success' => true]);
     $this->phpReadinessCheck->expects($this->once())->method('checkPhpExtensions')->willReturn(['success' => true]);
     $this->phpReadinessCheck->expects($this->once())->method('checkPhpSettings')->willReturn(['success' => true]);
     $this->expected = [ReadinessCheck::KEY_PHP_VERSION_VERIFIED => ['success' => true], ReadinessCheck::KEY_PHP_EXTENSIONS_VERIFIED => ['success' => true], ReadinessCheck::KEY_PHP_SETTINGS_VERIFIED => ['success' => true]];
 }
Exemplo n.º 2
0
 public function testPhpExtensionsActionUpdater()
 {
     $request = $this->getMock('\\Zend\\Http\\PhpEnvironment\\Request', [], [], '', false);
     $response = $this->getMock('\\Zend\\Http\\PhpEnvironment\\Response', [], [], '', false);
     $routeMatch = $this->getMock('\\Zend\\Mvc\\Router\\RouteMatch', [], [], '', false);
     $mvcEvent = $this->getMock('\\Zend\\Mvc\\MvcEvent', [], [], '', false);
     $mvcEvent->expects($this->once())->method('setRequest')->with($request)->willReturn($mvcEvent);
     $mvcEvent->expects($this->once())->method('setResponse')->with($response)->willReturn($mvcEvent);
     $mvcEvent->expects($this->once())->method('setTarget')->with($this->environment)->willReturn($mvcEvent);
     $mvcEvent->expects($this->any())->method('getRouteMatch')->willReturn($routeMatch);
     $request->expects($this->once())->method('getQuery')->willReturn(ReadinessCheckUpdater::UPDATER);
     $this->phpReadinessCheck->expects($this->never())->method('checkPhpExtensions');
     $read = $this->getMockForAbstractClass('Magento\\Framework\\Filesystem\\Directory\\ReadInterface', [], '', false);
     $this->filesystem->expects($this->once())->method('getDirectoryRead')->willReturn($read);
     $read->expects($this->once())->method('readFile')->willReturn('');
     $this->environment->setEvent($mvcEvent);
     $this->environment->dispatch($request, $response);
     $this->environment->phpExtensionsAction();
 }
Exemplo n.º 3
0
 /**
  * @expectedException \Exception
  * @expectedExceptionMessage Missing following extensions: 'foo'
  */
 public function testCheckExtensionsError()
 {
     $this->phpReadinessCheck->expects($this->once())->method('checkPhpExtensions')->willReturn(
         ['responseType' => \Magento\Setup\Controller\ResponseTypeInterface::RESPONSE_TYPE_ERROR,
         'data'=>['required'=>['foo', 'bar'], 'missing'=>['foo']]]
     );
     $this->object->checkExtensions();
 }