コード例 #1
0
 /**
  * @test
  */
 public function renderReturnsResultOfContentObjectRenderer()
 {
     $this->subject->expects($this->any())->method('renderChildren')->will($this->returnValue('innerContent'));
     $contentObjectRendererMock = $this->getMock(ContentObjectRenderer::class, array(), array(), '', false);
     $contentObjectRendererMock->expects($this->once())->method('stdWrap')->will($this->returnValue('foo'));
     GeneralUtility::addInstance(ContentObjectRenderer::class, $contentObjectRendererMock);
     $this->assertEquals('foo', $this->subject->render('42'));
 }
コード例 #2
0
 /**
  * @test
  */
 public function renderCallsStandardWrapOnResultStringIfGivenInConfiguration()
 {
     $this->addMockViewToSubject();
     $configuration = array('stdWrap.' => array('foo' => 'bar'));
     $this->standaloneView->expects($this->any())->method('render')->will($this->returnValue('baz'));
     $this->contentObjectRenderer->expects($this->once())->method('stdWrap')->with('baz', array('foo' => 'bar'));
     $this->subject->render($configuration);
 }
 /**
  * @return void
  */
 public function testWithDataAndSourceCollection()
 {
     $this->file->expects($this->at(1))->method('process')->will($this->returnValue($this->processedFiles[1]));
     $this->file->expects($this->at(2))->method('process')->will($this->returnValue($this->processedFiles[2]));
     $this->file->expects($this->at(3))->method('process')->will($this->returnValue($this->processedFiles[0]));
     $this->imageRendererConfiguration->expects($this->once())->method('getSourceCollection')->will($this->returnValue([10 => ['width' => '360m', 'dataKey' => 'small'], 20 => ['width' => '720m', 'dataKey' => 'small-retina']]));
     $this->imageRendererConfiguration->expects($this->once())->method('getLayoutKey')->will($this->returnValue('data'));
     $this->assertEquals('<img src="image.jpg" alt="alt" title="title" data-small="image360.jpg" data-small-retina="image720.jpg" />', $this->imageRenderer->render($this->file, '1000', '1000', []));
 }
コード例 #4
0
 /**
  * @dataProvider dateViewHelperFormatsDateLocalizedDataProvider
  *
  * @test
  */
 public function dateViewHelperFormatsDateLocalized($locale, $expected)
 {
     $format = '%d. %B %Y';
     // 2013-02-03 11:40 UTC
     $timestamp = '@1359891658';
     if (!setlocale(LC_COLLATE, $locale)) {
         $this->markTestSkipped('Locale ' . $locale . ' is not available.');
     }
     $this->setCustomLocale($locale);
     $this->assertEquals($expected, $this->subject->render($timestamp, $format));
 }
コード例 #5
0
	/**
	 * @test
	 * @expectedException \LogicException
	 * @expectedExceptionCode 1414513947
	 */
	public function specificExceptionsCanBeIgnoredByExceptionHandler() {
		$contentObjectFixture = $this->createContentObjectThrowingExceptionFixture();

		$configuration = array(
			'exceptionHandler' => '1',
			'exceptionHandler.' => array(
				'ignoreCodes.' => array('10.' => '1414513947'),
			)
		);

		$this->subject->render($contentObjectFixture, $configuration);
	}
コード例 #6
0
 /**
  * @test
  * @expectedException \TYPO3\CMS\Fluid\View\Exception\InvalidTemplateResourceException
  */
 public function renderThrowsExceptionIfSpecifiedTemplateFileDoesNotExist()
 {
     $this->view->setTemplatePathAndFilename('NonExistingTemplatePath');
     @$this->view->render();
 }
コード例 #7
0
 /**
  * @test
  */
 public function renderCallsSetErrorClassAttribute()
 {
     $this->viewHelper->expects($this->once())->method('setErrorClassAttribute');
     $this->viewHelper->render();
 }