31 $this->fixture = $this->
getAccessibleMock(
'\\TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController', array(
'dummy'), array(),
'', FALSE);
32 $this->fixture->TYPO3_CONF_VARS =
$GLOBALS[
'TYPO3_CONF_VARS'];
33 $this->fixture->TYPO3_CONF_VARS[
'SYS'][
'encryptionKey'] =
'170928423746123078941623042360abceb12341234231';
35 $pageRepository = $this->getMock(
'TYPO3\\CMS\\Frontend\\Page\\PageRepository');
36 $this->fixture->sys_page = $pageRepository;
46 $GLOBALS[
'TSFE'] = $this->setupTsfeMockForHeaderFooterReplacementCheck();
48 $this->assertContains(
'headerData',
$GLOBALS[
'TSFE']->content);
49 $this->assertContains(
'footerData',
$GLOBALS[
'TSFE']->content);
56 $GLOBALS[
'TSFE']->additionalHeaderData[] =
'headerData';
57 $GLOBALS[
'TSFE']->additionalFooterData[] =
'footerData';
66 protected function setupTsfeMockForHeaderFooterReplacementCheck() {
68 $tsfe = $this->getMock(
'TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController', array(
69 'INTincScript_process',
70 'INTincScript_includeLibs',
71 'INTincScript_loadJSCode',
74 ), array(),
'', FALSE);
75 $tsfe->expects($this->exactly(2))->method(
'INTincScript_process')->will($this->returnCallback(array($this,
'INTincScript_processCallback')));
76 $tsfe->content = file_get_contents(__DIR__ .
'/Fixtures/renderedPage.html');
77 $tsfe->config[
'INTincScript_ext'][
'divKey'] =
'679b52796e75d474ccbbed486b6837ab';
78 $tsfe->config[
'INTincScript'] = array(
'INT_SCRIPT.679b52796e75d474ccbbed486b6837ab' => array());
79 $GLOBALS[
'TT'] = new \TYPO3\CMS\Core\TimeTracker\NullTimeTracker();
90 $this->assertRegExp(
'/^[0-9a-f]{10}:[a-zA-Z0-9+=\\/]+$/', $this->fixture->codeString(
'Hello world!'));
97 $clearText =
'Hello world!';
98 $this->assertEquals($clearText, $this->fixture->codeString($this->fixture->codeString($clearText), TRUE));
109 $this->assertEquals($string, $this->fixture->sL($string));
119 $clearText =
'Hello world!';
120 $this->assertEquals(strlen($clearText), strlen($this->fixture->_callRef(
'roundTripCryptString', $clearText)));
127 $clearText =
'Hello world!';
128 $this->assertNotEquals($clearText, $this->fixture->_callRef(
'roundTripCryptString', $clearText));
135 $clearText =
'Hello world!';
136 $refValue = $this->fixture->_callRef(
'roundTripCryptString', $clearText);
137 $this->assertEquals($clearText, $this->fixture->_callRef(
'roundTripCryptString', $refValue));
149 'typo3.org' => array(
155 'example.com' => array(
167 $_SERVER[
'HTTP_HOST'] = $currentDomain;
168 $domainRecords = array(
169 'typo3.org' => array(
171 'domainName' =>
'typo3.org',
176 'domainName' =>
'foo.bar',
179 'example.com' => array(
181 'domainName' =>
'example.com',
185 $GLOBALS[
'TYPO3_DB'] = $this->getMock(
'TYPO3\\CMS\\Core\\Database\\DatabaseConnection', array(
'exec_SELECTgetRows'));
186 $GLOBALS[
'TYPO3_DB']->expects($this->any())->method(
'exec_SELECTgetRows')->willReturn($domainRecords);
188 $expectedResult = array(
189 $domainRecords[$currentDomain][
'pid'] => $domainRecords[$currentDomain],
191 $this->assertEquals($expectedResult, $this->fixture->_call(
'getSysDomainCache'));
200 $_SERVER[
'HTTP_HOST'] = $currentDomain;
201 $domainRecords = array(
202 'typo3.org' => array(
204 'domainName' =>
'typo3.org',
209 'domainName' =>
'foo.bar',
212 'example.com' => array(
214 'domainName' =>
'example.com',
218 $GLOBALS[
'TYPO3_DB'] = $this->getMock(
'TYPO3\\CMS\\Core\\Database\\DatabaseConnection', array(
'exec_SELECTgetRows'));
219 $GLOBALS[
'TYPO3_DB']->expects($this->any())->method(
'exec_SELECTgetRows')->willReturn($domainRecords);
221 $expectedResult = array(
222 $domainRecords[$currentDomain][
'pid'] => $domainRecords[
'foo.bar'],
224 $this->assertEquals($expectedResult, $this->fixture->_call(
'getSysDomainCache'));
236 'same domains' => array(
242 'same domains with subdomain' => array(
248 'different domains' => array(
254 'domain record with script name' => array(
257 '/foo/bar/index.php',
260 'domain record with wrong script name' => array(
263 '/bar/foo/index.php',
278 $_SERVER[
'HTTP_HOST'] = $currentDomain;
279 $_SERVER[
'SCRIPT_NAME'] = $scriptName;
280 $this->assertEquals($expectedResult, $this->fixture->domainNameMatchesCurrentRequest($domainRecord));
headerAndFooterMarkersAreReplacedDuringIntProcessing()
getSysDomainCacheDataProvider()
INTincScript_processCallback()
domainNameMatchesCurrentRequestDataProvider()
codeStringForNonEmptyStringReturns10CharacterHashAndCodedString()
static makeInstance($className)
getSysDomainCacheReturnsCurrentDomainRecord($currentDomain)
roundTripCryptStringCreatesResultDifferentFromInputString()
localizationReturnsUnchangedStringIfNotLocallangLabel()
getAccessibleMock( $originalClassName, array $methods=array(), array $arguments=array(), $mockClassName='', $callOriginalConstructor=TRUE, $callOriginalClone=TRUE, $callAutoload=TRUE)
roundTripCryptStringCreatesStringWithSameLengthAsInputString()
roundTripCryptStringAppliedTwoTimesReturnsOriginalString()
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]
domainNameMatchesCurrentRequest($currentDomain, $domainRecord, $scriptName, $expectedResult)
decodingCodedStringReturnsOriginalString()
getSysDomainCacheReturnsForcedDomainRecord($currentDomain)