2 namespace TYPO3\CMS\Frontend\Tests\Unit\Controller;
36 $this->subject = $this->getAccessibleMock(TypoScriptFrontendController::class, array(
'dummy'), array(),
'',
false);
37 $this->subject->TYPO3_CONF_VARS =
$GLOBALS[
'TYPO3_CONF_VARS'];
38 $this->subject->TYPO3_CONF_VARS[
'SYS'][
'encryptionKey'] =
'170928423746123078941623042360abceb12341234231';
40 $pageRepository = $this->getMock(PageRepository::class);
41 $this->subject->sys_page = $pageRepository;
53 $GLOBALS[
'TSFE'] = $this->setupTsfeMockForHeaderFooterReplacementCheck();
55 $this->assertContains(
'headerData',
$GLOBALS[
'TSFE']->content);
56 $this->assertContains(
'footerData',
$GLOBALS[
'TSFE']->content);
64 $GLOBALS[
'TSFE']->additionalHeaderData[] =
'headerData';
65 $GLOBALS[
'TSFE']->additionalFooterData[] =
'footerData';
74 protected function setupTsfeMockForHeaderFooterReplacementCheck()
77 $tsfe = $this->getMock(TypoScriptFrontendController::class, array(
78 'INTincScript_process',
79 'INTincScript_includeLibs',
80 'INTincScript_loadJSCode',
83 ), array(),
'',
false);
84 $tsfe->expects($this->exactly(2))->method(
'INTincScript_process')->will($this->returnCallback(array($this,
'INTincScript_processCallback')));
85 $tsfe->content = file_get_contents(__DIR__ .
'/Fixtures/renderedPage.html');
86 $tsfe->config[
'INTincScript_ext'][
'divKey'] =
'679b52796e75d474ccbbed486b6837ab';
87 $tsfe->config[
'INTincScript'] = array(
'INT_SCRIPT.679b52796e75d474ccbbed486b6837ab' => array());
88 $GLOBALS[
'TT'] = new \TYPO3\CMS\Core\TimeTracker\NullTimeTracker();
101 $string = $this->getUniqueId();
102 $this->assertEquals($string, $this->subject->sL($string));
115 'typo3.org' => array(
121 'example.com' => array(
134 $_SERVER[
'HTTP_HOST'] = $currentDomain;
135 $domainRecords = array(
136 'typo3.org' => array(
139 'domainName' =>
'typo3.org',
145 'domainName' =>
'foo.bar',
148 'example.com' => array(
151 'domainName' =>
'example.com',
155 $GLOBALS[
'TYPO3_DB'] = $this->getMock(DatabaseConnection::class, array(
'exec_SELECTgetRows'));
156 $GLOBALS[
'TYPO3_DB']->expects($this->any())->method(
'exec_SELECTgetRows')->willReturn($domainRecords);
158 $expectedResult = array(
159 $domainRecords[$currentDomain][
'pid'] => $domainRecords[$currentDomain],
161 $this->assertEquals($expectedResult, $this->subject->_call(
'getSysDomainCache'));
171 $_SERVER[
'HTTP_HOST'] = $currentDomain;
172 $domainRecords = array(
173 'typo3.org' => array(
176 'domainName' =>
'typo3.org',
182 'domainName' =>
'foo.bar',
185 'example.com' => array(
188 'domainName' =>
'example.com',
192 $GLOBALS[
'TYPO3_DB'] = $this->getMock(DatabaseConnection::class, array(
'exec_SELECTgetRows'));
193 $GLOBALS[
'TYPO3_DB']->expects($this->any())->method(
'exec_SELECTgetRows')->willReturn($domainRecords);
195 $expectedResult = array(
196 $domainRecords[$currentDomain][
'pid'] => $domainRecords[
'foo.bar'],
198 $this->assertEquals($expectedResult, $this->subject->_call(
'getSysDomainCache'));
211 'same domains' => array(
217 'same domains with subdomain' => array(
223 'different domains' => array(
229 'domain record with script name' => array(
232 '/foo/bar/index.php',
235 'domain record with wrong script name' => array(
238 '/bar/foo/index.php',
254 $_SERVER[
'HTTP_HOST'] = $currentDomain;
255 $_SERVER[
'SCRIPT_NAME'] = $scriptName;
256 $this->assertEquals($expectedResult, $this->subject->domainNameMatchesCurrentRequest($domainRecord));