mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-14 00:39:57 +09:00
All classes can be tested from now.
1) Add some test files. 2) Create a folder for fronendfile. Move the class file into the folder. 3) Write Bootstrap.php file. 4) Modify phpunit.xml file. 5) Add a context mock class. git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@9850 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
aa90148aa3
commit
67751eb85b
8 changed files with 148 additions and 135 deletions
62
tests/classes/context/Context.mock.php
Normal file
62
tests/classes/context/Context.mock.php
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
<?php
|
||||
|
||||
if(!defined('FOLLOW_REQUEST_SSL')) define('FOLLOW_REQUEST_SSL',0);
|
||||
if(!defined('ENFORCE_SSL')) define('ENFORCE_SSL',1);
|
||||
if(!defined('RELEASE_SSL')) define('RELEASE_SSL',2);
|
||||
|
||||
class Context
|
||||
{
|
||||
public static $mock_vars = array();
|
||||
|
||||
public function gets() {
|
||||
$args = func_get_args();
|
||||
$output = new stdClass;
|
||||
|
||||
foreach($args as $name) {
|
||||
$output->{$name} = Context::$mock_vars[$name];
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
public function get($name) {
|
||||
return array_key_exists($name, Context::$mock_vars)?Context::$mock_vars[$name]:'';
|
||||
}
|
||||
|
||||
public function getRequestVars() {
|
||||
return Context::$mock_vars;
|
||||
}
|
||||
|
||||
public function set($name, $value) {
|
||||
Context::$mock_vars[$name] = $value;
|
||||
}
|
||||
|
||||
public function getLangType() {
|
||||
return 'en';
|
||||
}
|
||||
|
||||
public function getLang($str) {
|
||||
return $str;
|
||||
}
|
||||
|
||||
public function truncate() {
|
||||
Context::$mock_vars = array();
|
||||
}
|
||||
|
||||
public function getDBInfo() {
|
||||
global $use_cdn;
|
||||
|
||||
$dbInfo = new stdClass;
|
||||
$dbInfo->use_cdn = $use_cdn;
|
||||
|
||||
return $dbInfo;
|
||||
}
|
||||
|
||||
public function getRequestUrl() {
|
||||
global $request_url;
|
||||
return $request_url;
|
||||
}
|
||||
}
|
||||
|
||||
/* End of file Context.mock.php */
|
||||
/* Location: ./tests/classes/context/Context.mock.php */
|
||||
Loading…
Add table
Add a link
Reference in a new issue