This commit is contained in:
thinkphp
2016-10-15 11:03:56 +08:00
parent 9bb981368a
commit 2ef3ad748b
3 changed files with 6 additions and 4 deletions

View File

@@ -210,6 +210,8 @@ class Request
unset($server['HTTPS']); unset($server['HTTPS']);
$server['SERVER_PORT'] = 80; $server['SERVER_PORT'] = 80;
} }
} else {
$info['scheme'] = 'http';
} }
if (isset($info['port'])) { if (isset($info['port'])) {
$server['SERVER_PORT'] = $info['port']; $server['SERVER_PORT'] = $info['port'];

View File

@@ -130,7 +130,7 @@ class requestTest extends \PHPUnit_Framework_TestCase
public function testVar() public function testVar()
{ {
Config::set('app_multi_module', true); Config::set('app_multi_module', true);
$request = new Request(); $request = Request::create('');
$request->route(['name' => 'thinkphp', 'id' => 6]); $request->route(['name' => 'thinkphp', 'id' => 6]);
$request->get(['id' => 10]); $request->get(['id' => 10]);
$request->post(['id' => 8]); $request->post(['id' => 8]);

View File

@@ -74,7 +74,7 @@ class urlTest extends \PHPUnit_Framework_TestCase
public function testBuildMethod() public function testBuildMethod()
{ {
Route::get('blog/:id', '\app\index\controller\blog@read'); Route::get('blog/:id', '\app\index\controller\blog@read');
$this->assertEquals('/blog/10.html', Url::build('[\app\index\controller\blog@read]', 'id=10', 'html')); $this->assertEquals('/blog/10.html', Url::build('\app\index\controller\blog@read', 'id=10', 'html'));
} }
public function testBuildRoute() public function testBuildRoute()
@@ -97,10 +97,10 @@ class urlTest extends \PHPUnit_Framework_TestCase
{ {
Route::get('blog/:id', 'index/blog'); Route::get('blog/:id', 'index/blog');
Config::set('url_html_suffix', 'shtml'); Config::set('url_html_suffix', 'shtml');
$this->assertEquals('/blog/10.shtml#detail', Url::build('/blog/10#detail')); $this->assertEquals('/blog/10.shtml#detail', Url::build('index/blog#detail', 'id=10'));
Config::set('url_common_param', true); Config::set('url_common_param', true);
$this->assertEquals('/blog/10.shtml?foo=bar#detail', Url::build('/blog/10#detail', "foo=bar")); $this->assertEquals('/blog/10.shtml?foo=bar#detail', Url::build('index/blog#detail', "id=10&foo=bar"));
} }
public function testBuildDomain() public function testBuildDomain()