protected function setUp() { $this->service = new CacheControlService(); $this->mockContentCacheAspect = $this->getMock('MOC\\Varnish\\Aspects\\ContentCacheAspect'); $this->inject($this->service, 'contentCacheAspect', $this->mockContentCacheAspect); $this->mockLogger = $this->getMockBuilder('MOC\\Varnish\\Log\\LoggerInterface')->getMock(); $this->inject($this->service, 'logger', $this->mockLogger); $this->contentCacheFrontend = new MetadataAwareStringFrontend('test', new TransientMemoryBackend(new ApplicationContext('Testing'))); $this->contentCacheFrontend->initializeObject(); $this->inject($this->service, 'contentCacheFrontend', $this->contentCacheFrontend); $this->mockTokenStorage = $this->getMock('MOC\\Varnish\\Service\\TokenStorage'); $this->inject($this->service, 'tokenStorage', $this->mockTokenStorage); $this->mockRequest = $this->getMock('TYPO3\\Flow\\Mvc\\RequestInterface'); $this->mockResponse = $this->getMock('TYPO3\\Flow\\Http\\Response'); $this->mockController = $this->getMock('TYPO3\\Neos\\Controller\\Frontend\\NodeController'); $this->mockControllerContext = $this->getMockBuilder('TYPO3\\Flow\\Mvc\\Controller\\ControllerContext')->disableOriginalConstructor()->getMock(); $this->mockController->expects($this->any())->method('getControllerContext')->willReturn($this->mockControllerContext); $this->mockArguments = $this->getMockBuilder('TYPO3\\Flow\\Mvc\\Controller\\Arguments')->getMock(); $this->mockControllerContext->expects($this->any())->method('getArguments')->willReturn($this->mockArguments); $this->mockArguments->expects($this->any())->method('hasArgument')->with('node')->willReturn(TRUE); $this->mockArgument = $this->getMockBuilder('TYPO3\\Flow\\Mvc\\Controller\\Argument')->disableOriginalConstructor()->getMock(); $this->mockArguments->expects($this->any())->method('getArgument')->with('node')->willReturn($this->mockArgument); $this->mockNode = $this->getMock('TYPO3\\TYPO3CR\\Domain\\Model\\NodeInterface'); $this->mockArgument->expects($this->any())->method('getValue')->willReturn($this->mockNode); $this->mockContext = $this->getMockBuilder('TYPO3\\TYPO3CR\\Domain\\Service\\Context')->disableOriginalConstructor()->getMock(); $this->mockNode->expects($this->any())->method('getContext')->willReturn($this->mockContext); }
/** * @test */ public function setDataTypeProvidesFluentInterfaceAndReallySetsDataType() { $returnedArgument = $this->simpleValueArgument->setDataType('integer'); $this->assertSame($this->simpleValueArgument, $returnedArgument, 'The returned argument is not the original argument.'); $this->assertSame('integer', $this->simpleValueArgument->getDataType(), 'The got dataType is not the set dataType.'); }
/** * Creates, adds and returns a new controller argument to this composite object. * If an argument with the same name exists already, it will be replaced by the * new argument object. * * @param string $name Name of the argument * @param string $dataType Name of one of the built-in data types * @param boolean $isRequired TRUE if this argument should be marked as required * @param mixed $defaultValue Default value of the argument. Only makes sense if $isRequired==FALSE * @return Argument The new argument * @api */ public function addNewArgument($name, $dataType = 'string', $isRequired = true, $defaultValue = null) { $argument = new Argument($name, $dataType); $argument->setRequired($isRequired); $argument->setDefaultValue($defaultValue); $this->addArgument($argument); return $argument; }