/** * @test * @dataProvider prefixIsCorrectlyAppliedToGetImageUriDataProvider */ public function prefixIsCorrectlyAppliedToGetImageUri($imageUri, $expected) { $this->environmentService->expects($this->any())->method('isEnvironmentInFrontendMode')->willReturn(TRUE); $GLOBALS['TSFE'] = new \stdClass(); $GLOBALS['TSFE']->absRefPrefix = '/prefix/'; $file = $this->getMock('TYPO3\\CMS\\Core\\Resource\\File', array(), array(), '', FALSE); $file->expects($this->once())->method('getPublicUrl')->willReturn($imageUri); $this->assertSame($expected, $this->subject->getImageUri($file)); }
/** * @return void */ protected function injectDependencies() { $this->mockConfigurationManager->expects($this->any())->method('getConfiguration')->will($this->returnValue($this->configuration)); $this->requestBuilder->_set('configurationManager', $this->mockConfigurationManager); $this->mockObjectManager->expects($this->any())->method('get')->with(\TYPO3\CMS\Extbase\Mvc\Web\Request::class)->will($this->returnValue($this->mockRequest)); $this->requestBuilder->_set('objectManager', $this->mockObjectManager); $pluginNamespace = 'tx_' . strtolower($this->configuration['extensionName'] . '_' . $this->configuration['pluginName']); $this->mockExtensionService->expects($this->any())->method('getPluginNamespace')->will($this->returnValue($pluginNamespace)); $this->requestBuilder->_set('extensionService', $this->mockExtensionService); $this->mockEnvironmentService->expects($this->any())->method('getServerRequestMethod')->will($this->returnValue('GET')); $this->requestBuilder->_set('environmentService', $this->mockEnvironmentService); }
/** * @test * @dataProvider prefixIsCorrectlyAppliedToGetImageUriWithAbsolutePathDataProvider */ public function prefixIsCorrectlyAppliedToGetImageUriWithForcedAbsoluteUrl($imageUri, $expected) { $this->environmentService->expects($this->any())->method('isEnvironmentInFrontendMode')->willReturn(true); $GLOBALS['TSFE'] = new \stdClass(); $GLOBALS['TSFE']->absRefPrefix = '/prefix/'; $file = $this->getMock(File::class, array(), array(), '', false); $file->expects($this->once())->method('getPublicUrl')->willReturn($imageUri); $this->assertSame($expected, $this->subject->getImageUri($file, true)); }