forked from laruence/yaf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
012.phpt
42 lines (37 loc) · 768 Bytes
/
012.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
40
41
42
--TEST--
Check for Yaf_Route_Regex
--SKIPIF--
<?php if (!extension_loaded("yaf")) print "skip"; ?>
--FILE--
<?php
$request = new Yaf_Request_Http("/subdir/ap/1.2/name/value", "/subdir");
$router = new Yaf_Router();
$route = new Yaf_Route_regex(
"#/subdir/(.*)#",
array(
"action" => "version",
),
array(
)
);
$router->addRoute("subdir", $route)->addRoute("ap", new Yaf_Route_Regex(
"#^/ap/([^/]*)/*#i",
array(
"action" => 'ap',
),
array(
1 => 'version',
)
))->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
NULL