mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-06 07:02:47 +08:00
修正命名空间、版权注释
This commit is contained in:
@@ -6,14 +6,19 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
// | 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
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -2,20 +2,27 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
|
// | 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 )
|
// | 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;
|
use think\Input;
|
||||||
|
|
||||||
class InputTest extends \PHPUnit_Framework_TestCase
|
class inputTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
public function testEmptyStringName()
|
public function testEmptyStringName()
|
||||||
{
|
{
|
||||||
$input = ['a' => 'test'];
|
$input = ['a' => 'test'];
|
||||||
$this->assertEquals($input, Input::getData('', $input, 'trim'));
|
$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';
|
$src = 'EXP|NEQ|GT|EGT|LT|ELT|OR|XOR|LIKE|NOTLIKE|NOT BETWEEN|NOTBETWEEN|BETWEEN|NOTIN|NOT IN|IN';
|
||||||
$regexs = explode('|', $src);
|
$regexs = explode('|', $src);
|
||||||
$data = Input::getData('', $regexs);
|
$data = Input::getData('', $regexs);
|
||||||
foreach ($regexs as $key => $value) {
|
foreach ($regexs as $key => $value) {
|
||||||
$expected = $value . ' ';
|
$expected = $value . ' ';
|
||||||
$this->assertEquals($expected, $data[$key]);
|
$this->assertEquals($expected, $data[$key]);
|
||||||
@@ -122,7 +129,7 @@ class InputTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testSuperglobals()
|
public function testSuperglobals()
|
||||||
{
|
{
|
||||||
Input::setFilter('trim');
|
Input::setFilter('trim');
|
||||||
$_GET['get'] = 'get value ';
|
$_GET['get'] = 'get value ';
|
||||||
$this->assertEquals('get value', Input::get('get'));
|
$this->assertEquals('get value', Input::get('get'));
|
||||||
$_POST['post'] = 'post value ';
|
$_POST['post'] = 'post value ';
|
||||||
$this->assertEquals('post value', Input::post('post'));
|
$this->assertEquals('post value', Input::post('post'));
|
||||||
|
|||||||
@@ -6,14 +6,17 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
// | 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
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -36,10 +39,10 @@ class ResponseTest extends \PHPUnit_Framework_TestCase
|
|||||||
// restore_error_handler();
|
// restore_error_handler();
|
||||||
// Warning: Cannot modify header information - headers already sent by (output started at PHPUnit\Util\Printer.php:173)
|
// Warning: Cannot modify header information - headers already sent by (output started at PHPUnit\Util\Printer.php:173)
|
||||||
// more see in https://www.analysisandsolutions.com/blog/html/writing-phpunit-tests-for-wordpress-plugins-wp-redirect-and-continuing-after-php-errors.htm
|
// more see in https://www.analysisandsolutions.com/blog/html/writing-phpunit-tests-for-wordpress-plugins-wp-redirect-and-continuing-after-php-errors.htm
|
||||||
|
|
||||||
// 2.
|
// 2.
|
||||||
// the Symfony used the HeaderMock.php
|
// the Symfony used the HeaderMock.php
|
||||||
|
|
||||||
// 3.
|
// 3.
|
||||||
// not run the eclipse will held, and travis-ci.org Searching for coverage reports
|
// not run the eclipse will held, and travis-ci.org Searching for coverage reports
|
||||||
// **> Python coverage not found
|
// **> Python coverage not found
|
||||||
@@ -48,10 +51,10 @@ class ResponseTest extends \PHPUnit_Framework_TestCase
|
|||||||
// /**
|
// /**
|
||||||
// * @runInSeparateProcess
|
// * @runInSeparateProcess
|
||||||
// */
|
// */
|
||||||
if (! $this->default_return_type) {
|
if (!$this->default_return_type) {
|
||||||
$this->default_return_type = \think\Config::get('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');
|
$this->default_ajax_return = \think\Config::get('default_ajax_return');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -73,29 +76,29 @@ class ResponseTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testSend()
|
public function testSend()
|
||||||
{
|
{
|
||||||
$dataArr = array();
|
$dataArr = array();
|
||||||
$dataArr["key"] = "value";
|
$dataArr["key"] = "value";
|
||||||
$dataArr->key = "val";
|
$dataArr->key = "val";
|
||||||
|
|
||||||
$result = \think\Response::send($dataArr, "", true);
|
$result = \think\Response::send($dataArr, "", true);
|
||||||
$this->assertArrayHasKey("key", $result);
|
$this->assertArrayHasKey("key", $result);
|
||||||
|
|
||||||
$result = \think\Response::send($dataArr, "json", true);
|
$result = \think\Response::send($dataArr, "json", true);
|
||||||
$this->assertEquals('{"key":"value"}', $result);
|
$this->assertEquals('{"key":"value"}', $result);
|
||||||
|
|
||||||
$handler = "callback";
|
$handler = "callback";
|
||||||
$_GET[\think\Config::get('var_jsonp_handler')] = $handler;
|
$_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);
|
$this->assertEquals('callback({"key":"value"});', $result);
|
||||||
|
|
||||||
\think\Response::tramsform(function () {
|
\think\Response::tramsform(function () {
|
||||||
|
|
||||||
return "callbackreturndata";
|
return "callbackreturndata";
|
||||||
});
|
});
|
||||||
|
|
||||||
$result = \think\Response::send($dataArr, "", true);
|
$result = \think\Response::send($dataArr, "", true);
|
||||||
$this->assertEquals("callbackreturndata", $result);
|
$this->assertEquals("callbackreturndata", $result);
|
||||||
$_GET[\think\Config::get('var_jsonp_handler')]="";
|
$_GET[\think\Config::get('var_jsonp_handler')] = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -105,13 +108,13 @@ class ResponseTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testTramsform()
|
public function testTramsform()
|
||||||
{
|
{
|
||||||
\think\Response::tramsform(function () {
|
\think\Response::tramsform(function () {
|
||||||
|
|
||||||
return "callbackreturndata";
|
return "callbackreturndata";
|
||||||
});
|
});
|
||||||
|
|
||||||
$result = \think\Response::send($dataArr, "", true);
|
$result = \think\Response::send($dataArr, "", true);
|
||||||
$this->assertEquals("callbackreturndata", $result);
|
$this->assertEquals("callbackreturndata", $result);
|
||||||
|
|
||||||
\think\Response::tramsform(null);
|
\think\Response::tramsform(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,7 +126,7 @@ class ResponseTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
$type = "json";
|
$type = "json";
|
||||||
\think\Response::type($type);
|
\think\Response::type($type);
|
||||||
|
|
||||||
$result = \think\Response::type();
|
$result = \think\Response::type();
|
||||||
$this->assertEquals($type, $result);
|
$this->assertEquals($type, $result);
|
||||||
\think\Response::type($type);
|
\think\Response::type($type);
|
||||||
@@ -148,7 +151,7 @@ class ResponseTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
$isExit = true;
|
$isExit = true;
|
||||||
\think\Response::isExit($isExit);
|
\think\Response::isExit($isExit);
|
||||||
|
|
||||||
$result = \think\Response::isExit();
|
$result = \think\Response::isExit();
|
||||||
$this->assertTrue($isExit, $result);
|
$this->assertTrue($isExit, $result);
|
||||||
\think\Response::isExit(false);
|
\think\Response::isExit(false);
|
||||||
@@ -160,12 +163,12 @@ class ResponseTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testResult()
|
public function testResult()
|
||||||
{
|
{
|
||||||
$data = "data";
|
$data = "data";
|
||||||
$code = "1001";
|
$code = "1001";
|
||||||
$msg = "the msg";
|
$msg = "the msg";
|
||||||
$type = "json";
|
$type = "json";
|
||||||
$result = \think\Response::result($data, $code, $msg, $type);
|
$result = \think\Response::result($data, $code, $msg, $type);
|
||||||
|
|
||||||
$this->assertEquals($code, $result["code"]);
|
$this->assertEquals($code, $result["code"]);
|
||||||
$this->assertEquals($msg, $result["msg"]);
|
$this->assertEquals($msg, $result["msg"]);
|
||||||
$this->assertEquals($data, $result["data"]);
|
$this->assertEquals($data, $result["data"]);
|
||||||
@@ -180,47 +183,47 @@ class ResponseTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testSuccess()
|
public function testSuccess()
|
||||||
{
|
{
|
||||||
// round 1
|
// round 1
|
||||||
$msg = 1001;
|
$msg = 1001;
|
||||||
$data = "data";
|
$data = "data";
|
||||||
|
|
||||||
$url = "www.HTTP_REFERER.com";
|
$url = "www.HTTP_REFERER.com";
|
||||||
$HTTP_REFERER = $_SERVER["HTTP_REFERER"];
|
$HTTP_REFERER = $_SERVER["HTTP_REFERER"];
|
||||||
$_SERVER["HTTP_REFERER"] = $url;
|
$_SERVER["HTTP_REFERER"] = $url;
|
||||||
\think\Config::set('default_return_type', "json");
|
\think\Config::set('default_return_type', "json");
|
||||||
|
|
||||||
$result = \think\Response::success($msg, $data);
|
$result = \think\Response::success($msg, $data);
|
||||||
|
|
||||||
$this->assertEquals($msg, $result["code"]);
|
$this->assertEquals($msg, $result["code"]);
|
||||||
|
|
||||||
$this->assertEquals($data, $result["data"]);
|
$this->assertEquals($data, $result["data"]);
|
||||||
$this->assertEquals($url, $result["url"]);
|
$this->assertEquals($url, $result["url"]);
|
||||||
$this->assertEquals("json", \think\Response::type());
|
$this->assertEquals("json", \think\Response::type());
|
||||||
$this->assertEquals(3, $result["wait"]);
|
$this->assertEquals(3, $result["wait"]);
|
||||||
|
|
||||||
// round 2
|
// round 2
|
||||||
$msg = "the msg";
|
$msg = "the msg";
|
||||||
$url = "www.thinkphptestsucess.com";
|
$url = "www.thinkphptestsucess.com";
|
||||||
|
|
||||||
$result = \think\Response::success($msg, $data, $url);
|
$result = \think\Response::success($msg, $data, $url);
|
||||||
|
|
||||||
$this->assertEquals($msg, $result["msg"]);
|
$this->assertEquals($msg, $result["msg"]);
|
||||||
$this->assertEquals($url, $result["url"]);
|
$this->assertEquals($url, $result["url"]);
|
||||||
|
|
||||||
// round 3 异常在travis-ci中未能重现
|
// round 3 异常在travis-ci中未能重现
|
||||||
// $this->setExpectedException('\think\Exception');
|
// $this->setExpectedException('\think\Exception');
|
||||||
// FIXME 静态方法mock
|
// FIXME 静态方法mock
|
||||||
// $oMockView = $this->getMockBuilder('\think\View')->setMethods(array(
|
// $oMockView = $this->getMockBuilder('\think\View')->setMethods(array(
|
||||||
// 'fetch'
|
// 'fetch'
|
||||||
// ))->getMock();
|
// ))->getMock();
|
||||||
|
|
||||||
// $oMockView->expects($this->any())->method('fetch')->will($this->returnValue('content'));
|
// $oMockView->expects($this->any())->method('fetch')->will($this->returnValue('content'));
|
||||||
|
|
||||||
// \think\Config::set('default_return_type', "html");
|
// \think\Config::set('default_return_type', "html");
|
||||||
// $result = \think\Response::success($msg, $data, $url);
|
// $result = \think\Response::success($msg, $data, $url);
|
||||||
|
|
||||||
// FIXME 静态方法mock
|
// FIXME 静态方法mock
|
||||||
// $this->assertEquals('content', $result);
|
// $this->assertEquals('content', $result);
|
||||||
|
|
||||||
$_SERVER["HTTP_REFERER"] = $HTTP_REFERER;
|
$_SERVER["HTTP_REFERER"] = $HTTP_REFERER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -231,41 +234,41 @@ class ResponseTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testError()
|
public function testError()
|
||||||
{
|
{
|
||||||
// round 1
|
// round 1
|
||||||
$msg = 1001;
|
$msg = 1001;
|
||||||
$data = "data";
|
$data = "data";
|
||||||
|
|
||||||
\think\Config::set('default_return_type', "json");
|
\think\Config::set('default_return_type', "json");
|
||||||
|
|
||||||
$result = \think\Response::error($msg, $data);
|
$result = \think\Response::error($msg, $data);
|
||||||
|
|
||||||
$this->assertEquals($msg, $result["code"]);
|
$this->assertEquals($msg, $result["code"]);
|
||||||
$this->assertEquals($data, $result["data"]);
|
$this->assertEquals($data, $result["data"]);
|
||||||
$this->assertEquals('javascript:history.back(-1);', $result["url"]);
|
$this->assertEquals('javascript:history.back(-1);', $result["url"]);
|
||||||
$this->assertEquals("json", \think\Response::type());
|
$this->assertEquals("json", \think\Response::type());
|
||||||
$this->assertEquals(3, $result["wait"]);
|
$this->assertEquals(3, $result["wait"]);
|
||||||
|
|
||||||
// round 2
|
// round 2
|
||||||
$msg = "the msg";
|
$msg = "the msg";
|
||||||
$url = "www.thinkphptesterror.com";
|
$url = "www.thinkphptesterror.com";
|
||||||
|
|
||||||
$result = \think\Response::error($msg, $data, $url);
|
$result = \think\Response::error($msg, $data, $url);
|
||||||
|
|
||||||
$this->assertEquals($msg, $result["msg"]);
|
$this->assertEquals($msg, $result["msg"]);
|
||||||
$this->assertEquals($url, $result["url"]);
|
$this->assertEquals($url, $result["url"]);
|
||||||
|
|
||||||
// round 3 异常在travis-ci中未能重现
|
// round 3 异常在travis-ci中未能重现
|
||||||
// $this->setExpectedException('\think\Exception');
|
// $this->setExpectedException('\think\Exception');
|
||||||
// FIXME 静态方法mock
|
// FIXME 静态方法mock
|
||||||
// $oMockView = $this->getMockBuilder('\think\View')->setMethods(array(
|
// $oMockView = $this->getMockBuilder('\think\View')->setMethods(array(
|
||||||
// 'fetch'
|
// 'fetch'
|
||||||
// ))->getMock();
|
// ))->getMock();
|
||||||
|
|
||||||
// $oMockView->expects($this->any())->method('fetch')->will($this->returnValue('content'));
|
// $oMockView->expects($this->any())->method('fetch')->will($this->returnValue('content'));
|
||||||
|
|
||||||
// \think\Config::set('default_return_type', "html");
|
// \think\Config::set('default_return_type', "html");
|
||||||
|
|
||||||
// $result = \think\Response::error($msg, $data, $url);
|
// $result = \think\Response::error($msg, $data, $url);
|
||||||
|
|
||||||
// FIXME 静态方法mock
|
// FIXME 静态方法mock
|
||||||
// $this->assertEquals('content', $result);
|
// $this->assertEquals('content', $result);
|
||||||
}
|
}
|
||||||
@@ -280,11 +283,11 @@ class ResponseTest extends \PHPUnit_Framework_TestCase
|
|||||||
// $url = "http://www.testredirect.com";
|
// $url = "http://www.testredirect.com";
|
||||||
// $params = array();
|
// $params = array();
|
||||||
// $params[] = 301;
|
// $params[] = 301;
|
||||||
|
|
||||||
// // FIXME 静态方法mock Url::build
|
// // FIXME 静态方法mock Url::build
|
||||||
// // echo "\r\n" . json_encode(xdebug_get_headers()) . "\r\n";
|
// // echo "\r\n" . json_encode(xdebug_get_headers()) . "\r\n";
|
||||||
// \think\Response::redirect($url, $params);
|
// \think\Response::redirect($url, $params);
|
||||||
|
|
||||||
// $this->assertContains('Location: ' . $url, xdebug_get_headers());
|
// $this->assertContains('Location: ' . $url, xdebug_get_headers());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -312,4 +315,4 @@ class ResponseTest extends \PHPUnit_Framework_TestCase
|
|||||||
// $this->assertContains('HTTP/1.1 ' . ': ' . $status, xdebug_get_headers());
|
// $this->assertContains('HTTP/1.1 ' . ': ' . $status, xdebug_get_headers());
|
||||||
// $this->assertContains('Status:' . ': ' . $status, xdebug_get_headers());
|
// $this->assertContains('Status:' . ': ' . $status, xdebug_get_headers());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,14 +6,17 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
// | 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
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -55,7 +58,7 @@ class SessionTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
\think\Session::prefix(null);
|
\think\Session::prefix(null);
|
||||||
\think\Session::prefix('think_');
|
\think\Session::prefix('think_');
|
||||||
|
|
||||||
$this->assertEquals('think_', \think\Session::prefix());
|
$this->assertEquals('think_', \think\Session::prefix());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,58 +72,58 @@ class SessionTest extends \PHPUnit_Framework_TestCase
|
|||||||
\think\Session::prefix(null);
|
\think\Session::prefix(null);
|
||||||
$config = [
|
$config = [
|
||||||
// cookie 名称前缀
|
// cookie 名称前缀
|
||||||
'prefix' => 'think_',
|
'prefix' => 'think_',
|
||||||
// cookie 保存时间
|
// cookie 保存时间
|
||||||
'expire' => 60,
|
'expire' => 60,
|
||||||
// cookie 保存路径
|
// cookie 保存路径
|
||||||
'path' => '/path/to/test/session/',
|
'path' => '/path/to/test/session/',
|
||||||
// cookie 有效域名
|
// cookie 有效域名
|
||||||
'domain' => '.thinkphp.cn',
|
'domain' => '.thinkphp.cn',
|
||||||
'var_session_id' => 'sessionidtest',
|
'var_session_id' => 'sessionidtest',
|
||||||
'id' => 'sess_8fhgkjuakhatbeg2fa14lo84q1',
|
'id' => 'sess_8fhgkjuakhatbeg2fa14lo84q1',
|
||||||
'name' => 'session_name',
|
'name' => 'session_name',
|
||||||
'use_trans_sid' => '1',
|
'use_trans_sid' => '1',
|
||||||
'use_cookies' => '1',
|
'use_cookies' => '1',
|
||||||
'cache_limiter' => '60',
|
'cache_limiter' => '60',
|
||||||
'cache_expire' => '60',
|
'cache_expire' => '60',
|
||||||
'type' => '', // memcache
|
'type' => '', // memcache
|
||||||
'namespace' => '\\think\\session\\driver\\', // ?
|
'namespace' => '\\think\\session\\driver\\', // ?
|
||||||
'auto_start' => '1'
|
'auto_start' => '1',
|
||||||
];
|
];
|
||||||
|
|
||||||
$_REQUEST[$config['var_session_id']] = $config['id'];
|
$_REQUEST[$config['var_session_id']] = $config['id'];
|
||||||
\think\Session::init($config);
|
\think\Session::init($config);
|
||||||
|
|
||||||
// 开始断言
|
// 开始断言
|
||||||
$this->assertEquals($config['prefix'], \think\Session::prefix());
|
$this->assertEquals($config['prefix'], \think\Session::prefix());
|
||||||
$this->assertEquals($config['id'], $_REQUEST[$config['var_session_id']]);
|
$this->assertEquals($config['id'], $_REQUEST[$config['var_session_id']]);
|
||||||
$this->assertEquals($config['name'], session_name());
|
$this->assertEquals($config['name'], session_name());
|
||||||
|
|
||||||
$this->assertEquals($config['path'], session_save_path());
|
$this->assertEquals($config['path'], session_save_path());
|
||||||
$this->assertEquals($config['use_cookies'], ini_get('session.use_cookies'));
|
$this->assertEquals($config['use_cookies'], ini_get('session.use_cookies'));
|
||||||
$this->assertEquals($config['domain'], ini_get('session.cookie_domain'));
|
$this->assertEquals($config['domain'], ini_get('session.cookie_domain'));
|
||||||
$this->assertEquals($config['expire'], ini_get('session.gc_maxlifetime'));
|
$this->assertEquals($config['expire'], ini_get('session.gc_maxlifetime'));
|
||||||
$this->assertEquals($config['expire'], ini_get('session.cookie_lifetime'));
|
$this->assertEquals($config['expire'], ini_get('session.cookie_lifetime'));
|
||||||
|
|
||||||
$this->assertEquals($config['cache_limiter'], session_cache_limiter($config['cache_limiter']));
|
$this->assertEquals($config['cache_limiter'], session_cache_limiter($config['cache_limiter']));
|
||||||
$this->assertEquals($config['cache_expire'], session_cache_expire($config['cache_expire']));
|
$this->assertEquals($config['cache_expire'], session_cache_expire($config['cache_expire']));
|
||||||
|
|
||||||
// 检测分支
|
// 检测分支
|
||||||
$_REQUEST[$config['var_session_id']] = null;
|
$_REQUEST[$config['var_session_id']] = null;
|
||||||
session_write_close();
|
session_write_close();
|
||||||
session_destroy();
|
session_destroy();
|
||||||
|
|
||||||
\think\Session::init($config);
|
\think\Session::init($config);
|
||||||
|
|
||||||
// 测试auto_start
|
// 测试auto_start
|
||||||
// PHP_SESSION_DISABLED
|
// PHP_SESSION_DISABLED
|
||||||
// PHP_SESSION_NONE
|
// PHP_SESSION_NONE
|
||||||
// PHP_SESSION_ACTIVE
|
// PHP_SESSION_ACTIVE
|
||||||
// session_status()
|
// session_status()
|
||||||
$this->assertEquals(0, ini_get('session.auto_start'));
|
$this->assertEquals(0, ini_get('session.auto_start'));
|
||||||
|
|
||||||
$this->assertEquals($config['use_trans_sid'], ini_get('session.use_trans_sid'));
|
$this->assertEquals($config['use_trans_sid'], ini_get('session.use_trans_sid'));
|
||||||
|
|
||||||
\think\Session::init($config);
|
\think\Session::init($config);
|
||||||
$this->assertEquals($config['id'], session_id());
|
$this->assertEquals($config['id'], session_id());
|
||||||
}
|
}
|
||||||
@@ -133,29 +136,29 @@ class SessionTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
$config = [
|
$config = [
|
||||||
// cookie 名称前缀
|
// cookie 名称前缀
|
||||||
'prefix' => 'think_',
|
'prefix' => 'think_',
|
||||||
// cookie 保存时间
|
// cookie 保存时间
|
||||||
'expire' => 0,
|
'expire' => 0,
|
||||||
// cookie 保存路径
|
// cookie 保存路径
|
||||||
'path' => '/path/to/test/session/',
|
'path' => '/path/to/test/session/',
|
||||||
// cookie 有效域名
|
// cookie 有效域名
|
||||||
'domain' => '.thinkphp.cn',
|
'domain' => '.thinkphp.cn',
|
||||||
'var_session_id' => 'sessionidtest',
|
'var_session_id' => 'sessionidtest',
|
||||||
'id' => 'sess_8fhgkjuakhatbeg2fa14lo84q1',
|
'id' => 'sess_8fhgkjuakhatbeg2fa14lo84q1',
|
||||||
'name' => 'session_name',
|
'name' => 'session_name',
|
||||||
'use_trans_sid' => '1',
|
'use_trans_sid' => '1',
|
||||||
'use_cookies' => '1',
|
'use_cookies' => '1',
|
||||||
'cache_limiter' => '60',
|
'cache_limiter' => '60',
|
||||||
'cache_expire' => '60',
|
'cache_expire' => '60',
|
||||||
'type' => 'memcache', //
|
'type' => 'memcache', //
|
||||||
'namespace' => '\\think\\session\\driver\\', // ?
|
'namespace' => '\\think\\session\\driver\\', // ?
|
||||||
'auto_start' => '1'
|
'auto_start' => '1',
|
||||||
];
|
];
|
||||||
|
|
||||||
// 测试session驱动是否存在
|
// 测试session驱动是否存在
|
||||||
// @expectedException 异常类名
|
// @expectedException 异常类名
|
||||||
$this->setExpectedException('\think\Exception', 'error session handler', 11700);
|
$this->setExpectedException('\think\Exception', 'error session handler', 11700);
|
||||||
|
|
||||||
\think\Session::init($config);
|
\think\Session::init($config);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,13 +172,13 @@ class SessionTest extends \PHPUnit_Framework_TestCase
|
|||||||
\think\Session::prefix(null);
|
\think\Session::prefix(null);
|
||||||
\think\Session::set('sessionname', 'sessionvalue');
|
\think\Session::set('sessionname', 'sessionvalue');
|
||||||
$this->assertEquals('sessionvalue', $_SESSION['sessionname']);
|
$this->assertEquals('sessionvalue', $_SESSION['sessionname']);
|
||||||
|
|
||||||
\think\Session::set('sessionnamearr.subname', 'sessionvalue');
|
\think\Session::set('sessionnamearr.subname', 'sessionvalue');
|
||||||
$this->assertEquals('sessionvalue', $_SESSION['sessionnamearr']['subname']);
|
$this->assertEquals('sessionvalue', $_SESSION['sessionnamearr']['subname']);
|
||||||
|
|
||||||
\think\Session::set('sessionnameper', 'sessionvalue', 'think_');
|
\think\Session::set('sessionnameper', 'sessionvalue', 'think_');
|
||||||
$this->assertEquals('sessionvalue', $_SESSION['think_']['sessionnameper']);
|
$this->assertEquals('sessionvalue', $_SESSION['think_']['sessionnameper']);
|
||||||
|
|
||||||
\think\Session::set('sessionnamearrper.subname', 'sessionvalue', 'think_');
|
\think\Session::set('sessionnamearrper.subname', 'sessionvalue', 'think_');
|
||||||
$this->assertEquals('sessionvalue', $_SESSION['think_']['sessionnamearrper']['subname']);
|
$this->assertEquals('sessionvalue', $_SESSION['think_']['sessionnamearrper']['subname']);
|
||||||
}
|
}
|
||||||
@@ -188,19 +191,19 @@ class SessionTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testGet()
|
public function testGet()
|
||||||
{
|
{
|
||||||
\think\Session::prefix(null);
|
\think\Session::prefix(null);
|
||||||
|
|
||||||
\think\Session::set('sessionnameget', 'sessionvalue');
|
\think\Session::set('sessionnameget', 'sessionvalue');
|
||||||
$this->assertEquals(\think\Session::get('sessionnameget'), $_SESSION['sessionnameget']);
|
$this->assertEquals(\think\Session::get('sessionnameget'), $_SESSION['sessionnameget']);
|
||||||
|
|
||||||
\think\Session::set('sessionnamegetarr.subname', 'sessionvalue');
|
\think\Session::set('sessionnamegetarr.subname', 'sessionvalue');
|
||||||
$this->assertEquals(\think\Session::get('sessionnamegetarr.subname'), $_SESSION['sessionnamegetarr']['subname']);
|
$this->assertEquals(\think\Session::get('sessionnamegetarr.subname'), $_SESSION['sessionnamegetarr']['subname']);
|
||||||
|
|
||||||
\think\Session::set('sessionnamegetarrperall', 'sessionvalue', 'think_');
|
\think\Session::set('sessionnamegetarrperall', 'sessionvalue', 'think_');
|
||||||
$this->assertEquals(\think\Session::get('', 'think_')['sessionnamegetarrperall'], $_SESSION['think_']['sessionnamegetarrperall']);
|
$this->assertEquals(\think\Session::get('', 'think_')['sessionnamegetarrperall'], $_SESSION['think_']['sessionnamegetarrperall']);
|
||||||
|
|
||||||
\think\Session::set('sessionnamegetper', 'sessionvalue', 'think_');
|
\think\Session::set('sessionnamegetper', 'sessionvalue', 'think_');
|
||||||
$this->assertEquals(\think\Session::get('sessionnamegetper', 'think_'), $_SESSION['think_']['sessionnamegetper']);
|
$this->assertEquals(\think\Session::get('sessionnamegetper', 'think_'), $_SESSION['think_']['sessionnamegetper']);
|
||||||
|
|
||||||
\think\Session::set('sessionnamegetarrper.subname', 'sessionvalue', 'think_');
|
\think\Session::set('sessionnamegetarrper.subname', 'sessionvalue', 'think_');
|
||||||
$this->assertEquals(\think\Session::get('sessionnamegetarrper.subname', 'think_'), $_SESSION['think_']['sessionnamegetarrper']['subname']);
|
$this->assertEquals(\think\Session::get('sessionnamegetarrper.subname', 'think_'), $_SESSION['think_']['sessionnamegetarrper']['subname']);
|
||||||
}
|
}
|
||||||
@@ -216,15 +219,15 @@ class SessionTest extends \PHPUnit_Framework_TestCase
|
|||||||
\think\Session::set('sessionnamedel', 'sessionvalue');
|
\think\Session::set('sessionnamedel', 'sessionvalue');
|
||||||
\think\Session::delete('sessionnamedel');
|
\think\Session::delete('sessionnamedel');
|
||||||
$this->assertEmpty($_SESSION['sessionnamedel']);
|
$this->assertEmpty($_SESSION['sessionnamedel']);
|
||||||
|
|
||||||
\think\Session::set('sessionnamedelarr.subname', 'sessionvalue');
|
\think\Session::set('sessionnamedelarr.subname', 'sessionvalue');
|
||||||
\think\Session::delete('sessionnamedelarr.subname');
|
\think\Session::delete('sessionnamedelarr.subname');
|
||||||
$this->assertEmpty($_SESSION['sessionnamedelarr']['subname']);
|
$this->assertEmpty($_SESSION['sessionnamedelarr']['subname']);
|
||||||
|
|
||||||
\think\Session::set('sessionnamedelper', 'sessionvalue', 'think_');
|
\think\Session::set('sessionnamedelper', 'sessionvalue', 'think_');
|
||||||
\think\Session::delete('sessionnamedelper', 'think_');
|
\think\Session::delete('sessionnamedelper', 'think_');
|
||||||
$this->assertEmpty($_SESSION['think_']['sessionnamedelper']);
|
$this->assertEmpty($_SESSION['think_']['sessionnamedelper']);
|
||||||
|
|
||||||
\think\Session::set('sessionnamedelperarr.subname', 'sessionvalue', 'think_');
|
\think\Session::set('sessionnamedelperarr.subname', 'sessionvalue', 'think_');
|
||||||
\think\Session::delete('sessionnamedelperarr.subname', 'think_');
|
\think\Session::delete('sessionnamedelperarr.subname', 'think_');
|
||||||
$this->assertEmpty($_SESSION['think_']['sessionnamedelperarr']['subname']);
|
$this->assertEmpty($_SESSION['think_']['sessionnamedelperarr']['subname']);
|
||||||
@@ -238,11 +241,11 @@ class SessionTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testClear()
|
public function testClear()
|
||||||
{
|
{
|
||||||
\think\Session::prefix(null);
|
\think\Session::prefix(null);
|
||||||
|
|
||||||
\think\Session::set('sessionnameclsper', 'sessionvalue1', 'think_');
|
\think\Session::set('sessionnameclsper', 'sessionvalue1', 'think_');
|
||||||
\think\Session::clear('think_');
|
\think\Session::clear('think_');
|
||||||
$this->assertNull($_SESSION['think_']);
|
$this->assertNull($_SESSION['think_']);
|
||||||
|
|
||||||
\think\Session::set('sessionnameclsper', 'sessionvalue1', 'think_');
|
\think\Session::set('sessionnameclsper', 'sessionvalue1', 'think_');
|
||||||
\think\Session::clear();
|
\think\Session::clear();
|
||||||
$this->assertEmpty($_SESSION);
|
$this->assertEmpty($_SESSION);
|
||||||
@@ -258,13 +261,13 @@ class SessionTest extends \PHPUnit_Framework_TestCase
|
|||||||
\think\Session::prefix(null);
|
\think\Session::prefix(null);
|
||||||
\think\Session::set('sessionnamehas', 'sessionvalue');
|
\think\Session::set('sessionnamehas', 'sessionvalue');
|
||||||
$this->assertTrue(\think\Session::has('sessionnamehas'));
|
$this->assertTrue(\think\Session::has('sessionnamehas'));
|
||||||
|
|
||||||
\think\Session::set('sessionnamehasarr.subname', 'sessionvalue');
|
\think\Session::set('sessionnamehasarr.subname', 'sessionvalue');
|
||||||
$this->assertTrue(\think\Session::has('sessionnamehasarr.subname'));
|
$this->assertTrue(\think\Session::has('sessionnamehasarr.subname'));
|
||||||
|
|
||||||
\think\Session::set('sessionnamehasper', 'sessionvalue', 'think_');
|
\think\Session::set('sessionnamehasper', 'sessionvalue', 'think_');
|
||||||
$this->assertTrue(\think\Session::has('sessionnamehasper', 'think_'));
|
$this->assertTrue(\think\Session::has('sessionnamehasper', 'think_'));
|
||||||
|
|
||||||
\think\Session::set('sessionnamehasarrper.subname', 'sessionvalue', 'think_');
|
\think\Session::set('sessionnamehasarrper.subname', 'sessionvalue', 'think_');
|
||||||
$this->assertTrue(\think\Session::has('sessionnamehasarrper.subname', 'think_'));
|
$this->assertTrue(\think\Session::has('sessionnamehasarrper.subname', 'think_'));
|
||||||
}
|
}
|
||||||
@@ -300,4 +303,4 @@ class SessionTest extends \PHPUnit_Framework_TestCase
|
|||||||
\think\Session::destroy();
|
\think\Session::destroy();
|
||||||
$this->assertEmpty($_SESSION['sessionnamedestroy']);
|
$this->assertEmpty($_SESSION['sessionnamedestroy']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,17 +2,19 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
|
// | 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 )
|
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Author: mahuan <mahuan@d1web.top>
|
// | Author: liu21st <liu21st@gmail.com>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* view测试
|
* view测试
|
||||||
* @author mahuan <mahuan@d1web.top>
|
* @author mahuan <mahuan@d1web.top>
|
||||||
*/
|
*/
|
||||||
namespace think;
|
|
||||||
|
namespace tests\thinkphp\library\think;
|
||||||
|
|
||||||
class viewTest extends \PHPUnit_Framework_TestCase
|
class viewTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,10 +6,15 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
// | 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
|
class appTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,14 +1,24 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
namespace tests\thinkphp\library\think\cache\driver;
|
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
use think\cache;
|
// | 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>
|
* @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
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -8,13 +8,15 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Author: liu21st <liu21st@gmail.com>
|
// | Author: liu21st <liu21st@gmail.com>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Apc缓存驱动测试
|
* Apc缓存驱动测试
|
||||||
* @author mahuan <mahuan@d1web.top>
|
* @author mahuan <mahuan@d1web.top>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace tests\thinkphp\library\think\cache\driver;
|
namespace tests\thinkphp\library\think\cache\driver;
|
||||||
|
|
||||||
class apcTest extends CacheTestCase
|
class apcTest extends cacheTestCase
|
||||||
{
|
{
|
||||||
private $_cacheInstance = null;
|
private $_cacheInstance = null;
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -13,9 +13,10 @@
|
|||||||
* 数据库缓存驱动测试
|
* 数据库缓存驱动测试
|
||||||
* @author mahuan <mahuan@d1web.top>
|
* @author mahuan <mahuan@d1web.top>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace tests\thinkphp\library\think\cache\driver;
|
namespace tests\thinkphp\library\think\cache\driver;
|
||||||
|
|
||||||
class dbTest extends CacheTestCase
|
class dbTest extends cacheTestCase
|
||||||
{
|
{
|
||||||
private $_cacheInstance = null;
|
private $_cacheInstance = null;
|
||||||
|
|
||||||
|
|||||||
@@ -11,11 +11,10 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Ini配置测试
|
* Ini配置测试
|
||||||
*
|
|
||||||
* @author 7IN0SAN9 <me@7in0.me>
|
* @author 7IN0SAN9 <me@7in0.me>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace think\config\driver;
|
namespace tests\thinkphp\library\think\config\driver;
|
||||||
|
|
||||||
use think\config;
|
use think\config;
|
||||||
|
|
||||||
|
|||||||
@@ -11,11 +11,10 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Xml配置测试
|
* Xml配置测试
|
||||||
*
|
|
||||||
* @author 7IN0SAN9 <me@7in0.me>
|
* @author 7IN0SAN9 <me@7in0.me>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace think\config\driver;
|
namespace tests\thinkphp\library\think\config\driver;
|
||||||
|
|
||||||
use think\config;
|
use think\config;
|
||||||
|
|
||||||
|
|||||||
@@ -6,12 +6,18 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
// | 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 ReflectionClass;
|
||||||
|
use think\Config;
|
||||||
|
|
||||||
class configTest extends \PHPUnit_Framework_TestCase
|
class configTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,10 +6,15 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
// | 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';
|
require_once CORE_PATH . '../../helper.php';
|
||||||
|
|
||||||
|
|||||||
@@ -6,10 +6,15 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
// | 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;
|
use ReflectionClass;
|
||||||
|
|
||||||
|
|||||||
@@ -2,16 +2,23 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
|
// | 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 )
|
// | 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;
|
use think\Template;
|
||||||
|
|
||||||
class TemplateTest extends \PHPUnit_Framework_TestCase
|
class templateTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
public function testVar()
|
public function testVar()
|
||||||
{
|
{
|
||||||
@@ -139,10 +146,10 @@ EOF;
|
|||||||
|
|
||||||
public function testVarIdentify()
|
public function testVarIdentify()
|
||||||
{
|
{
|
||||||
$config['tpl_begin'] = '<#';
|
$config['tpl_begin'] = '<#';
|
||||||
$config['tpl_end'] = '#>';
|
$config['tpl_end'] = '#>';
|
||||||
$config['tpl_var_identify'] = '';
|
$config['tpl_var_identify'] = '';
|
||||||
$template = new Template($config);
|
$template = new Template($config);
|
||||||
|
|
||||||
$content = <<<EOF
|
$content = <<<EOF
|
||||||
<#\$info.a??'test'#>
|
<#\$info.a??'test'#>
|
||||||
|
|||||||
Reference in New Issue
Block a user