Index: tests/t3lib/t3lib_divTest.php =================================================================== --- tests/t3lib/t3lib_divTest.php (revision 8141) +++ tests/t3lib/t3lib_divTest.php (working copy) @@ -643,6 +643,45 @@ $this->assertTrue(t3lib_div::isOnCurrentHost($testUrl)); } + //////////////////////////////////////////// + // Tests concerning t3lib_div::getIndpEnv + //////////////////////////////////////////// + + /** + * Data provider for checkEqualityTypo3HostOnlyWithRefererHostEvenUnderInternetProtocolVersion6AddressAsHttpHost + * + * @return array Data sets + */ + public static function checkEqualityTypo3HostAndPortDataProvider() { + return array( + 'localhost ipv4 without port' => array('127.0.0.1','127.0.0.1',''), + 'localhost ipv4 with port' => array('127.0.0.1:81','127.0.0.1','81'), + 'localhost ipv6 without port' => array('[::1]','[::1]',''), + 'localhost ipv6 with port' => array('[::1]:81','[::1]','81'), + 'ipv6 without port' => array('[2001:DB8::1]','[2001:DB8::1]',''), + 'ipv6 with port' => array('[2001:DB8::1]:81','[2001:DB8::1]','81'), + ); + } + + /** + * @test + * @dataProvider checkEqualityTypo3HostAndPortDataProvider + * @see t3lib_div::getIndpEnv() + */ + public function checkEqualityTypo3HostOnlyWithRefererHostEvenUnderInternetProtocolVersion6AddressAsHttpHost($http_host, $expectedIp, $expectedPort) { + $_SERVER['HTTP_HOST'] = $http_host; + $this->assertEquals($expectedIp, t3lib_div::getIndpEnv('TYPO3_HOST_ONLY')); + } + /** + * @test + * @dataProvider checkEqualityTypo3HostAndPortDataProvider + * @see t3lib_div::getIndpEnv() + */ + public function checkEqualityTypo3PortIsProperlyRecognizedWhenUsingInternetProtocolVersion6AddressAsHttpHost ($http_host, $expectedIp, $expectedPort) { + $_SERVER['HTTP_HOST'] = $http_host; + $this->assertEquals($expectedPort, t3lib_div::getIndpEnv('TYPO3_PORT')); + } + //////////////////////////////////////// // Tests concerning sanitizeLocalUrl