mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-08 11:11:39 +09:00
exclude FrontEndFileHandlerTest.php
git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@9877 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
b09862088a
commit
39fd65dc7e
4 changed files with 31 additions and 22 deletions
|
|
@ -5,6 +5,7 @@ if(!defined('__XE__')) define('__XE__', true);
|
|||
if(!defined('__ZBXE__')) define('__ZBXE__', true);
|
||||
if(!defined('_XE_PATH_')) define('_XE_PATH_', realpath(dirname(__FILE__).'/../').'/');
|
||||
|
||||
$_SERVER['SCRIPT_NAME'] = '/xe/index.php';
|
||||
error_reporting(E_ALL & ~E_NOTICE);
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -8,28 +8,30 @@ if(!defined('MOCK_CONTEXT')) define('MOCK_CONTEXT', 1);
|
|||
class Context
|
||||
{
|
||||
public static $mock_vars = array();
|
||||
private static $useCdn = 'N';
|
||||
private static $requestUrl = 'http://www.test.com';
|
||||
|
||||
public function gets() {
|
||||
$args = func_get_args();
|
||||
$output = new stdClass;
|
||||
|
||||
foreach($args as $name) {
|
||||
$output->{$name} = Context::$mock_vars[$name];
|
||||
$output->{$name} = self::$mock_vars[$name];
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
public function get($name) {
|
||||
return array_key_exists($name, Context::$mock_vars)?Context::$mock_vars[$name]:'';
|
||||
return array_key_exists($name, self::$mock_vars)?self::$mock_vars[$name]:'';
|
||||
}
|
||||
|
||||
public function getRequestVars() {
|
||||
return Context::$mock_vars;
|
||||
return self::$mock_vars;
|
||||
}
|
||||
|
||||
public function set($name, $value) {
|
||||
Context::$mock_vars[$name] = $value;
|
||||
self::$mock_vars[$name] = $value;
|
||||
}
|
||||
|
||||
public function getLangType() {
|
||||
|
|
@ -41,21 +43,29 @@ class Context
|
|||
}
|
||||
|
||||
public function truncate() {
|
||||
Context::$mock_vars = array();
|
||||
self::$mock_vars = array();
|
||||
}
|
||||
|
||||
public function getDBInfo() {
|
||||
global $use_cdn;
|
||||
public static function setUseCdn($useCdn)
|
||||
{
|
||||
self::$useCdn = $useCdn != 'Y' ? 'N':'Y';
|
||||
}
|
||||
|
||||
$dbInfo = new stdClass;
|
||||
$dbInfo->use_cdn = $use_cdn;
|
||||
public static function getDBInfo() {
|
||||
$dbInfo = new stdClass();
|
||||
$dbInfo->use_cdn = self::$useCdn;
|
||||
|
||||
return $dbInfo;
|
||||
}
|
||||
|
||||
public function getRequestUrl() {
|
||||
global $request_url;
|
||||
return $request_url;
|
||||
|
||||
public static function setRequestUrl($url)
|
||||
{
|
||||
self::$requestUrl= $url;
|
||||
}
|
||||
|
||||
public static function getRequestUrl() {
|
||||
return self::$requestUrl;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,16 +5,13 @@ if(!defined('__XE__')) require dirname(__FILE__).'/../../Bootstrap.php';
|
|||
require_once _XE_PATH_.'classes/handler/Handler.class.php';
|
||||
require_once _XE_PATH_.'classes/frontendfile/FrontEndFileHandler.class.php';
|
||||
|
||||
$_SERVER['SCRIPT_NAME'] = '/xe/index.php';
|
||||
|
||||
class FrontEndFileHandlerTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testHandler()
|
||||
{
|
||||
global $request_url, $use_cdn;
|
||||
|
||||
$request_url = 'http://test.com';
|
||||
$use_cdn = 'Y';
|
||||
Context::setUseCdn('Y');
|
||||
Context::setRequestUrl('http://test.com');
|
||||
|
||||
$handler = new FrontEndFileHandler();
|
||||
|
||||
|
|
@ -176,7 +173,7 @@ class FrontEndFileHandlerTest extends PHPUnit_Framework_TestCase
|
|||
// CDN(no cdn setting)
|
||||
unset($handler);
|
||||
unset($expected);
|
||||
$use_cdn = 'N';
|
||||
Context::setUseCdn('N');
|
||||
$handler = new FrontEndFileHandler();
|
||||
|
||||
$handler->loadFile(array('./common/css/common.css'), true, 'http://static.xpressengine.com/core/', 'v');
|
||||
|
|
@ -187,8 +184,8 @@ class FrontEndFileHandlerTest extends PHPUnit_Framework_TestCase
|
|||
// CDN(use ssl)
|
||||
unset($handler);
|
||||
unset($expected);
|
||||
$use_cdn = 'Y';
|
||||
$request_url = 'https://test.com';
|
||||
Context::setUseCdn('Y');
|
||||
Context::setRequestUrl('https://test.com');
|
||||
$handler = new FrontEndFileHandler();
|
||||
|
||||
$handler->loadFile(array('./common/css/common.css'), true, 'http://static.xpressengine.com/core/', 'v');
|
||||
|
|
@ -199,8 +196,8 @@ class FrontEndFileHandlerTest extends PHPUnit_Framework_TestCase
|
|||
// external file
|
||||
unset($handler);
|
||||
unset($expected);
|
||||
$use_cdn = 'Y';
|
||||
$request_url = 'http://test.com';
|
||||
Context::setUseCdn('Y');
|
||||
Context::setRequestUrl('http://test.com');
|
||||
$handler = new FrontEndFileHandler();
|
||||
|
||||
$handler->loadFile(array('http://external.com/css/style2.css'));
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
<directory>.</directory>
|
||||
<exclude>./classes/context/Context.mock.php</exclude>
|
||||
<exclude>./classes/db/</exclude>
|
||||
<exclude>./classes/frontendfile/FrontEndFileHandlerTest.php</exclude>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<logging>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue