forked from laruence/yaf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support dynmaic routing for Regex/Rewrite route
- Loading branch information
Showing
51 changed files
with
236 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
--TEST-- | ||
Check for Yaf_Route_Rewrite with dynamic mvc | ||
--SKIPIF-- | ||
<?php if (!extension_loaded("yaf")) print "skip"; ?> | ||
--FILE-- | ||
<?php | ||
$request = new Yaf_Request_Http("/subdir/ctl/act/name/value"); | ||
|
||
$router = new Yaf_Router(); | ||
|
||
$route = new Yaf_Route_Rewrite( | ||
"/subdir/:con/:a/*", | ||
array( | ||
"module" => "m", | ||
"controller" => ":1", | ||
"action" => ":a", | ||
) | ||
); | ||
|
||
$router->addRoute("subdir", $route)->addRoute("yaf", new Yaf_Route_Rewrite( | ||
"/yaf/:action/*", | ||
array( | ||
"action" => ':action', | ||
"controller" => "index", | ||
) | ||
))->route($request); | ||
|
||
var_dump($router->getCurrentRoute()); | ||
print_r($request->getParams()); | ||
var_dump($request->getActionName()); | ||
var_dump($request->getControllerName()); | ||
var_dump($request->getModuleName()); | ||
|
||
$request = new Yaf_Request_Http("/yaf/act/name/value"); | ||
$router->route($request); | ||
|
||
var_dump($router->getCurrentRoute()); | ||
print_r($request->getParams()); | ||
var_dump($request->getActionName()); | ||
var_dump($request->getControllerName()); | ||
var_dump($request->getModuleName()); | ||
|
||
?> | ||
--EXPECTF-- | ||
string(6) "subdir" | ||
Array | ||
( | ||
[con] => ctl | ||
[a] => act | ||
[name] => value | ||
) | ||
string(3) "act" | ||
NULL | ||
string(1) "m" | ||
string(3) "yaf" | ||
Array | ||
( | ||
[action] => act | ||
[name] => value | ||
) | ||
string(3) "act" | ||
string(5) "index" | ||
NULL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
--TEST-- | ||
Check for Yaf_Route_Regex with dynamic mvc | ||
--SKIPIF-- | ||
<?php if (!extension_loaded("yaf")) print "skip"; ?> | ||
--FILE-- | ||
<?php | ||
$request = new Yaf_Request_Http("/subdir/ctl/act/name/value"); | ||
|
||
$router = new Yaf_Router(); | ||
|
||
$route = new Yaf_Route_Regex( | ||
"#subdir/(.*?)/(.*?)/.*#", | ||
array( | ||
"module" => "m", | ||
"controller" => ":c", | ||
"action" => ":a", | ||
), | ||
array( | ||
1 => "c", | ||
2 => "a", | ||
) | ||
); | ||
|
||
$router->addRoute("subdir", $route)->addRoute("yaf", new Yaf_Route_Regex( | ||
"#yaf/(.*?)/.*#", | ||
array( | ||
"action" => ':action', | ||
"controller" => "index", | ||
), | ||
array( | ||
1 => "action", | ||
) | ||
))->route($request); | ||
|
||
var_dump($router->getCurrentRoute()); | ||
print_r($request->getParams()); | ||
var_dump($request->getActionName()); | ||
var_dump($request->getControllerName()); | ||
var_dump($request->getModuleName()); | ||
|
||
$request = new Yaf_Request_Http("/yaf/act/name/value"); | ||
$router->route($request); | ||
|
||
var_dump($router->getCurrentRoute()); | ||
print_r($request->getParams()); | ||
var_dump($request->getActionName()); | ||
var_dump($request->getControllerName()); | ||
var_dump($request->getModuleName()); | ||
|
||
?> | ||
--EXPECTF-- | ||
string(6) "subdir" | ||
Array | ||
( | ||
[c] => ctl | ||
[a] => act | ||
) | ||
string(3) "act" | ||
string(3) "ctl" | ||
string(1) "m" | ||
string(3) "yaf" | ||
Array | ||
( | ||
[action] => act | ||
) | ||
string(3) "act" | ||
string(5) "index" | ||
NULL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.