/** * @test */ public function prepareArgumentsRegistersAnnotationBasedArgumentsWithDescriptionIfDebugModeIsEnabled() { \TYPO3\Fluid\Fluid::$debugMode = TRUE; $dataCacheMock = $this->getMock('TYPO3\\Flow\\Cache\\Frontend\\VariableFrontend', array(), array(), '', FALSE); $dataCacheMock->expects($this->any())->method('has')->will($this->returnValue(TRUE)); $dataCacheMock->expects($this->any())->method('get')->will($this->returnValue(array())); $viewHelper = new \TYPO3\Fluid\Core\Fixtures\TestViewHelper(); $this->mockReflectionService->expects($this->once())->method('getMethodParameters')->with('TYPO3\\Fluid\\Core\\Fixtures\\TestViewHelper', 'render')->will($this->returnValue($this->fixtureMethodParameters)); $this->mockReflectionService->expects($this->once())->method('getMethodTagsValues')->with('TYPO3\\Fluid\\Core\\Fixtures\\TestViewHelper', 'render')->will($this->returnValue($this->fixtureMethodTags)); $viewHelper->injectObjectManager($this->mockObjectManager); $expected = array('param1' => new \TYPO3\Fluid\Core\ViewHelper\ArgumentDefinition('param1', 'integer', 'P1 Stuff', TRUE, NULL, TRUE), 'param2' => new \TYPO3\Fluid\Core\ViewHelper\ArgumentDefinition('param2', 'array', 'P2 Stuff', TRUE, NULL, TRUE), 'param3' => new \TYPO3\Fluid\Core\ViewHelper\ArgumentDefinition('param3', 'string', 'P3 Stuff', FALSE, 'default', TRUE)); $this->assertEquals($expected, $viewHelper->prepareArguments(), 'Annotation based arguments were not registered.'); \TYPO3\Fluid\Fluid::$debugMode = FALSE; }
/** * @test */ public function prepareArgumentsRegistersAnnotationBasedArgumentsWithDescriptionIfDebugModeIsEnabled() { \TYPO3\Fluid\Fluid::$debugMode = true; $dataCacheMock = $this->getMockBuilder(\TYPO3\Flow\Cache\Frontend\VariableFrontend::class)->disableOriginalConstructor()->getMock(); $dataCacheMock->expects($this->any())->method('has')->will($this->returnValue(true)); $dataCacheMock->expects($this->any())->method('get')->will($this->returnValue(array())); $viewHelper = new \TYPO3\Fluid\Core\Fixtures\TestViewHelper(); $this->mockReflectionService->expects($this->once())->method('getMethodParameters')->with(\TYPO3\Fluid\Core\Fixtures\TestViewHelper::class, 'render')->will($this->returnValue($this->fixtureMethodParameters)); $this->mockReflectionService->expects($this->once())->method('getMethodTagsValues')->with(\TYPO3\Fluid\Core\Fixtures\TestViewHelper::class, 'render')->will($this->returnValue($this->fixtureMethodTags)); $viewHelper->injectObjectManager($this->mockObjectManager); $expected = array('param1' => new \TYPO3\Fluid\Core\ViewHelper\ArgumentDefinition('param1', 'integer', 'P1 Stuff', true, null, true), 'param2' => new \TYPO3\Fluid\Core\ViewHelper\ArgumentDefinition('param2', 'array', 'P2 Stuff', true, null, true), 'param3' => new \TYPO3\Fluid\Core\ViewHelper\ArgumentDefinition('param3', 'string', 'P3 Stuff', false, 'default', true)); $this->assertEquals($expected, $viewHelper->prepareArguments(), 'Annotation based arguments were not registered.'); \TYPO3\Fluid\Fluid::$debugMode = false; }