/**
  */
 public function setUp()
 {
     $this->ajaxWidgetComponent = new AjaxWidgetComponent();
     $this->mockObjectManager = $this->getMockBuilder('TYPO3\\Flow\\Object\\ObjectManagerInterface')->getMock();
     $this->inject($this->ajaxWidgetComponent, 'objectManager', $this->mockObjectManager);
     $this->mockComponentContext = $this->getMockBuilder('TYPO3\\Flow\\Http\\Component\\ComponentContext')->disableOriginalConstructor()->getMock();
     $this->mockHttpRequest = $this->getMockBuilder('TYPO3\\Flow\\Http\\Request')->disableOriginalConstructor()->getMock();
     $this->mockHttpRequest->expects($this->any())->method('getArguments')->will($this->returnValue(array()));
     $this->mockComponentContext->expects($this->any())->method('getHttpRequest')->will($this->returnValue($this->mockHttpRequest));
     $this->mockHttpResponse = $this->getMockBuilder('TYPO3\\Flow\\Http\\Response')->disableOriginalConstructor()->getMock();
     $this->mockComponentContext->expects($this->any())->method('getHttpResponse')->will($this->returnValue($this->mockHttpResponse));
     $this->mockAjaxWidgetContextHolder = $this->getMockBuilder('TYPO3\\Fluid\\Core\\Widget\\AjaxWidgetContextHolder')->getMock();
     $this->inject($this->ajaxWidgetComponent, 'ajaxWidgetContextHolder', $this->mockAjaxWidgetContextHolder);
     $this->mockHashService = $this->getMockBuilder('TYPO3\\Flow\\Security\\Cryptography\\HashService')->getMock();
     $this->inject($this->ajaxWidgetComponent, 'hashService', $this->mockHashService);
     $this->mockDispatcher = $this->getMockBuilder('TYPO3\\Flow\\Mvc\\Dispatcher')->getMock();
     $this->inject($this->ajaxWidgetComponent, 'dispatcher', $this->mockDispatcher);
     $this->mockSecurityContext = $this->getMockBuilder('TYPO3\\Flow\\Security\\Context')->getMock();
     $this->inject($this->ajaxWidgetComponent, 'securityContext', $this->mockSecurityContext);
     $this->mockPropertyMappingConfiguration = $this->getMockBuilder('TYPO3\\Flow\\Property\\PropertyMappingConfiguration')->disableOriginalConstructor()->getMock();
     $this->inject($this->ajaxWidgetComponent, 'propertyMappingConfiguration', $this->mockPropertyMappingConfiguration);
     $this->mockPropertyMapper = $this->getMockBuilder('TYPO3\\Flow\\Property\\PropertyMapper')->disableOriginalConstructor()->getMock();
     $this->mockPropertyMapper->expects($this->any())->method('convert')->with('', 'array', $this->mockPropertyMappingConfiguration)->will($this->returnValue(array()));
     $this->inject($this->ajaxWidgetComponent, 'propertyMapper', $this->mockPropertyMapper);
 }
 private static function map($object, $class)
 {
     return PropertyMapper::map(new $class(), $object);
 }
Example #3
0
 public function addError($error)
 {
     $this->propertyMapper->getMessages()->forProperty($this->propertyName)->addError($error);
 }