From 0c32dad370fb228c36baddd6d7af295aff28f7e8 Mon Sep 17 00:00:00 2001
From: mikl <>
Date: Wed, 15 Oct 2008 18:07:16 +0000
Subject: Fixed #922

---
 .../FunctionalTests/tickets/protected/application.xml  |  3 ++-
 .../tickets/protected/pages/Ticket922.page             | 12 ++++++++++++
 .../tickets/protected/pages/Ticket922.php              | 13 +++++++++++++
 .../tickets/tests/Ticket922TestCase.php                | 18 ++++++++++++++++++
 4 files changed, 45 insertions(+), 1 deletion(-)
 create mode 100644 tests/FunctionalTests/tickets/protected/pages/Ticket922.page
 create mode 100644 tests/FunctionalTests/tickets/protected/pages/Ticket922.php
 create mode 100644 tests/FunctionalTests/tickets/tests/Ticket922TestCase.php

(limited to 'tests')

diff --git a/tests/FunctionalTests/tickets/protected/application.xml b/tests/FunctionalTests/tickets/protected/application.xml
index 29273a2f..113b8455 100644
--- a/tests/FunctionalTests/tickets/protected/application.xml
+++ b/tests/FunctionalTests/tickets/protected/application.xml
@@ -1,8 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <application id="TicketTests" Mode="Debug">
 <modules>
-	<module id="friendly-url" class="System.Web.TUrlMapping">
+	<module id="friendly-url" class="System.Web.TUrlMapping" EnableCustomUrl="True">
 		<url ServiceID="testService" ServiceParameter="ticket653" pattern="/ticket653/?" />
+		<url ServiceParameter="Ticket922" pattern="/ticket922/{text}" parameters.text=".*" />
 	</module>
 	<module id="request" class="THttpRequest" UrlManager="friendly-url"/>
 </modules>
diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket922.page b/tests/FunctionalTests/tickets/protected/pages/Ticket922.page
new file mode 100644
index 00000000..87932680
--- /dev/null
+++ b/tests/FunctionalTests/tickets/protected/pages/Ticket922.page
@@ -0,0 +1,12 @@
+<com:TContent ID="Content">
+
+<h1>Problem with TUrlMapping and urlencoding</h1>
+
+Enter a string with spaces that will be used as URL parameter
+<com:TTextBox ID="Text" />
+<com:TButton Text="Perform redirect" OnClick="processString" />
+
+<br />
+Decoded String:
+<com:TLabel ID="Result" />
+</com:TContent>
diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket922.php b/tests/FunctionalTests/tickets/protected/pages/Ticket922.php
new file mode 100644
index 00000000..52d4e411
--- /dev/null
+++ b/tests/FunctionalTests/tickets/protected/pages/Ticket922.php
@@ -0,0 +1,13 @@
+<?php
+class Ticket922 extends TPage {
+    public function processString($sender,$param) {
+        $text = $this->Text->Text;
+        $url= $this->getService()->constructUrl('Ticket922', array('text'=>$text));
+        $this->getResponse()->redirect($url);
+    }
+
+    public function onLoad($param) {
+        if ($this->Request->contains('text'))
+            $this->Result->setText($this->Request->itemAt('text'));
+    }
+}
diff --git a/tests/FunctionalTests/tickets/tests/Ticket922TestCase.php b/tests/FunctionalTests/tickets/tests/Ticket922TestCase.php
new file mode 100644
index 00000000..8420c10d
--- /dev/null
+++ b/tests/FunctionalTests/tickets/tests/Ticket922TestCase.php
@@ -0,0 +1,18 @@
+<?php
+
+class Ticket922TestCase extends SeleniumTestCase
+{
+	function test()
+	{
+		$this->open('tickets/index.php?page=Ticket922');
+		$this->assertTitle("Verifying Ticket 922");
+		$base = 'ctl0_Content_';
+		
+		$this->type($base.'Text', 'two words');
+		$this->clickAndWait('ctl0$Content$ctl0');
+		$this->assertText($base.'Result','two words');
+
+	}
+}
+
+?>
-- 
cgit v1.2.3