From cd57dfd8e19063740d38fa50dbba2260d4047a13 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Sat, 26 Mar 2016 09:31:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84routeTest?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/thinkphp/library/think/routeTest.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/thinkphp/library/think/routeTest.php b/tests/thinkphp/library/think/routeTest.php index 44a9385d..def9b611 100644 --- a/tests/thinkphp/library/think/routeTest.php +++ b/tests/thinkphp/library/think/routeTest.php @@ -69,6 +69,16 @@ class routeTest extends \PHPUnit_Framework_TestCase $this->assertEquals(['type' => 'module', 'module' => ['index', 'hello', null]], Route::check('hello')); } + public function testMixVar() + { + Route::get('hello-', 'index/hello', [], ['name' => '\w+']); + $this->assertEquals(['type' => 'module', 'module' => [null, 'index', 'hello']], Route::check('hello-thinkphp')); + Route::get('hello-', 'index/hello', [], ['name' => '\w+', 'id' => '\d+']); + $this->assertEquals(['type' => 'module', 'module' => [null, 'index', 'hello']], Route::check('hello-thinkphp2016')); + Route::get('hello-/[:id]', 'index/hello', [], ['name' => '\w+', 'id' => '\d+']); + $this->assertEquals(['type' => 'module', 'module' => [null, 'index', 'hello']], Route::check('hello-thinkphp/2016')); + } + public function testParseUrl() { $this->assertEquals(['type' => 'module', 'module' => ['hello', null, null]], Route::parseUrl('hello'));