forked from laruence/yaf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
065.phpt
40 lines (32 loc) · 770 Bytes
/
065.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
--TEST--
Yaf_Route_Regex map is optional
--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();
$router->addConfig(
array(
array(
"type" => "regex",
"match" => "#^/ap/([^/]*)/*#i",
"route" => array(
array(
"action" => 'ap',
),
),
)
)
)->route($request);
var_dump($router->getCurrentRoute());
var_dump($request->getActionName());
$router->addRoute("regex", new Yaf_Route_Regex("#^/ap/([^/]*)/*#i", array("action" => "ap")))->route($request);
var_dump($router->getCurrentRoute());
var_dump($request->getActionName());
?>
--EXPECT--
int(0)
NULL
string(5) "regex"
string(2) "ap"