mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-22 01:30:23 +08:00
Merge pull request #10068 from SilverFire/9999-url-validator
Bug #9999: added PHPUnit test case to `UrlRuleTest`
This commit is contained in:
@@ -137,6 +137,30 @@ class UrlRuleTest extends TestCase
|
||||
['post/index', ['page' => 1, 'tag' => 'a'], 'post/1-a'],
|
||||
],
|
||||
],
|
||||
[
|
||||
'multiple params with special chars',
|
||||
[
|
||||
'pattern' => 'post/<page-number:\d+>/<per_page:\d+>/<author.login>',
|
||||
'route' => 'post/index',
|
||||
],
|
||||
[
|
||||
['post/index', [], false],
|
||||
['post/index', ['page-number' => '1', 'per_page' => '25'], false],
|
||||
['post/index', ['page-number' => '1', 'per_page' => '25', 'author.login' => 'yiiuser'], 'post/1/25/yiiuser'],
|
||||
],
|
||||
],
|
||||
[
|
||||
'multiple params with leading non-letter chars',
|
||||
[
|
||||
'pattern' => 'post/<1page-number:\d+>/<-per_page:\d+>/<_author.login>',
|
||||
'route' => 'post/index',
|
||||
],
|
||||
[
|
||||
['post/index', [], false],
|
||||
['post/index', ['1page-number' => '1', '-per_page' => '25'], false],
|
||||
['post/index', ['1page-number' => '1', '-per_page' => '25', '_author.login' => 'yiiuser'], 'post/1/25/yiiuser'],
|
||||
],
|
||||
],
|
||||
[
|
||||
'with optional param',
|
||||
[
|
||||
@@ -467,6 +491,30 @@ class UrlRuleTest extends TestCase
|
||||
['post/1/a', false],
|
||||
],
|
||||
],
|
||||
[
|
||||
'multiple params with special chars',
|
||||
[
|
||||
'pattern' => 'post/<page-number:\d+>/<per_page:\d+>/<author.login>',
|
||||
'route' => 'post/index',
|
||||
],
|
||||
[
|
||||
['post/1/25/yiiuser', 'post/index', ['page-number' => '1', 'per_page' => '25', 'author.login' => 'yiiuser']],
|
||||
['post/1/25', false],
|
||||
['post', false],
|
||||
],
|
||||
],
|
||||
[
|
||||
'multiple params with special chars',
|
||||
[
|
||||
'pattern' => 'post/<1page-number:\d+>/<-per_page:\d+>/<_author.login>',
|
||||
'route' => 'post/index',
|
||||
],
|
||||
[
|
||||
['post/1/25/yiiuser', 'post/index', ['1page-number' => '1', '-per_page' => '25', '_author.login' => 'yiiuser']],
|
||||
['post/1/25', false],
|
||||
['post', false],
|
||||
],
|
||||
],
|
||||
[
|
||||
'with optional param',
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user