2 namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Format;
46 $this->mockContentObject = $this->getMock(ContentObjectRenderer::class, array(), array(),
'',
false);
47 $this->viewHelper = $this->getMock(\TYPO3\CMS\
Fluid\ViewHelpers\Format\CropViewHelper::class, array(
'renderChildren'));
49 $renderingContext = $this->getMock(RenderingContext::class);
50 $this->viewHelper->setRenderingContext($renderingContext);
51 $this->viewHelper->expects($this->once())->method(
'renderChildren')->will($this->returnValue(
'Some Content'));
59 $this->mockContentObject->expects($this->once())->method(
'cropHTML')->with(
'Some Content',
'123|...|1')->will($this->returnValue(
'Cropped Content'));
61 $actualResult = $this->viewHelper->render(123);
62 $this->assertEquals(
'Cropped Content', $actualResult);
70 $this->mockContentObject->expects($this->once())->method(
'cropHTML')->with(
'Some Content',
'-321|custom suffix|1')->will($this->returnValue(
'Cropped Content'));
72 $actualResult = $this->viewHelper->render(-321,
'custom suffix');
73 $this->assertEquals(
'Cropped Content', $actualResult);
81 $this->mockContentObject->expects($this->once())->method(
'cropHTML')->with(
'Some Content',
'123|...|')->will($this->returnValue(
'Cropped Content'));
83 $actualResult = $this->viewHelper->render(123,
'...',
false);
84 $this->assertEquals(
'Cropped Content', $actualResult);
92 $this->mockContentObject->expects($this->once())->method(
'crop')->with(
'Some Content',
'123|...|1')->will($this->returnValue(
'Cropped Content'));
94 $actualResult = $this->viewHelper->render(123,
'...',
true,
false);
95 $this->assertEquals(
'Cropped Content', $actualResult);