From 618c80b1986dccc96d0fca09c4bd00888baa2c6f Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Sat, 14 Mar 2020 11:10:16 +0800 Subject: [PATCH] Added tests --- package.xml | 1 + tests/088.phpt | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 tests/088.phpt diff --git a/package.xml b/package.xml index 263cca62..a34ad73f 100644 --- a/package.xml +++ b/package.xml @@ -194,6 +194,7 @@ + diff --git a/tests/088.phpt b/tests/088.phpt new file mode 100644 index 00000000..4d4d2bc8 --- /dev/null +++ b/tests/088.phpt @@ -0,0 +1,48 @@ +--TEST-- +Check for Yaf_Route_Rwrite with arbitrary urls +--SKIPIF-- + +--INI-- +yaf.use_namespace=0 +--FILE-- + ":name", + "action" => ":subname" + ) +); + +foreach ($url as $u) { + $req = new Yaf_Request_Http($u); + $route->route($req); + echo $u, " : ", "m=>", $req->getModuleName(), " c=>", $req->getControllerName(), " a=>", $req->getActionName(); + if (($args = $req->getParams())) { + echo " args=>"; + foreach ($args as $k => $v) { + echo $k , "->", $v , ","; + } + } + echo "\n"; +} +?> +--EXPECT-- +/ : m=> c=> a=> +/foo : m=> c=> a=> +//foo/ : m=> c=> a=> +/foo/bar : m=> c=> a=> +/foo/// : m=> c=> a=> +/foo/cont/act : m=> c=> a=> +/foo/cont/act/ : m=> c=>cont a=>act args=>name->cont,subname->act, +/foocont/act : m=> c=> a=> +/foo/cont/act//var/value/ : m=> c=>cont a=>act args=>name->cont,subname->act,var->value, +/foo/cont/act//var/value/age : m=> c=>cont a=>act args=>name->cont,subname->act,var->value,age->, +/foo/cont/act//var/value/age/12// : m=> c=>cont a=>act args=>name->cont,subname->act,var->value,age->12,