Пример #1
0
 /**
  * @test
  * @author Sebastian Kurfürst <*****@*****.**>
  */
 public function callActionMethodPassesDefaultValuesAsArguments()
 {
     $mockRequest = $this->getMock('TYPO3\\CMS\\Extbase\\Mvc\\Request', array(), array(), '', FALSE);
     $mockResponse = $this->getMock('TYPO3\\CMS\\Extbase\\Mvc\\ResponseInterface', array(), array(), '', FALSE);
     $arguments = new \ArrayObject();
     $optionalArgument = new \TYPO3\CMS\Extbase\Mvc\Controller\Argument('name1', 'Text');
     $optionalArgument->setDefaultValue('Default value');
     $arguments[] = $optionalArgument;
     $mockArgumentMappingResults = $this->getMock('TYPO3\\CMS\\Extbase\\Property\\MappingResults', array(), array(), '', FALSE);
     $mockArgumentMappingResults->expects($this->once())->method('hasErrors')->will($this->returnValue(FALSE));
     $mockController = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Mvc\\Controller\\ActionController', array('fooAction', 'initializeAction'), array(), '', FALSE);
     $mockSignalSlotDispatcher = $this->getMock('TYPO3\\CMS\\Extbase\\SignalSlot\\Dispatcher', array(), array(), '', FALSE);
     $mockController->_set('signalSlotDispatcher', $mockSignalSlotDispatcher);
     $this->enableDeprecatedPropertyMapperInController($mockController);
     $mockController->expects($this->once())->method('fooAction')->with('Default value');
     $mockController->_set('request', $mockRequest);
     $mockController->_set('response', $mockResponse);
     $mockController->_set('arguments', $arguments);
     $mockController->_set('actionMethodName', 'fooAction');
     $mockController->_set('argumentsMappingResults', $mockArgumentMappingResults);
     $mockController->_call('callActionMethod');
 }
 /**
  * @test
  */
 public function settingDefaultValueReallySetsDefaultValue()
 {
     $argument = new \TYPO3\CMS\Extbase\Mvc\Controller\Argument('dummy', 'Text');
     $argument->setDefaultValue(42);
     $this->assertEquals(42, $argument->getValue(), 'The default value was not stored in the Argument.');
 }