forked from laruence/yaf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
011.phpt
39 lines (34 loc) · 778 Bytes
/
011.phpt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
--TEST--
Check for Yaf_Route_Rewrite
--SKIPIF--
<?php if (!extension_loaded("yaf")) print "skip"; ?>
--INI--
yaf.use_namespace=0
--FILE--
<?php
$request = new Yaf_Request_Http("/subdir/ap/1.2/name/value", "/subdir");
$router = new Yaf_Router();
$route = new Yaf_Route_Rewrite(
"/subdir/:name/:version",
array(
"action" => "version",
)
);
$router->addRoute("subdir", $route)->addRoute("ap", new Yaf_Route_Rewrite(
"/ap/:version/*",
array(
"action" => 'ap',
)
))->route($request);
var_dump($router->getCurrentRoute());
var_dump($request->getParam('version'));
var_dump($request->getActionName());
var_dump($request->getControllerName());
var_dump($request->getParam('name'));
?>
--EXPECTF--
string(2) "ap"
string(3) "1.2"
string(2) "ap"
NULL
string(5) "value"