mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Fixed the tests of MediaView in console/web.
This commit is contained in:
parent
ab9b7f44dc
commit
84538ac10a
1 changed files with 12 additions and 6 deletions
|
@ -117,7 +117,7 @@ class MediaViewTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
function testRenderWithUnknownFileTypeGeneric() {
|
||||
$currentUserAgent = $_SERVER['HTTP_USER_AGENT'];
|
||||
$currentUserAgent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : null;
|
||||
$_SERVER['HTTP_USER_AGENT'] = 'Some generic browser';
|
||||
$this->MediaView->viewVars = array(
|
||||
'path' => LIBS . 'tests' . DS . 'test_app' . DS . 'config' . DS,
|
||||
|
@ -165,7 +165,9 @@ class MediaViewTest extends CakeTestCase {
|
|||
$output = ob_get_clean();
|
||||
$this->assertEqual("some_key = some_value\nbool_key = 1\n", $output);
|
||||
$this->assertTrue($result !== false);
|
||||
$_SERVER['HTTP_USER_AGENT'] = $currentUserAgent;
|
||||
if ($currentUserAgent !== null) {
|
||||
$_SERVER['HTTP_USER_AGENT'] = $currentUserAgent;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -175,7 +177,7 @@ class MediaViewTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
function testRenderWithUnknownFileTypeOpera() {
|
||||
$currentUserAgent = $_SERVER['HTTP_USER_AGENT'];
|
||||
$currentUserAgent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : null;
|
||||
$_SERVER['HTTP_USER_AGENT'] = 'Opera/9.80 (Windows NT 6.0; U; en) Presto/2.8.99 Version/11.10';
|
||||
$this->MediaView->viewVars = array(
|
||||
'path' => LIBS . 'tests' . DS . 'test_app' . DS . 'config' . DS,
|
||||
|
@ -228,7 +230,9 @@ class MediaViewTest extends CakeTestCase {
|
|||
$output = ob_get_clean();
|
||||
$this->assertEqual("some_key = some_value\nbool_key = 1\n", $output);
|
||||
$this->assertTrue($result !== false);
|
||||
$_SERVER['HTTP_USER_AGENT'] = $currentUserAgent;
|
||||
if ($currentUserAgent !== null) {
|
||||
$_SERVER['HTTP_USER_AGENT'] = $currentUserAgent;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -238,7 +242,7 @@ class MediaViewTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
function testRenderWithUnknownFileTypeIE() {
|
||||
$currentUserAgent = $_SERVER['HTTP_USER_AGENT'];
|
||||
$currentUserAgent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : null;
|
||||
$_SERVER['HTTP_USER_AGENT'] = 'Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 5.2; Trident/4.0; Media Center PC 4.0; SLCC1; .NET CLR 3.0.04320)';
|
||||
$this->MediaView->viewVars = array(
|
||||
'path' => LIBS . 'tests' . DS . 'test_app' . DS . 'config' . DS,
|
||||
|
@ -291,7 +295,9 @@ class MediaViewTest extends CakeTestCase {
|
|||
$output = ob_get_clean();
|
||||
$this->assertEqual("some_key = some_value\nbool_key = 1\n", $output);
|
||||
$this->assertTrue($result !== false);
|
||||
$_SERVER['HTTP_USER_AGENT'] = $currentUserAgent;
|
||||
if ($currentUserAgent !== null) {
|
||||
$_SERVER['HTTP_USER_AGENT'] = $currentUserAgent;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue