Exemplo n.º 1
0
 /**
  * @test
  */
 public function descendAllKeepsArrayIndexes()
 {
     $array = array(array('name' => 'Foo', 'secret' => TRUE), array('name' => 'Bar', 'secret' => TRUE));
     $this->view->assign('value', $array);
     $this->view->setConfiguration(array('value' => array('_descendAll' => array('_descendAll' => array()))));
     $expectedResult = '[{"name":"Foo","secret":true},{"name":"Bar","secret":true}]';
     $actualResult = $this->view->render();
     $this->assertEquals($expectedResult, $actualResult);
 }
Exemplo n.º 2
0
 /**
  * Check extension dependencies
  *
  * @param \TYPO3\CMS\Extensionmanager\Domain\Model\Extension $extension
  * @throws \Exception
  */
 public function checkDependenciesAction(\TYPO3\CMS\Extensionmanager\Domain\Model\Extension $extension)
 {
     $message = '';
     $title = '';
     $hasDependencies = false;
     $hasErrors = false;
     $dependencyTypes = null;
     $configuration = ['value' => ['dependencies' => []]];
     if ($this->configurationUtility->getCurrentConfiguration('extensionmanager')['automaticInstallation']['value']) {
         $action = 'installFromTer';
         try {
             $dependencyTypes = $this->managementService->getAndResolveDependencies($extension);
             if (!empty($dependencyTypes)) {
                 $hasDependencies = true;
                 $message = '<p>' . $this->translate('downloadExtension.dependencies.headline') . '</p>';
                 foreach ($dependencyTypes as $dependencyType => $dependencies) {
                     $extensions = '';
                     foreach ($dependencies as $extensionKey => $dependency) {
                         if (!isset($configuration['value']['dependencies'][$dependencyType])) {
                             $configuration['value']['dependencies'][$dependencyType] = [];
                         }
                         $configuration['value']['dependencies'][$dependencyType][$extensionKey] = ['_exclude' => ['categoryIndexFromStringOrNumber']];
                         $extensions .= $this->translate('downloadExtension.dependencies.extensionWithVersion', [$extensionKey, $dependency->getVersion()]) . '<br />';
                     }
                     $message .= $this->translate('downloadExtension.dependencies.typeHeadline', [$this->translate('downloadExtension.dependencyType.' . $dependencyType), $extensions]);
                 }
                 $title = $this->translate('downloadExtension.dependencies.resolveAutomatically');
             }
         } catch (\Exception $e) {
             $hasErrors = true;
             $title = $this->translate('downloadExtension.dependencies.errorTitle');
             $message = $e->getMessage();
         }
     } else {
         // if automatic installation is deactivated, no dependency check is needed (download only)
         $action = 'installExtensionWithoutSystemDependencyCheck';
     }
     $url = $this->uriBuilder->uriFor($action, ['extension' => $extension->getUid(), 'format' => 'json'], 'Download');
     $this->view->setConfiguration($configuration);
     $this->view->assign('value', ['dependencies' => $dependencyTypes, 'url' => $url, 'message' => $message, 'hasErrors' => $hasErrors, 'hasDependencies' => $hasDependencies, 'title' => $title]);
 }