diff options
Diffstat (limited to 'tests')
25 files changed, 125 insertions, 261 deletions
diff --git a/tests/FunctionalTests/features.php b/tests/FunctionalTests/features.php new file mode 100644 index 00000000..71c8ce3a --- /dev/null +++ b/tests/FunctionalTests/features.php @@ -0,0 +1,39 @@ +<?php + +require('config.php'); +header("Content-Type: text/html; charset=UTF-8"); +class BrowserTestConfig extends PradoTestConfig +{ + //functional test groups + public function unit_test_groups() + { + $groups = array(); + + //tests for quickstart samples + $this->get_directories(dirname(__FILE__).'/features/tests', $groups); + + return $groups; + } + + protected function get_directories($base,&$groups) + { + $groups[] = realpath($base); + $dirs = new DirectoryIterator($base); + foreach($dirs as $dir) + if(!$dir->isDot() && $dir->isDir() + && !preg_match("/\.svn/", $dir->getPathName())) + $this->get_directories($dir->getPathName(), $groups); + } +} + + +$root = dirname(__FILE__); +$server = SimpleSeleniumProxyServer::getInstance($root); + +$tester = new PradoSimpleTester(new BrowserTestConfig()); +$browser_tests = $tester->getTests(); +$browser_tests->run(new SimpleReporter()); + +$server->handleRequest(); + +?>
\ No newline at end of file diff --git a/tests/FunctionalTests/features/index.php b/tests/FunctionalTests/features/index.php new file mode 100644 index 00000000..fe127639 --- /dev/null +++ b/tests/FunctionalTests/features/index.php @@ -0,0 +1,8 @@ +<?php + +require_once(dirname(__FILE__).'/../../../framework/prado.php'); + +$app=new TApplication; +$app->run(); + +?>
\ No newline at end of file diff --git a/tests/FunctionalTests/features/protected/application.xml b/tests/FunctionalTests/features/protected/application.xml new file mode 100644 index 00000000..642152cc --- /dev/null +++ b/tests/FunctionalTests/features/protected/application.xml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8"?>
+
+<application id="FeatureTests" Mode="Debug">
+ <services>
+ <service id="page" class="TPageService" DefaultPage="FeatureList">
+ <pages MasterClass="Application.controls.Layout" />
+ </service>
+ </services>
+</application>
\ No newline at end of file diff --git a/tests/FunctionalTests/protected/pages/Layout.php b/tests/FunctionalTests/features/protected/controls/Layout.php index 2c6e02d6..2c6e02d6 100644 --- a/tests/FunctionalTests/protected/pages/Layout.php +++ b/tests/FunctionalTests/features/protected/controls/Layout.php diff --git a/tests/FunctionalTests/protected/pages/Home.zh_CN.page b/tests/FunctionalTests/features/protected/controls/Layout.tpl index df7a9cc0..18482377 100644 --- a/tests/FunctionalTests/protected/pages/Home.zh_CN.page +++ b/tests/FunctionalTests/features/protected/controls/Layout.tpl @@ -1,11 +1,10 @@ -<!DOCTYPE HTML PUBLIC
- "-//W3C//DTD XHTML 1.0 Strict//EN"
+<!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">
-<head>
+<com:THead Title="PRADO Feature Tests">
<meta http-equiv="Content-type" content="text/html; charset=UTF-8" />
- <title>Prado Functional Tests (zh_CN)</title>
<style type="text/css">
/*<![CDATA[*/
body
@@ -19,16 +18,10 @@ }
/*]]>*/
</style>
-</head>
-
+</com:THead>
<body>
-
-<h1>Prado Functional Tests (zh_CN)</h1>
-
-<div class="w3c">
-<a href="http://validator.w3.org/check?uri=referer">
- Validate XHTML 1.0
-</a>
-</div>
+<com:TForm>
+<com:TContentPlaceHolder ID="Content" />
+</com:TForm>
</body>
</html>
\ No newline at end of file diff --git a/tests/FunctionalTests/protected/pages/UI/ColorPicker.page b/tests/FunctionalTests/features/protected/pages/ColorPicker.page index 3d8c46db..3d8c46db 100644 --- a/tests/FunctionalTests/protected/pages/UI/ColorPicker.page +++ b/tests/FunctionalTests/features/protected/pages/ColorPicker.page diff --git a/tests/FunctionalTests/protected/pages/UI/DatePicker.page b/tests/FunctionalTests/features/protected/pages/DatePicker.page index 4347f748..4347f748 100644 --- a/tests/FunctionalTests/protected/pages/UI/DatePicker.page +++ b/tests/FunctionalTests/features/protected/pages/DatePicker.page diff --git a/tests/FunctionalTests/features/protected/pages/FeatureList.page b/tests/FunctionalTests/features/protected/pages/FeatureList.page new file mode 100644 index 00000000..ef25ccb9 --- /dev/null +++ b/tests/FunctionalTests/features/protected/pages/FeatureList.page @@ -0,0 +1,3 @@ +<com:TContent ID="Content">
+<com:TBulletedList ID="List" DisplayMode="HyperLink"/>
+</com:TContent>
\ No newline at end of file diff --git a/tests/FunctionalTests/features/protected/pages/FeatureList.php b/tests/FunctionalTests/features/protected/pages/FeatureList.php new file mode 100644 index 00000000..7f82d34e --- /dev/null +++ b/tests/FunctionalTests/features/protected/pages/FeatureList.php @@ -0,0 +1,34 @@ +<?php
+
+class FeatureList extends TPage
+{
+ public function onLoad($param)
+ {
+ parent::onLoad($param);
+ $list=$this->getPageList(dirname(__FILE__),'');
+ $this->List->DataSource=$list;
+ $this->List->dataBind();
+ }
+
+ protected function getPageList($directory,$basePath)
+ {
+ $list=array();
+ $folder=@opendir($directory);
+ while($entry=@readdir($folder))
+ {
+ if($entry[0]==='.')
+ continue;
+ else if(is_file($directory.'/'.$entry))
+ {
+ if(($page=basename($entry,'.page'))!==$entry && strpos($page,'.')===false)
+ $list['?page='.$basePath.$page]=$basePath.$page;
+ }
+ else
+ $list=array_merge($list,$this->getPageList($directory.'/'.$entry,$basePath.$entry.'.'));
+ }
+ closedir($folder);
+ return $list;
+ }
+}
+
+?>
\ No newline at end of file diff --git a/tests/FunctionalTests/protected/pages/UI/testHtmlArea.page b/tests/FunctionalTests/features/protected/pages/HtmlArea.page index 5e9665dd..8b56f48d 100644 --- a/tests/FunctionalTests/protected/pages/UI/testHtmlArea.page +++ b/tests/FunctionalTests/features/protected/pages/HtmlArea.page @@ -3,7 +3,7 @@ <com:THtmlArea>
<prop:Options>
- plugins : "contextmenu,paste",
+ plugins : "contextmenu,paste",
language: "zh_CN"
</prop:Options>
</com:THtmlArea>
diff --git a/tests/FunctionalTests/protected/pages/I18N/BasicI18N.page b/tests/FunctionalTests/features/protected/pages/I18N/BasicI18N.page index e13eecf2..e13eecf2 100644 --- a/tests/FunctionalTests/protected/pages/I18N/BasicI18N.page +++ b/tests/FunctionalTests/features/protected/pages/I18N/BasicI18N.page diff --git a/tests/FunctionalTests/protected/pages/I18N/BasicI18N.php b/tests/FunctionalTests/features/protected/pages/I18N/BasicI18N.php index 6920f439..cac0a04e 100644 --- a/tests/FunctionalTests/protected/pages/I18N/BasicI18N.php +++ b/tests/FunctionalTests/features/protected/pages/I18N/BasicI18N.php @@ -21,7 +21,7 @@ class BasicI18N extends TPage * @author Wei Zhuo<weizhuo[at]gmail[dot]com>
* @version $Revision: 1.66 $ $Date: ${DATE} ${TIME} $
* @package ${package}
- */
+ *//*
class BasicI18NTestCase extends SeleniumTestCase
{
function setup()
@@ -41,5 +41,5 @@ class BasicI18NTestCase extends SeleniumTestCase $this->verifyTextPresent("Many things.", "");
}
}
-
+*/
?>
\ No newline at end of file diff --git a/tests/FunctionalTests/protected/pages/Home.page b/tests/FunctionalTests/features/protected/pages/I18N/Home.page index bf2830d6..9a49e3a2 100644 --- a/tests/FunctionalTests/protected/pages/Home.page +++ b/tests/FunctionalTests/features/protected/pages/I18N/Home.page @@ -1,6 +1,3 @@ <com:TContent ID="Content">
-<com:TForm>
<h1>Prado Functional Tests</h1>
-<com:TJavascriptLogger />
-</com:TForm>
</com:TContent>
\ No newline at end of file diff --git a/tests/FunctionalTests/features/protected/pages/I18N/Home.zh_CN.page b/tests/FunctionalTests/features/protected/pages/I18N/Home.zh_CN.page new file mode 100644 index 00000000..1b931cc2 --- /dev/null +++ b/tests/FunctionalTests/features/protected/pages/I18N/Home.zh_CN.page @@ -0,0 +1,3 @@ +<com:TContent ID="Content">
+<h1>Prado Functional Tests (Chinese)</h1>
+</com:TContent>
\ No newline at end of file diff --git a/tests/FunctionalTests/features/protected/pages/I18N/config.xml b/tests/FunctionalTests/features/protected/pages/I18N/config.xml new file mode 100644 index 00000000..25e26ac5 --- /dev/null +++ b/tests/FunctionalTests/features/protected/pages/I18N/config.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?>
+
+<configuration>
+ <paths>
+ <using namespace="System.I18N.*" />
+ </paths>
+ <modules>
+ <module id="globalization" class="TGlobalization">
+ <translation type="XLIFF" source="Application.pages.I18N.messages" autosave="true" cache="true" />
+ </module>
+ </modules>
+</configuration>
\ No newline at end of file diff --git a/tests/FunctionalTests/protected/pages/UI/RatingList.page b/tests/FunctionalTests/features/protected/pages/RatingList.page index 909180c7..909180c7 100644 --- a/tests/FunctionalTests/protected/pages/UI/RatingList.page +++ b/tests/FunctionalTests/features/protected/pages/RatingList.page diff --git a/tests/FunctionalTests/index.php b/tests/FunctionalTests/index.php index 7cf01abd..2cfcfd1f 100644 --- a/tests/FunctionalTests/index.php +++ b/tests/FunctionalTests/index.php @@ -5,8 +5,11 @@ Prado Functional Test Suites </title> </head> <body> -<a href="quickstart.php">Tests of QuickStart Tutorial Demo</a> -<br/> -<a href="tickets.php">Tests of Trac Tickets</a> +<h1>Prado Functional Test Suites</h1> +<ul> + <li><a href="quickstart.php">Tests of QuickStart Tutorial Demo</a></li> + <li><a href="tickets.php">Tests of Trac Tickets</a></li> + <li><a href="features.php">Tests of New Features</a> (<a href="features/index.php">list of new features</a>)</li> +</ul> </body> </html>
\ No newline at end of file diff --git a/tests/FunctionalTests/protected/application.xml b/tests/FunctionalTests/protected/application.xml deleted file mode 100644 index 53e73457..00000000 --- a/tests/FunctionalTests/protected/application.xml +++ /dev/null @@ -1,18 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?>
-
-<application id="FunctionTests" Mode="Debug">
- <paths>
- <alias id="Tests" path="." />
- <using namespace="System.I18N.*" />
- </paths>
-
- <modules>
- <module id="globalization" class="TGlobalization">
- <translation type="XLIFF" source="Tests.messages"
- autosave="true" cache="true" />
- </module>
- <module id="logger" class="System.Log.TLogRouter">
- <route class="TFileLogRoute" />
- </module>
- </modules>
-</application>
\ No newline at end of file diff --git a/tests/FunctionalTests/protected/pages/Layout.tpl b/tests/FunctionalTests/protected/pages/Layout.tpl deleted file mode 100644 index d58acd5d..00000000 --- a/tests/FunctionalTests/protected/pages/Layout.tpl +++ /dev/null @@ -1,37 +0,0 @@ -<!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 Functional 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;
- }
- /*]]>*/
- </style>
-</com:THead>
-<body>
-<com:TForm>
-<com:TContentPlaceHolder ID="Content" />
-<com:TJavascriptLogger />
-</com:TForm>
-<div class="w3c">
-<a href="http://validator.w3.org/check?uri=referer">
- Validate XHTML 1.0
-</a>
-<a href="?page=ViewSource&path=<%= str_replace('.','/', $this->Request->ServiceParameter) %>.page"
- style="margin: 0 1em;"
- onclick="window.open(this.href); return false;"
- onkeypress="window.open(this.href); return false;">View Source</a>
-</div>
-</body>
-</html>
\ No newline at end of file diff --git a/tests/FunctionalTests/protected/pages/TicketTestPage.php b/tests/FunctionalTests/protected/pages/TicketTestPage.php deleted file mode 100644 index f647f56b..00000000 --- a/tests/FunctionalTests/protected/pages/TicketTestPage.php +++ /dev/null @@ -1,14 +0,0 @@ -<?php
-
-class TicketTestPage extends TTemplateControl
-{
- public function onLoad($param)
- {
- $num = str_replace('Ticket_','',get_class($this->getPage()));
- $this->getPage()->setTitle("Verifying Ticket $num");
- $this->ticketlink->setText("Verifying Ticket $num");
- $this->ticketlink->setNavigateUrl("http://trac.pradosoft.com/ticket/{$num}");
- }
-}
-
-?>
\ No newline at end of file diff --git a/tests/FunctionalTests/protected/pages/TicketTestPage.tpl b/tests/FunctionalTests/protected/pages/TicketTestPage.tpl deleted file mode 100644 index bf2f8fab..00000000 --- a/tests/FunctionalTests/protected/pages/TicketTestPage.tpl +++ /dev/null @@ -1,45 +0,0 @@ -<!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 Functional Tests">
- <meta http-equiv="Content-type" content="text/html; charset=UTF-8" />
- <style type="text/css">
- /*<![CDATA[*/
- .defect
- {
- color: #c00;
- font-size: 1.15em;
- }
- body
- {
- font-family: Georgia, "Times New Roman", Times, serif;
- }
- .w3c
- {
- margin-top: 2em;
- display: block;
- }
- /*]]>*/
- </style>
-</com:THead>
-<body>
-<com:TForm>
-<h1><com:THyperLink ID="ticketlink" /></h1>
-
-<com:TContentPlaceHolder ID="Content" />
-<hr style="margin-top: 2em" />
-<com:TJavascriptLogger />
-</com:TForm>
-<div class="w3c">
-<a href="http://validator.w3.org/check?uri=referer">
- Validate XHTML 1.0
-</a>
-<a href="?page=ViewSource&path=<%= str_replace('.','/', $this->Request->ServiceParameter) %>.page"
- style="margin: 0 1em;"
- onclick="window.open(this.href); return false;"
- onkeypress="window.open(this.href); return false;">View Source</a>
-</div>
-</body>
-</html>
\ No newline at end of file diff --git a/tests/FunctionalTests/protected/pages/ViewSource.page b/tests/FunctionalTests/protected/pages/ViewSource.page deleted file mode 100644 index 218cc901..00000000 --- a/tests/FunctionalTests/protected/pages/ViewSource.page +++ /dev/null @@ -1,23 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
-
-<com:THead Title="PRADO QuickStart Source View">
-<meta http-equiv="content-language" content="en"/>
-</com:THead>
-
-<body>
-<com:TForm>
-<div id="sourceList">
-<com:TLiteral ID="SourceList" />
-<com:TCheckBox ID="showLineNumbers" AutoPostBack="true" />
-<com:TLabel For="showLineNumbers">Show Line Numbers</com:TLabel>
-</div>
-<div id="sourceView">
-<com:TTextHighlighter ID="Highlighter" CssClass="source"
- ShowLineNumbers="<%# $this->Page->showLineNumbers->Checked %>" >
-<com:TLiteral ID="SourceView" />
-</com:TTextHighlighter>
-</com:TForm>
-</div>
-</body>
-</html>
\ No newline at end of file diff --git a/tests/FunctionalTests/protected/pages/ViewSource.php b/tests/FunctionalTests/protected/pages/ViewSource.php deleted file mode 100644 index 84f39161..00000000 --- a/tests/FunctionalTests/protected/pages/ViewSource.php +++ /dev/null @@ -1,85 +0,0 @@ -<?php
-
-class ViewSource extends TPage
-{
- private $_path=null;
- private $_fullPath=null;
- private $_fileType=null;
-
- protected function isFileTypeAllowed($extension)
- {
- return in_array($extension,array('tpl','page','php'));
- }
-
- protected function getFileExtension($fileName)
- {
- if(($pos=strrpos($fileName,'.'))===false)
- return '';
- else
- return substr($fileName,$pos+1);
- }
-
- public function onLoad($param)
- {
- parent::onLoad($param);
- $path=$this->Request->Items['path'];
- $fullPath=realpath($this->Service->BasePath.'/'.$path);
- $fileExt=$this->getFileExtension($fullPath);
- if($fullPath!==false && is_file($fullPath) && strpos($fullPath,$this->Service->BasePath)!==false)
- {
- if($this->isFileTypeAllowed($fileExt))
- {
- $this->_fullPath=strtr($fullPath,'\\','/');
- $this->_path=strtr(substr($fullPath,strlen($this->Service->BasePath)),'\\','/');
- }
- }
- if($this->_fullPath===null)
- throw new THttpException(500,'File Not Found: %s',$path);
- $basePath=dirname($this->_fullPath);
- if($dh=opendir($basePath))
- {
- $str="<h2>{$this->_path}</h2>\n";
- while(($file=readdir($dh))!==false)
- {
- if(is_file($basePath.'/'.$file))
- {
- $fileType=$this->getFileExtension($basePath.'/'.$file);
- if($this->isFileTypeAllowed($fileType))
- {
- if($fileType==='tpl' || $fileType==='page')
- $type='Template file';
- else
- $type='Class file';
- $path='/'.ltrim(strtr(dirname($this->_path),'\\','/').'/'.$file,'/');
- $str.="$type: <a href=\"?page=ViewSource&path=$path\">$file</a><br/>";
- }
- }
-
- }
- closedir($dh);
- $this->SourceList->Text=$str;
- }
-
- switch($fileExt)
- {
- case 'page' :
- case 'tpl' :
- $this->Highlighter->Language='prado';
- break;
- case 'php' :
- $this->Highlighter->Language='php';
- break;
- case 'xml' :
- $this->Highlighter->Language='xml';
- break;
- default :
- $this->Highlighter->Language='html';
- break;
- }
-
- $this->SourceView->Text=file_get_contents($this->_fullPath);
- $this->dataBind();
- }
-}
-
-?>
\ No newline at end of file diff --git a/tests/FunctionalTests/protected/pages/config.xml b/tests/FunctionalTests/protected/pages/config.xml deleted file mode 100644 index b7007323..00000000 --- a/tests/FunctionalTests/protected/pages/config.xml +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?>
-
-<configuration>
- <paths>
- <alias id="Pages" path="." />
- <using namespace="Pages.UI.*" />
- </paths>
- <pages MasterClass="Pages.Layout">
- <page id="ViewSource" MasterClass="" />
- </pages>
-</configuration>
\ No newline at end of file diff --git a/tests/FunctionalTests/tickets/application.xml b/tests/FunctionalTests/tickets/application.xml deleted file mode 100644 index e973d37d..00000000 --- a/tests/FunctionalTests/tickets/application.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?>
-
-<application id="FunctionTests" Mode="Debug">
-</application>
\ No newline at end of file |