summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authortof <>2007-06-20 11:20:29 +0000
committertof <>2007-06-20 11:20:29 +0000
commitf863d96b3eabcb639265f037932a932cf0269f71 (patch)
tree458434917589fbe83db7a24fcaaf8cc1e598c1e3 /tests
parent186da7689fbefd22726c5b751b60f7aeccba6a98 (diff)
Add a test for THttpRequest with a TUrlMapping as url manager
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/Web/THttpRequestTest.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/unit/Web/THttpRequestTest.php b/tests/unit/Web/THttpRequestTest.php
index 3ddc557e..c71eb9b8 100644
--- a/tests/unit/Web/THttpRequestTest.php
+++ b/tests/unit/Web/THttpRequestTest.php
@@ -470,5 +470,23 @@ class THttpRequestTest extends PHPUnit_Framework_TestCase {
self::assertTrue($request->getRequestResolved());
}
+ public function testRequestWithUrlMapping () {
+ Prado::Using ('System.Web.TUrlMapping');
+ $confstr='<config><url ServiceId="testService" ServiceParameter="testServiceParam" pattern="test/{param}/?" parameters.param="\w+"/></config>';
+ $config=new TXmlDocument('1.0','utf8');
+ $config->loadFromString($confstr);
+ $module=new TUrlMapping ();
+ self::$app->setModule('friendly-url',$module);
+ if (isset ($_GET['page'])) unset ($_GET['page']); // Remove service from a previous test !
+ $_SERVER['REQUEST_URI'] = '/index.php/test/value2';
+ $_SERVER['SCRIPT_NAME'] = '/index.php';
+ $_SERVER['PHP_SELF'] = '/index.php';
+ $_SERVER['QUERY_STRING'] = '';
+ $request = new THttpRequest();
+ $request->setUrlManager('friendly-url');
+ $request->init(null);
+ $module->init ($config);
+ self::assertEquals('testService', $request->resolveRequest(array ('page', 'testService')));
+ }
}
?> \ No newline at end of file