summaryrefslogtreecommitdiff
path: root/tests/FunctionalTests/issues
diff options
context:
space:
mode:
authorctrlaltca <ctrlaltca@gmail.com>2014-08-26 16:59:21 +0200
committerctrlaltca <ctrlaltca@gmail.com>2014-08-26 16:59:21 +0200
commit74b31be9515eddfa63005d6760614badfaba9fea (patch)
tree47c952901dcb5eccd6dd8b7c6ee7e0b6bf176510 /tests/FunctionalTests/issues
parent2b11341614ac4a15be697fa8acad07055154ac54 (diff)
parent0c5026b55cde5c104f10686afd8b441568175d38 (diff)
Merge pull request #530 from pradosoft/prado-3.2.43.2.4prado-3.2
Backports for Prado 3.2.4
Diffstat (limited to 'tests/FunctionalTests/issues')
-rwxr-xr-xtests/FunctionalTests/issues/assets/.gitignore2
-rwxr-xr-xtests/FunctionalTests/issues/index.php6
-rwxr-xr-xtests/FunctionalTests/issues/protected/application.xml12
-rwxr-xr-xtests/FunctionalTests/issues/protected/controls/Layout.php6
-rwxr-xr-xtests/FunctionalTests/issues/protected/controls/Layout.tpl32
-rwxr-xr-xtests/FunctionalTests/issues/protected/pages/Issue504.page14
-rwxr-xr-xtests/FunctionalTests/issues/protected/pages/Issue504.php14
-rw-r--r--tests/FunctionalTests/issues/protected/pages/Issue516.page50
-rw-r--r--tests/FunctionalTests/issues/protected/pages/Issue516.php115
-rwxr-xr-xtests/FunctionalTests/issues/protected/pages/Issue524.page7
-rwxr-xr-xtests/FunctionalTests/issues/protected/pages/Issue524.php20
-rwxr-xr-xtests/FunctionalTests/issues/protected/runtime/.gitignore2
-rwxr-xr-xtests/FunctionalTests/issues/tests/Issue504TestCase.php16
-rw-r--r--tests/FunctionalTests/issues/tests/Issue516TestCase.php37
-rwxr-xr-xtests/FunctionalTests/issues/tests/Issue524TestCase.php20
15 files changed, 353 insertions, 0 deletions
diff --git a/tests/FunctionalTests/issues/assets/.gitignore b/tests/FunctionalTests/issues/assets/.gitignore
new file mode 100755
index 00000000..d6b7ef32
--- /dev/null
+++ b/tests/FunctionalTests/issues/assets/.gitignore
@@ -0,0 +1,2 @@
+*
+!.gitignore
diff --git a/tests/FunctionalTests/issues/index.php b/tests/FunctionalTests/issues/index.php
new file mode 100755
index 00000000..77ddf367
--- /dev/null
+++ b/tests/FunctionalTests/issues/index.php
@@ -0,0 +1,6 @@
+<?php
+
+require_once(dirname(__FILE__).'/../../../framework/prado.php');
+
+$app=new TApplication;
+$app->run();
diff --git a/tests/FunctionalTests/issues/protected/application.xml b/tests/FunctionalTests/issues/protected/application.xml
new file mode 100755
index 00000000..a396dea5
--- /dev/null
+++ b/tests/FunctionalTests/issues/protected/application.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<application id="FeatureTests" Mode="Debug">
+ <paths>
+ <using namespace="Application.controls.*" />
+ </paths>
+ <services>
+ <service id="page" class="TPageService">
+ <pages MasterClass="Application.controls.Layout" />
+ </service>
+ </services>
+</application> \ No newline at end of file
diff --git a/tests/FunctionalTests/issues/protected/controls/Layout.php b/tests/FunctionalTests/issues/protected/controls/Layout.php
new file mode 100755
index 00000000..0ac4d6b3
--- /dev/null
+++ b/tests/FunctionalTests/issues/protected/controls/Layout.php
@@ -0,0 +1,6 @@
+<?php
+
+class Layout extends TTemplateControl
+{
+
+}
diff --git a/tests/FunctionalTests/issues/protected/controls/Layout.tpl b/tests/FunctionalTests/issues/protected/controls/Layout.tpl
new file mode 100755
index 00000000..5234c565
--- /dev/null
+++ b/tests/FunctionalTests/issues/protected/controls/Layout.tpl
@@ -0,0 +1,32 @@
+<!DOCTYPE html PUBLIC
+ "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<com:THead Title="PRADO Feature Tests">
+ <meta http-equiv="Content-type" content="text/html; charset=UTF-8" />
+ <style type="text/css">
+ /*<![CDATA[*/
+ body
+ {
+ font-family: Georgia, "Times New Roman", Times, serif;
+ }
+ .w3c
+ {
+ margin-top: 2em;
+ display: block;
+ }
+ .required
+ {
+ border:1px solid red;
+ background-color: #fdd;
+ }
+ /*]]>*/
+ </style>
+</com:THead>
+<body>
+<com:TForm>
+<com:TContentPlaceHolder ID="Content" />
+</com:TForm>
+</body>
+</html> \ No newline at end of file
diff --git a/tests/FunctionalTests/issues/protected/pages/Issue504.page b/tests/FunctionalTests/issues/protected/pages/Issue504.page
new file mode 100755
index 00000000..ed29b358
--- /dev/null
+++ b/tests/FunctionalTests/issues/protected/pages/Issue504.page
@@ -0,0 +1,14 @@
+ <com:TContent ID="Content">
+ <h1>Issue 504 Test</h1>
+
+ <com:TPanel ID="dlg" DefaultButton="subPanel.buttonOk" >
+ <com:TTextBox ID="textbox1" />
+ <com:TButton ID="buttonDummy" OnCommand="buttonDummyClick" Text="Dummy button" />
+ Panel Content
+ <com:TLabel ID="label1" />
+ <com:TPanel ID="subPanel" >
+ <com:TButton ID="buttonOk" OnCommand="buttonOkClick" Text="Ok button" />
+ </com:TPanel>
+ </com:TPanel>
+ </com:TContent>
+
diff --git a/tests/FunctionalTests/issues/protected/pages/Issue504.php b/tests/FunctionalTests/issues/protected/pages/Issue504.php
new file mode 100755
index 00000000..dd12c960
--- /dev/null
+++ b/tests/FunctionalTests/issues/protected/pages/Issue504.php
@@ -0,0 +1,14 @@
+<?php
+
+class Issue504 extends TPage
+{
+ function buttonOkClick($sender, $param)
+ {
+ $this->label1->Text="buttonOkClick";
+ }
+
+ function buttonDummyClick($sender, $param)
+ {
+ $this->label1->Text="buttonDummyClick";
+ }
+}
diff --git a/tests/FunctionalTests/issues/protected/pages/Issue516.page b/tests/FunctionalTests/issues/protected/pages/Issue516.page
new file mode 100644
index 00000000..c922c6e1
--- /dev/null
+++ b/tests/FunctionalTests/issues/protected/pages/Issue516.page
@@ -0,0 +1,50 @@
+ <com:TContent ID="Content">
+
+<h1>Issue 516 Test</h1>
+
+<com:TActiveDataGrid
+ Width="800px"
+ CellPadding="2"
+ ID="DataGrid"
+ DataKeyField="ISBN"
+ AutoGenerateColumns="false"
+ HeaderStyle.BackColor="black"
+ HeaderStyle.ForeColor="white"
+ ItemStyle.BackColor="#BFCFFF"
+ ItemStyle.Font.Italic="true"
+ AlternatingItemStyle.BackColor="#E6ECFF"
+ EditItemStyle.BackColor="lightyellow"
+ OnEditCommand="editItem"
+ OnUpdateCommand="saveItem"
+ OnCancelCommand="cancelItem"
+ >
+ <com:TTemplateColumn
+ ID="BookTitleColumn"
+ HeaderText="Book Title"
+ HeaderStyle.Width="400px"
+ >
+ <prop:ItemTemplate>
+ <com:TLiteral Text="<%# $this->Parent->Data['title'] %>" Encode="true" />
+ </prop:ItemTemplate>
+ <prop:EditItemTemplate>
+ <com:TTextBox ID="TextBox" Text="<%# $this->Parent->Data['title'] %>" />
+ <com:TRequiredFieldValidator
+ ControlToValidate="TextBox"
+ Display="Dynamic"
+ ErrorMessage="<br/>Please provide a title."
+ ValidationGroup = "Group1"
+ />
+ </prop:EditItemTemplate>
+ </com:TTemplateColumn>
+ <com:TActiveEditCommandColumn
+ HeaderText="Edit"
+ HeaderStyle.Width="100px"
+ UpdateText="Save"
+ ItemStyle.HorizontalAlign="Center"
+ ItemStyle.Font.Italic="false"
+ ValidationGroup = "Group1"
+ />
+</com:TActiveDataGrid>
+
+ </com:TContent>
+
diff --git a/tests/FunctionalTests/issues/protected/pages/Issue516.php b/tests/FunctionalTests/issues/protected/pages/Issue516.php
new file mode 100644
index 00000000..bd3e7a72
--- /dev/null
+++ b/tests/FunctionalTests/issues/protected/pages/Issue516.php
@@ -0,0 +1,115 @@
+<?php
+
+Prado::using('System.Web.UI.ActiveControls.*');
+
+class Issue516 extends TPage
+{
+ private $_data=null;
+
+ protected function getData()
+ {
+ if($this->_data===null)
+ $this->loadData();
+ return $this->_data;
+ }
+
+ protected function loadData()
+ {
+ // We use viewstate keep track of data.
+ // In real applications, data should come from database using an SQL SELECT statement.
+ // In the following tabular data, field 'ISBN' is the primary key.
+ // All update and delete operations should come with an 'id' value in order to go through.
+ if(($this->_data=$this->getViewState('Data',null))===null)
+ {
+ $this->_data=array(
+ array(
+ 'ISBN'=>'0596007124',
+ 'title'=>'',
+ ),
+ array(
+ 'ISBN'=>'0201633612',
+ 'title'=>'Design Patterns: Elements of Reusable Object-Oriented Software',
+ ),
+ array(
+ 'ISBN'=>'0321247140',
+ 'title'=>'Design Patterns Explained : A New Perspective on Object-Oriented Design',
+ ),
+ array(
+ 'ISBN'=>'0201485672',
+ 'title'=>'Refactoring: Improving the Design of Existing Code',
+ ),
+ array(
+ 'ISBN'=>'0321213351',
+ 'title'=>'Refactoring to Patterns',
+ ),
+ array(
+ 'ISBN'=>'0735619670',
+ 'title'=>'Code Complete',
+ ),
+ array(
+ 'ISBN'=>'0321278658 ',
+ 'title'=>'Extreme Programming Explained : Embrace Change',
+ ),
+ );
+ $this->saveData();
+ }
+ }
+
+ protected function saveData()
+ {
+ $this->setViewState('Data',$this->_data);
+ }
+
+ protected function updateBook($isbn,$title)
+ {
+ // In real applications, data should be saved to database using an SQL UPDATE statement
+ if($this->_data===null)
+ $this->loadData();
+ $updateRow=null;
+ foreach($this->_data as $index=>$row)
+ if($row['ISBN']===$isbn)
+ $updateRow=&$this->_data[$index];
+ if($updateRow!==null)
+ {
+ $updateRow['title']=$title;
+ $this->saveData();
+ }
+ }
+
+ public function onLoad($param)
+ {
+ parent::onLoad($param);
+ if(!$this->IsPostBack && !$this->IsCallBack)
+ {
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+ }
+
+ public function editItem($sender,$param)
+ {
+ $this->DataGrid->EditItemIndex=$param->Item->ItemIndex;
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+
+ public function saveItem($sender,$param)
+ {
+ $item=$param->Item;
+ $this->updateBook(
+ $this->DataGrid->DataKeys[$item->ItemIndex], // ISBN
+ $item->BookTitleColumn->TextBox->Text // title
+ );
+ $this->DataGrid->EditItemIndex=-1;
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+
+ public function cancelItem($sender,$param)
+ {
+ $this->DataGrid->EditItemIndex=-1;
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+
+}
diff --git a/tests/FunctionalTests/issues/protected/pages/Issue524.page b/tests/FunctionalTests/issues/protected/pages/Issue524.page
new file mode 100755
index 00000000..08ac1814
--- /dev/null
+++ b/tests/FunctionalTests/issues/protected/pages/Issue524.page
@@ -0,0 +1,7 @@
+<com:TContent ID="Content">
+ <h1>Issue 524 Test</h1>
+ <com:TTextBox ID="textbox1" />
+ <com:TActiveButton ID="buttonOk" Text="Ok button" />
+ <com:TActiveCustomValidator ID="Validator" ControlToValidate="textbox1" OnServerValidate="validateText" Text="Input is invalid." />
+</com:TContent>
+
diff --git a/tests/FunctionalTests/issues/protected/pages/Issue524.php b/tests/FunctionalTests/issues/protected/pages/Issue524.php
new file mode 100755
index 00000000..851ff45a
--- /dev/null
+++ b/tests/FunctionalTests/issues/protected/pages/Issue524.php
@@ -0,0 +1,20 @@
+<?php
+
+Prado::using('System.Web.UI.ActiveControls.*');
+
+class Issue524 extends TPage
+{
+
+ public function __construct() {
+ Prado::getApplication()->getGlobalization()->setCharset('ISO-8859-1');
+ parent::__construct();
+ }
+
+ public function validateText($sender, $param)
+ {
+ $param->IsValid = false;
+ $iso8859text=iconv('utf-8', 'iso-8859-1', 'fünf');
+ $this->Validator->ErrorMessage = $iso8859text;
+ }
+
+}
diff --git a/tests/FunctionalTests/issues/protected/runtime/.gitignore b/tests/FunctionalTests/issues/protected/runtime/.gitignore
new file mode 100755
index 00000000..d6b7ef32
--- /dev/null
+++ b/tests/FunctionalTests/issues/protected/runtime/.gitignore
@@ -0,0 +1,2 @@
+*
+!.gitignore
diff --git a/tests/FunctionalTests/issues/tests/Issue504TestCase.php b/tests/FunctionalTests/issues/tests/Issue504TestCase.php
new file mode 100755
index 00000000..dff27339
--- /dev/null
+++ b/tests/FunctionalTests/issues/tests/Issue504TestCase.php
@@ -0,0 +1,16 @@
+<?php
+
+class Issue504TestCase extends PradoGenericSelenium2Test
+{
+ function test()
+ {
+ $this->url('issues/index.php?page=Issue504');
+ $this->assertContains('Issue 504 Test', $this->source());
+ $base='ctl0_Content_';
+
+ $this->byID("{$base}textbox1")->click();
+ $this->keys(PHPUnit_Extensions_Selenium2TestCase_Keys::ENTER);
+
+ $this->assertText("{$base}label1", "buttonOkClick");
+ }
+}
diff --git a/tests/FunctionalTests/issues/tests/Issue516TestCase.php b/tests/FunctionalTests/issues/tests/Issue516TestCase.php
new file mode 100644
index 00000000..363e9f84
--- /dev/null
+++ b/tests/FunctionalTests/issues/tests/Issue516TestCase.php
@@ -0,0 +1,37 @@
+<?php
+
+class Issue516TestCase extends PradoGenericSelenium2Test
+{
+ function test()
+ {
+ $this->url('issues/index.php?page=Issue516');
+ $this->assertContains('Issue 516 Test', $this->source());
+ $base='ctl0_Content_';
+ $row1='DataGrid_ctl1_';
+ $row2='DataGrid_ctl2_';
+
+ // click "edit" and check for textbox
+ $this->byID("{$base}{$row1}ctl3")->click();
+ $this->pause(800);
+ $this->assertElementPresent("{$base}{$row1}TextBox");
+ // click "save" and check for validator
+ $this->byID("{$base}{$row1}ctl3")->click();
+ $this->pause(800);
+ $this->assertEquals('Please provide a title.', $this->getElement("{$base}{$row1}ctl1")->text());
+ // click "cancel" and ensure validator has disappeared
+ $this->byID("{$base}{$row1}ctl4")->click();
+ $this->pause(800);
+ $this->assertElementNotPresent("{$base}{$row1}ctl1");
+
+ // click "edit" and check for textbox on the second row
+ $this->byID("{$base}{$row2}ctl3")->click();
+ $this->pause(800);
+ $this->assertTrue($this->getElement("{$base}{$row2}TextBox")!==null);
+ // click "save" and ensure bvalidation has been successfull
+ $this->byID("{$base}{$row2}ctl3")->click();
+ $this->pause(800);
+ $this->assertElementNotPresent("{$base}{$row2}ctl1");
+ $this->assertElementNotPresent("{$base}{$row2}TextBox");
+ $this->assertEquals('Edit', $this->getElement("{$base}{$row2}ctl3")->text());
+ }
+}
diff --git a/tests/FunctionalTests/issues/tests/Issue524TestCase.php b/tests/FunctionalTests/issues/tests/Issue524TestCase.php
new file mode 100755
index 00000000..b7b022b2
--- /dev/null
+++ b/tests/FunctionalTests/issues/tests/Issue524TestCase.php
@@ -0,0 +1,20 @@
+<?php
+
+/**
+ * Testcase for Issue 524
+ * Encoding issues caused an error when serializing the
+ * response
+ **/
+class Issue524TestCase extends PradoGenericSelenium2Test
+{
+ function test()
+ {
+ $this->url('issues/index.php?page=Issue524');
+ $this->assertContains('Issue 524 Test', $this->source());
+ $base='ctl0_Content_';
+
+ $this->byID("{$base}buttonOk")->click();
+ $this->pause(800);
+ $this->assertText("{$base}Validator", "fünf");
+ }
+}