46 $this->mockContentObject = $this->getMock(
'TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer', array(), array(),
'', FALSE);
47 $this->mockConfigurationManager = $this->getMock(
'TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManagerInterface');
48 $this->mockConfigurationManager->expects($this->any())->method(
'getContentObject')->will($this->returnValue($this->mockContentObject));
49 $this->viewHelper = $this->getMock(
'TYPO3\\CMS\\Fluid\\ViewHelpers\\Format\\CropViewHelper', array(
'renderChildren'));
50 $this->viewHelper->injectConfigurationManager($this->mockConfigurationManager);
51 $this->viewHelper->expects($this->once())->method(
'renderChildren')->will($this->returnValue(
'Some Content'));
58 $this->mockContentObject->expects($this->once())->method(
'cropHTML')->with(
'Some Content',
'123|...|1')->will($this->returnValue(
'Cropped Content'));
59 $actualResult = $this->viewHelper->render(123);
60 $this->assertEquals(
'Cropped Content', $actualResult);
67 $this->mockContentObject->expects($this->once())->method(
'cropHTML')->with(
'Some Content',
'-321|custom suffix|1')->will($this->returnValue(
'Cropped Content'));
68 $actualResult = $this->viewHelper->render(-321,
'custom suffix');
69 $this->assertEquals(
'Cropped Content', $actualResult);
76 $this->mockContentObject->expects($this->once())->method(
'cropHTML')->with(
'Some Content',
'123|...|')->will($this->returnValue(
'Cropped Content'));
77 $actualResult = $this->viewHelper->render(123,
'...', FALSE);
78 $this->assertEquals(
'Cropped Content', $actualResult);
85 $this->mockContentObject->expects($this->once())->method(
'crop')->with(
'Some Content',
'123|...|1')->will($this->returnValue(
'Cropped Content'));
86 $actualResult = $this->viewHelper->render(123,
'...', TRUE, FALSE);
87 $this->assertEquals(
'Cropped Content', $actualResult);