21 use TYPO3\TestingFramework\Fluid\Unit\ViewHelpers\ViewHelperBaseTestcase;
44 protected function setUp()
48 $this->injectDependenciesIntoViewHelper($this->viewHelper);
50 $this->uriBuilderMock = $this->getMockBuilder(UriBuilder::class)->getMock();
58 $viewHelper = $this->getMockBuilder(UriViewHelper::class)
59 ->setMethods([
'registerArgument'])
62 $viewHelper->expects($this->at(0))->method(
'registerArgument')->with(
'route',
'string', $this->anything());
63 $viewHelper->expects($this->at(1))->method(
'registerArgument')->with(
'parameters',
'array', $this->anything());
64 $viewHelper->expects($this->at(2))->method(
'registerArgument')
74 $this->viewHelper->setArguments([
75 'route' =>
'theRouteArgument',
76 'parameters' => [
'parameter' =>
'to pass'],
77 'referenceType' =>
'theReferenceTypeArgument'
80 GeneralUtility::setSingletonInstance(UriBuilder::class, $this->uriBuilderMock);
82 $this->uriBuilderMock->expects($this->once())->method(
'buildUriFromRoute')
83 ->with(
'theRouteArgument', [
'parameter' =>
'to pass'],
'theReferenceTypeArgument')->willReturn(
'theUri');
85 $this->assertEquals(
'theUri', $this->viewHelper->render());
93 $this->setArgumentsUnderTest(
96 'route' =>
'theRouteArgument',
97 'referenceType' =>
'theReferenceTypeArgument'
100 GeneralUtility::setSingletonInstance(UriBuilder::class, $this->uriBuilderMock);
102 $this->uriBuilderMock->expects($this->once())->method(
'buildUriFromRoute')
103 ->with(
'theRouteArgument', [],
'theReferenceTypeArgument')->willReturn(
'theUri');
104 $this->viewHelper->render();