App类改进run方法传入Request对象 便于构造自己的Request对象

This commit is contained in:
thinkphp
2016-05-11 12:25:29 +08:00
parent 9843eaf243
commit b50eeb5e7d
4 changed files with 25 additions and 24 deletions

View File

@@ -26,17 +26,17 @@ class urlTest extends \PHPUnit_Framework_TestCase
public function testBuildModule()
{
Route::get('hello/:name', 'index/hello');
Route::get('hello/:id', 'index/hello');
Route::get('blog/:name', 'index/blog');
Route::get('blog/:id', 'index/blog');
Config::set('pathinfo_depr', '/');
$this->assertEquals('/hello/thinkphp', Url::build('index/hello?name=thinkphp'));
$this->assertEquals('/hello/thinkphp.html', Url::build('index/hello', 'name=thinkphp', 'html'));
$this->assertEquals('/hello/10', Url::build('index/hello?id=10'));
$this->assertEquals('/hello/10.html', Url::build('index/hello', 'id=10', 'html'));
$this->assertEquals('/blog/thinkphp', Url::build('index/blog?name=thinkphp'));
$this->assertEquals('/blog/thinkphp.html', Url::build('index/blog', 'name=thinkphp', 'html'));
$this->assertEquals('/blog/10', Url::build('index/blog?id=10'));
$this->assertEquals('/blog/10.html', Url::build('index/blog', 'id=10', 'html'));
Route::get('item-<item><id?>', 'good/item', [], ['item' => '\w+', 'id' => '\d+']);
$this->assertEquals('/item-thinkphp', Url::build('good/item?item=thinkphp'));
$this->assertEquals('/item-thinkphp2016', Url::build('good/item?item=thinkphp&id=2016'));
Route::get('item-<name><id?>', 'blog/item', [], ['name' => '\w+', 'id' => '\d+']);
$this->assertEquals('/item-thinkphp', Url::build('blog/item?name=thinkphp'));
$this->assertEquals('/item-thinkphp2016', Url::build('blog/item?name=thinkphp&id=2016'));
}
public function testBuildController()