修正命名空间、版权注释

This commit is contained in:
7IN0SAN9
2016-01-20 11:14:19 +08:00
parent 6120be3671
commit cc530a98a3
15 changed files with 215 additions and 156 deletions

View File

@@ -6,14 +6,19 @@
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 大漠 <zhylninc@gmail.com>
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
namespace think;
/**
* Generated by PHPUnit_SkeletonGenerator on 2016-01-15 at 07:00:38.
* Debug测试
* @author 大漠 <zhylninc@gmail.com>
*/
class DebugTest extends \PHPUnit_Framework_TestCase
namespace tests\thinkphp\library\think;
use think\Debug;
class debugTest extends \PHPUnit_Framework_TestCase
{
/**

View File

@@ -2,20 +2,27 @@
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2015 http://thinkphp.cn All rights reserved.
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: Haotong Lin <lofanmi@gmail.com>
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
/**
* Input测试
* @author Haotong Lin <lofanmi@gmail.com>
*/
namespace tests\thinkphp\library\think;
use think\Input;
class InputTest extends \PHPUnit_Framework_TestCase
class inputTest extends \PHPUnit_Framework_TestCase
{
public function testEmptyStringName()
{
$input = ['a' => 'test'];
$input = ['a' => 'test'];
$this->assertEquals($input, Input::getData('', $input, 'trim'));
}
@@ -54,7 +61,7 @@ class InputTest extends \PHPUnit_Framework_TestCase
{
$src = 'EXP|NEQ|GT|EGT|LT|ELT|OR|XOR|LIKE|NOTLIKE|NOT BETWEEN|NOTBETWEEN|BETWEEN|NOTIN|NOT IN|IN';
$regexs = explode('|', $src);
$data = Input::getData('', $regexs);
$data = Input::getData('', $regexs);
foreach ($regexs as $key => $value) {
$expected = $value . ' ';
$this->assertEquals($expected, $data[$key]);
@@ -122,7 +129,7 @@ class InputTest extends \PHPUnit_Framework_TestCase
public function testSuperglobals()
{
Input::setFilter('trim');
$_GET['get'] = 'get value ';
$_GET['get'] = 'get value ';
$this->assertEquals('get value', Input::get('get'));
$_POST['post'] = 'post value ';
$this->assertEquals('post value', Input::post('post'));

View File

@@ -6,14 +6,17 @@
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 大漠 <zhylninc@gmail.com>
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
namespace think;
/**
* Generated by PHPUnit_SkeletonGenerator on 2016-01-14 at 21:32:07.
* Response测试
* @author 大漠 <zhylninc@gmail.com>
*/
class ResponseTest extends \PHPUnit_Framework_TestCase
namespace tests\thinkphp\library\think;
class responseTest extends \PHPUnit_Framework_TestCase
{
/**
@@ -48,10 +51,10 @@ class ResponseTest extends \PHPUnit_Framework_TestCase
// /**
// * @runInSeparateProcess
// */
if (! $this->default_return_type) {
if (!$this->default_return_type) {
$this->default_return_type = \think\Config::get('default_return_type');
}
if (! $this->default_ajax_return) {
if (!$this->default_ajax_return) {
$this->default_ajax_return = \think\Config::get('default_ajax_return');
}
}
@@ -73,9 +76,9 @@ class ResponseTest extends \PHPUnit_Framework_TestCase
*/
public function testSend()
{
$dataArr = array();
$dataArr = array();
$dataArr["key"] = "value";
$dataArr->key = "val";
$dataArr->key = "val";
$result = \think\Response::send($dataArr, "", true);
$this->assertArrayHasKey("key", $result);
@@ -83,9 +86,9 @@ class ResponseTest extends \PHPUnit_Framework_TestCase
$result = \think\Response::send($dataArr, "json", true);
$this->assertEquals('{"key":"value"}', $result);
$handler = "callback";
$handler = "callback";
$_GET[\think\Config::get('var_jsonp_handler')] = $handler;
$result = \think\Response::send($dataArr, "jsonp", true);
$result = \think\Response::send($dataArr, "jsonp", true);
$this->assertEquals('callback({"key":"value"});', $result);
\think\Response::tramsform(function () {
@@ -95,7 +98,7 @@ class ResponseTest extends \PHPUnit_Framework_TestCase
$result = \think\Response::send($dataArr, "", true);
$this->assertEquals("callbackreturndata", $result);
$_GET[\think\Config::get('var_jsonp_handler')]="";
$_GET[\think\Config::get('var_jsonp_handler')] = "";
}
/**
@@ -160,10 +163,10 @@ class ResponseTest extends \PHPUnit_Framework_TestCase
*/
public function testResult()
{
$data = "data";
$code = "1001";
$msg = "the msg";
$type = "json";
$data = "data";
$code = "1001";
$msg = "the msg";
$type = "json";
$result = \think\Response::result($data, $code, $msg, $type);
$this->assertEquals($code, $result["code"]);
@@ -180,11 +183,11 @@ class ResponseTest extends \PHPUnit_Framework_TestCase
public function testSuccess()
{
// round 1
$msg = 1001;
$msg = 1001;
$data = "data";
$url = "www.HTTP_REFERER.com";
$HTTP_REFERER = $_SERVER["HTTP_REFERER"];
$url = "www.HTTP_REFERER.com";
$HTTP_REFERER = $_SERVER["HTTP_REFERER"];
$_SERVER["HTTP_REFERER"] = $url;
\think\Config::set('default_return_type', "json");
@@ -231,7 +234,7 @@ class ResponseTest extends \PHPUnit_Framework_TestCase
public function testError()
{
// round 1
$msg = 1001;
$msg = 1001;
$data = "data";
\think\Config::set('default_return_type', "json");

View File

@@ -6,14 +6,17 @@
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 大漠 <zhylninc@gmail.com>
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
namespace think;
/**
* Generated by PHPUnit_SkeletonGenerator on 2016-01-14 at 02:40:08.
* Session测试
* @author 大漠 <zhylninc@gmail.com>
*/
class SessionTest extends \PHPUnit_Framework_TestCase
namespace tests\thinkphp\library\think;
class sessionTest extends \PHPUnit_Framework_TestCase
{
/**
@@ -69,23 +72,23 @@ class SessionTest extends \PHPUnit_Framework_TestCase
\think\Session::prefix(null);
$config = [
// cookie 名称前缀
'prefix' => 'think_',
'prefix' => 'think_',
// cookie 保存时间
'expire' => 60,
'expire' => 60,
// cookie 保存路径
'path' => '/path/to/test/session/',
'path' => '/path/to/test/session/',
// cookie 有效域名
'domain' => '.thinkphp.cn',
'domain' => '.thinkphp.cn',
'var_session_id' => 'sessionidtest',
'id' => 'sess_8fhgkjuakhatbeg2fa14lo84q1',
'name' => 'session_name',
'use_trans_sid' => '1',
'use_cookies' => '1',
'cache_limiter' => '60',
'cache_expire' => '60',
'type' => '', // memcache
'namespace' => '\\think\\session\\driver\\', // ?
'auto_start' => '1'
'id' => 'sess_8fhgkjuakhatbeg2fa14lo84q1',
'name' => 'session_name',
'use_trans_sid' => '1',
'use_cookies' => '1',
'cache_limiter' => '60',
'cache_expire' => '60',
'type' => '', // memcache
'namespace' => '\\think\\session\\driver\\', // ?
'auto_start' => '1',
];
$_REQUEST[$config['var_session_id']] = $config['id'];
@@ -133,23 +136,23 @@ class SessionTest extends \PHPUnit_Framework_TestCase
{
$config = [
// cookie 名称前缀
'prefix' => 'think_',
'prefix' => 'think_',
// cookie 保存时间
'expire' => 0,
'expire' => 0,
// cookie 保存路径
'path' => '/path/to/test/session/',
'path' => '/path/to/test/session/',
// cookie 有效域名
'domain' => '.thinkphp.cn',
'domain' => '.thinkphp.cn',
'var_session_id' => 'sessionidtest',
'id' => 'sess_8fhgkjuakhatbeg2fa14lo84q1',
'name' => 'session_name',
'use_trans_sid' => '1',
'use_cookies' => '1',
'cache_limiter' => '60',
'cache_expire' => '60',
'type' => 'memcache', //
'namespace' => '\\think\\session\\driver\\', // ?
'auto_start' => '1'
'id' => 'sess_8fhgkjuakhatbeg2fa14lo84q1',
'name' => 'session_name',
'use_trans_sid' => '1',
'use_cookies' => '1',
'cache_limiter' => '60',
'cache_expire' => '60',
'type' => 'memcache', //
'namespace' => '\\think\\session\\driver\\', // ?
'auto_start' => '1',
];
// 测试session驱动是否存在

View File

@@ -2,17 +2,19 @@
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2015 http://thinkphp.cn All rights reserved.
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: mahuan <mahuan@d1web.top>
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
/**
* view测试
* @author mahuan <mahuan@d1web.top>
*/
namespace think;
namespace tests\thinkphp\library\think;
class viewTest extends \PHPUnit_Framework_TestCase
{

View File

@@ -6,10 +6,15 @@
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: Haotong Lin <lofanmi@gmail.com>
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
namespace think;
/**
* app类测试
* @author Haotong Lin <lofanmi@gmail.com>
*/
namespace tests\thinkphp\library\think;
class appTest extends \PHPUnit_Framework_TestCase
{

View File

@@ -1,14 +1,24 @@
<?php
namespace tests\thinkphp\library\think\cache\driver;
use think\cache;
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
/**
* 缓存抽象类,提供一些测试
* @author simon <mahuan@d1web.top>
*/
abstract class CacheTestCase extends \PHPUnit_Framework_TestCase
namespace tests\thinkphp\library\think\cache\driver;
use think\cache;
abstract class cacheTestCase extends \PHPUnit_Framework_TestCase
{
/**

View File

@@ -8,13 +8,15 @@
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
/**
* Apc缓存驱动测试
* @author mahuan <mahuan@d1web.top>
*/
namespace tests\thinkphp\library\think\cache\driver;
class apcTest extends CacheTestCase
class apcTest extends cacheTestCase
{
private $_cacheInstance = null;
/**

View File

@@ -13,9 +13,10 @@
* 数据库缓存驱动测试
* @author mahuan <mahuan@d1web.top>
*/
namespace tests\thinkphp\library\think\cache\driver;
class dbTest extends CacheTestCase
class dbTest extends cacheTestCase
{
private $_cacheInstance = null;

View File

@@ -11,11 +11,10 @@
/**
* Ini配置测试
*
* @author 7IN0SAN9 <me@7in0.me>
*/
namespace think\config\driver;
namespace tests\thinkphp\library\think\config\driver;
use think\config;

View File

@@ -11,11 +11,10 @@
/**
* Xml配置测试
*
* @author 7IN0SAN9 <me@7in0.me>
*/
namespace think\config\driver;
namespace tests\thinkphp\library\think\config\driver;
use think\config;

View File

@@ -6,12 +6,18 @@
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: Haotong Lin <lofanmi@gmail.com>
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
namespace think;
/**
* 配置测试
* @author Haotong Lin <lofanmi@gmail.com>
*/
namespace tests\thinkphp\library\think;
use ReflectionClass;
use think\Config;
class configTest extends \PHPUnit_Framework_TestCase
{

View File

@@ -6,10 +6,15 @@
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: Haotong Lin <lofanmi@gmail.com>
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
namespace think;
/**
* 控制器测试
* @author Haotong Lin <lofanmi@gmail.com>
*/
namespace tests\thinkphp\library\think;
require_once CORE_PATH . '../../helper.php';

View File

@@ -6,10 +6,15 @@
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: Haotong Lin <lofanmi@gmail.com>
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
namespace think;
/**
* Cookie测试
* @author Haotong Lin <lofanmi@gmail.com>
*/
namespace tests\thinkphp\library\think;
use ReflectionClass;

View File

@@ -2,16 +2,23 @@
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2015 http://thinkphp.cn All rights reserved.
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: Haotong Lin <lofanmi@gmail.com>
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
/**
* 模板测试
* @author Haotong Lin <lofanmi@gmail.com>
*/
namespace tests\thinkphp\library\think;
use think\Template;
class TemplateTest extends \PHPUnit_Framework_TestCase
class templateTest extends \PHPUnit_Framework_TestCase
{
public function testVar()
{
@@ -139,10 +146,10 @@ EOF;
public function testVarIdentify()
{
$config['tpl_begin'] = '<#';
$config['tpl_end'] = '#>';
$config['tpl_begin'] = '<#';
$config['tpl_end'] = '#>';
$config['tpl_var_identify'] = '';
$template = new Template($config);
$template = new Template($config);
$content = <<<EOF
<#\$info.a??'test'#>