Bug #23488 ยป 15615.diff
tests/t3lib/t3lib_pagerendererTest.php (working copy) | ||
---|---|---|
* @author Steffen Kamper (info@sk-typo3.de)
|
||
*/
|
||
class t3lib_PageRendererTest extends tx_phpunit_testcase {
|
||
/**
|
||
* Enable backup of global and system variables
|
||
*
|
||
* @var boolean
|
||
*/
|
||
protected $backupGlobals = TRUE;
|
||
/**
|
||
* Exclude TYPO3_DB from backup/ restore of $GLOBALS
|
||
* because resource types cannot be handled during serializing
|
||
*
|
||
* @var array
|
||
*/
|
||
protected $backupGlobalsBlacklist = array('TYPO3_DB');
|
||
/**
|
||
* @var t3lib_PageRenderer
|
||
*/
|
||
... | ... | |
*
|
||
* @test
|
||
*/
|
||
public function isScriptaculousLoadedCompressed() {
|
||
public function isScriptaculousLoadedCompressedIfConfiguredAndClientIsCapable() {
|
||
$_SERVER['HTTP_ACCEPT_ENCODING'] = 'gzip,deflate';
|
||
$GLOBALS['TYPO3_CONF_VARS']['BE']['compressionLevel'] = '5';
|
||
$this->fixture->loadScriptaculous('slider,controls');
|
||
$this->fixture->enableCompressJavascript();
|
||
$out = $this->fixture->render();
|
||
$this->assertRegExp(
|
||
'#<script src="[^"]*/typo3temp/compressor/scriptaculous-[a-f0-9]+.js.gzip" type="text/javascript"></script>#',
|
||
$out
|
||
);
|
||
$this->assertRegExp(
|
||
'#<script src="[^"]*/typo3temp/compressor/effects-[a-f0-9]+.js.gzip" type="text/javascript"></script>#',
|
||
$out
|
||
);
|
||
$this->assertRegExp(
|
||
'#<script src="[^"]*/typo3temp/compressor/controls-[a-f0-9]+.js.gzip" type="text/javascript"></script>#',
|
||
$out
|
||
);
|
||
$this->assertRegExp(
|
||
'#<script src="[^"]*/typo3temp/compressor/slider-[a-f0-9]+.js.gzip" type="text/javascript"></script>#',
|
||
$out
|
||
);
|
||
}
|
||
/**
|
||
* Tests whether scriptaculous is correctly loaded, but without compression
|
||
* if the browser did not send the appropriate headers.
|
||
*
|
||
* @test
|
||
*/
|
||
public function isScriptaculousNotLoadedCompressedIfClientCannotHandleCompression() {
|
||
$_SERVER['HTTP_ACCEPT_ENCODING'] = '';
|
||
$GLOBALS['TYPO3_CONF_VARS']['BE']['compressionLevel'] = '5';
|
||
$this->fixture->loadScriptaculous('slider,controls');
|
||
$this->fixture->enableCompressJavascript();
|
||
$out = $this->fixture->render();
|
||
$this->assertRegExp(
|
||
'#<script src="[^"]*/typo3temp/compressor/scriptaculous-[a-f0-9]+.js" type="text/javascript"></script>#',
|
||
$out
|
||
);
|
||
$this->assertRegExp(
|
||
'#<script src="[^"]*/typo3temp/compressor/effects-[a-f0-9]+.js" type="text/javascript"></script>#',
|
||
$out
|
||
);
|
||
$this->assertRegExp(
|
||
'#<script src="[^"]*/typo3temp/compressor/controls-[a-f0-9]+.js" type="text/javascript"></script>#',
|
||
$out
|
||
);
|
||
$this->assertRegExp(
|
||
'#<script src="[^"]*/typo3temp/compressor/slider-[a-f0-9]+.js" type="text/javascript"></script>#',
|
||
$out
|
||
);
|
||
}
|
||
/**
|
||
* Tests whether scriptaculous is correctly loaded, but without compression
|
||
* if no compression is configured.
|
||
*
|
||
* @test
|
||
*/
|
||
public function isScriptaculousNotLoadedCompressedIfCompressionIsNotConfigured() {
|
||
$_SERVER['HTTP_ACCEPT_ENCODING'] = 'gzip,deflate';
|
||
$GLOBALS['TYPO3_CONF_VARS']['BE']['compressionLevel'] = '';
|
||
$this->fixture->loadScriptaculous('slider,controls');
|
||
$this->fixture->enableCompressJavascript();
|
||
$out = $this->fixture->render();
|