예제 #1
0
 /**
  * Verifies php verifications
  *
  * @return JsonModel
  */
 public function phpExtensionsAction()
 {
     try {
         $required = $this->phpInformation->getRequired();
         $current = $this->phpInformation->getCurrent();
     } catch (\Exception $e) {
         return new JsonModel(['responseType' => ResponseTypeInterface::RESPONSE_TYPE_ERROR, 'data' => ['error' => 'phpExtensionError', 'message' => 'Cannot determine required PHP extensions: ' . $e->getMessage()]]);
     }
     $responseType = ResponseTypeInterface::RESPONSE_TYPE_SUCCESS;
     $missing = array_values(array_diff($required, $current));
     if ($missing) {
         $responseType = ResponseTypeInterface::RESPONSE_TYPE_ERROR;
     }
     $data = ['responseType' => $responseType, 'data' => ['required' => $required, 'missing' => $missing]];
     return new JsonModel($data);
 }
 /**
  * @expectedException \Exception
  * @expectedExceptionMessage Missing key 'packages' in 'composer.lock' file
  */
 public function testGetRequiredExceptionMissingPackages()
 {
     $this->directoryReadMock->expects($this->once())->method('isExist')->will($this->returnValue(true));
     $this->directoryReadMock->expects($this->once())->method('readFile')->with('composer.lock')->will($this->returnValue('{"platform-dev":{"ext-e":"*", "f":"*"}}'));
     $phpInfo = new PhpInformation($this->filesystemMock);
     $phpInfo->getRequired();
 }