Пример #1
0
 /**
  * Sets up this test case.
  */
 protected function setUp()
 {
     $this->fileResourceMock = $this->getMock('TYPO3\\CMS\\Core\\Resource\\File', array('toArray', 'getModificationTime', 'getExtension'), array(), '', FALSE);
     $this->folderResourceMock = $this->getMock('TYPO3\\CMS\\Core\\Resource\\Folder', array('getIdentifier'), array(), '', FALSE);
     $this->mockFileProcessor = $this->getMock('TYPO3\\CMS\\Core\\Utility\\File\\ExtendedFileUtility', array('getErrorMessages'), array(), '', FALSE);
     $this->fileResourceMock->expects($this->any())->method('toArray')->will($this->returnValue(array('id' => 'foo')));
     $this->fileResourceMock->expects($this->any())->method('getModificationTime')->will($this->returnValue(123456789));
     $this->fileResourceMock->expects($this->any())->method('getExtension')->will($this->returnValue('html'));
 }
Пример #2
0
 /**
  * Sets up this test case.
  */
 protected function setUp()
 {
     $this->fileResourceMock = $this->getMock(\TYPO3\CMS\Core\Resource\File::class, array('toArray', 'getModificationTime', 'getExtension'), array(), '', false);
     $this->folderResourceMock = $this->getMock(\TYPO3\CMS\Core\Resource\Folder::class, array('getIdentifier'), array(), '', false);
     $this->mockFileProcessor = $this->getMock(\TYPO3\CMS\Core\Utility\File\ExtendedFileUtility::class, array('getErrorMessages'), array(), '', false);
     $this->fileResourceMock->expects($this->any())->method('toArray')->will($this->returnValue(array('id' => 'foo')));
     $this->fileResourceMock->expects($this->any())->method('getModificationTime')->will($this->returnValue(123456789));
     $this->fileResourceMock->expects($this->any())->method('getExtension')->will($this->returnValue('html'));
     $this->request = new ServerRequest();
     $this->response = new Response();
 }
 /**
  * @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', []));
 }