Beispiel #1
0
 public function setUp()
 {
     parent::setUp();
     $this->mockContentObject = $this->getMock('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer', array(), array(), '', FALSE);
     $this->mockConfigurationManager = $this->getMock('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManagerInterface');
     $this->mockConfigurationManager->expects($this->any())->method('getContentObject')->will($this->returnValue($this->mockContentObject));
     $this->viewHelper = $this->getMock('TYPO3\\Fluid\\ViewHelpers\\Format\\CropViewHelper', array('renderChildren'));
     $this->viewHelper->injectConfigurationManager($this->mockConfigurationManager);
     $this->viewHelper->expects($this->once())->method('renderChildren')->will($this->returnValue('Some Content'));
 }
 /**
  * Add an CSS class if this view helper has errors
  *
  * @return void
  */
 protected function setErrorClassAttribute()
 {
     if ($this->hasArgument('class')) {
         $cssClass = $this->arguments['class'] . ' ';
     } else {
         $cssClass = '';
     }
     if ($this->configurationManager->isFeatureEnabled('rewrittenPropertyMapper')) {
         $mappingResultsForProperty = $this->getMappingResultsForProperty();
         if ($mappingResultsForProperty->hasErrors()) {
             if ($this->hasArgument('errorClass')) {
                 $cssClass .= $this->arguments['errorClass'];
             } else {
                 $cssClass .= 'error';
             }
             $this->tag->addAttribute('class', $cssClass);
         }
     } else {
         // @deprecated since Extbase 1.4.0, will be removed in Extbase 1.6.0.
         $errors = $this->getErrorsForProperty();
         if (count($errors) > 0) {
             if ($this->hasArgument('errorClass')) {
                 $cssClass .= $this->arguments['errorClass'];
             } else {
                 $cssClass .= 'error';
             }
             $this->tag->addAttribute('class', $cssClass);
         }
     }
 }
Beispiel #3
0
 /**
  * Renders hidden form fields for referrer information about
  * the current controller and action.
  *
  * @return string Hidden fields with referrer information
  * @todo filter out referrer information that is equal to the target (e.g. same packageKey)
  */
 protected function renderHiddenReferrerFields()
 {
     $request = $this->controllerContext->getRequest();
     $extensionName = $request->getControllerExtensionName();
     $controllerName = $request->getControllerName();
     $actionName = $request->getControllerActionName();
     $result = chr(10);
     if ($this->configurationManager->isFeatureEnabled('rewrittenPropertyMapper')) {
         $result .= '<input type="hidden" name="' . $this->prefixFieldName('__referrer[@extension]') . '" value="' . $extensionName . '" />' . chr(10);
         $result .= '<input type="hidden" name="' . $this->prefixFieldName('__referrer[@controller]') . '" value="' . $controllerName . '" />' . chr(10);
         $result .= '<input type="hidden" name="' . $this->prefixFieldName('__referrer[@action]') . '" value="' . $actionName . '" />' . chr(10);
         $result .= '<input type="hidden" name="' . $this->prefixFieldName('__referrer[arguments]') . '" value="' . htmlspecialchars($this->hashService->appendHmac(base64_encode(serialize($request->getArguments())))) . '" />' . chr(10);
     } else {
         // @deprecated since Extbase 1.4.0, will be removed with Extbase 1.6.0.
         $result .= '<input type="hidden" name="' . $this->prefixFieldName('__referrer[extensionName]') . '" value="' . $extensionName . '" />' . chr(10);
         $result .= '<input type="hidden" name="' . $this->prefixFieldName('__referrer[controllerName]') . '" value="' . $controllerName . '" />' . chr(10);
         $result .= '<input type="hidden" name="' . $this->prefixFieldName('__referrer[actionName]') . '" value="' . $actionName . '" />' . chr(10);
     }
     return $result;
 }
Beispiel #4
0
 /**
  * Initializes this service
  *
  * @throws Exception
  * @return void
  */
 public function initialize()
 {
     if ($this->initialized) {
         throw new \TYPO3\Fluid\Reflection\Exception('The Reflection Service can only be initialized once.', 1232044696);
     }
     $frameworkConfiguration = $this->configurationManager->getConfiguration(\TYPO3\Fluid\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
     $this->cacheIdentifier = 'ReflectionData_' . $frameworkConfiguration['extensionName'];
     $this->loadFromCache();
     $this->initialized = TRUE;
 }
Beispiel #5
0
 /**
  * @param \TYPO3\Fluid\Configuration\ConfigurationManagerInterface $configurationManager
  * @return void
  */
 public function injectConfigurationManager(\TYPO3\Fluid\Configuration\ConfigurationManagerInterface $configurationManager)
 {
     $this->configurationManager = $configurationManager;
     $this->contentObject = $this->configurationManager->getContentObject();
 }
Beispiel #6
0
 /**
  * Copies the specified parseFunc configuration to $GLOBALS['TSFE']->tmpl->setup in Backend mode
  * This somewhat hacky work around is currently needed because the parseFunc() function of tslib_cObj relies on those variables to be set
  *
  * @return void
  */
 protected function simulateFrontendEnvironment()
 {
     $this->tsfeBackup = isset($GLOBALS['TSFE']) ? $GLOBALS['TSFE'] : NULL;
     $GLOBALS['TSFE'] = new \stdClass();
     $GLOBALS['TSFE']->tmpl->setup = $this->configurationManager->getConfiguration(\TYPO3\Fluid\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT);
 }
Beispiel #7
0
 /**
  * @test
  */
 public function constructorCreatesContentObjectIfItIsNotSpecified()
 {
     // FIXME should be compared with identicalTo() - but that does not seem to work
     $this->mockConfigurationManager->expects($this->once())->method('setContentObject')->with($this->equalTo($this->mockContentObject));
     new \TYPO3\Fluid\View\StandaloneView();
 }