diff options
34 files changed, 628 insertions, 241 deletions
| diff --git a/.gitattributes b/.gitattributes index d131ec36..d49db2bb 100644 --- a/.gitattributes +++ b/.gitattributes @@ -839,7 +839,6 @@ framework/Util/TDataFieldAccessor.php -text  framework/Util/TLogRouter.php -text  framework/Util/TLogger.php -text  framework/Util/TParameterModule.php -text -framework/Util/TPropelLogRoute.php -text  framework/Util/TSimpleDateFormatter.php -text  framework/Util/TVarDumper.php -text  framework/Web/Javascripts/TJSON.php -text @@ -1036,12 +1035,7 @@ tests/FunctionalTests/features/protected/pages/I18N/BasicI18N.php -text  tests/FunctionalTests/features/protected/pages/I18N/Home.page -text  tests/FunctionalTests/features/protected/pages/I18N/Home.zh_CN.page -text  tests/FunctionalTests/features/protected/pages/I18N/config.xml -text -tests/FunctionalTests/features/protected/pages/ImageMap/Home.page -text -tests/FunctionalTests/features/protected/pages/ImageMap/Home.php -text -tests/FunctionalTests/features/protected/pages/ImageMap/hotspot.jpg -text -tests/FunctionalTests/features/protected/pages/MultiView/Home.page -text  tests/FunctionalTests/features/protected/pages/RatingList.page -text -tests/FunctionalTests/features/protected/pages/Wizard/Home.page -text  tests/FunctionalTests/index.php -text  tests/FunctionalTests/quickstart.php -text  tests/FunctionalTests/quickstart/Advanced/I18N.php -text @@ -1160,6 +1154,23 @@ tests/FunctionalTests/tickets/tests/Ticket21TestCase.php -text  tests/FunctionalTests/tickets/tests/Ticket27TestCase.php -text  tests/FunctionalTests/tickets/tests/Ticket54TestCase.php -text  tests/FunctionalTests/tickets/tests/Ticket72TestCase.php -text +tests/FunctionalTests/validators.php -text +tests/FunctionalTests/validators/index.php -text +tests/FunctionalTests/validators/protected/pages/Button.page -text +tests/FunctionalTests/validators/protected/pages/Button.php -text +tests/FunctionalTests/validators/protected/pages/CheckBox.page -text +tests/FunctionalTests/validators/protected/pages/CheckBox.php -text +tests/FunctionalTests/validators/protected/pages/ImageButton.page -text +tests/FunctionalTests/validators/protected/pages/ImageButton.php -text +tests/FunctionalTests/validators/protected/pages/Layout.php -text +tests/FunctionalTests/validators/protected/pages/Layout.tpl -text +tests/FunctionalTests/validators/protected/pages/LinkButton.page -text +tests/FunctionalTests/validators/protected/pages/LinkButton.php -text +tests/FunctionalTests/validators/protected/pages/config.xml -text +tests/FunctionalTests/validators/tests/ButtonTestCase.php -text +tests/FunctionalTests/validators/tests/CheckBoxTestCase.php -text +tests/FunctionalTests/validators/tests/ImageButtonTestCase.php -text +tests/FunctionalTests/validators/tests/LinkButtonTestCase.php -text  tests/UnitTests/TODO.txt -text  tests/UnitTests/framework/Collections/utList.php -text  tests/UnitTests/framework/Collections/utMap.php -text diff --git a/framework/I18N/TI18NControl.php b/framework/I18N/TI18NControl.php index e6aed0fa..efe3ac84 100644 --- a/framework/I18N/TI18NControl.php +++ b/framework/I18N/TI18NControl.php @@ -42,7 +42,7 @@ class TI18NControl extends TControl  	 */
  	public function getCharset()
  	{
 -		$app = $this->getApplication()->getGlobalization();
 +		$app = $this->getApplication()->getGlobalization(false);
  		//instance charset
  		$charset = $this->getViewState('Charset','');
 diff --git a/framework/I18N/TNumberFormat.php b/framework/I18N/TNumberFormat.php index 4dc1e3ee..76373a8e 100644 --- a/framework/I18N/TNumberFormat.php +++ b/framework/I18N/TNumberFormat.php @@ -166,7 +166,7 @@ class TNumberFormat extends TI18NControl  	 */
  	protected function getFormattedValue()
  	{
 -		$app = $this->Application->getGlobalization();
 +		$app = $this->getApplication()->getGlobalization();
  		//initialized the default class wide formatter
  		if(is_null(self::$formatter))
  			self::$formatter = new NumberFormat($app->getCulture());
 diff --git a/framework/I18N/TTranslate.php b/framework/I18N/TTranslate.php index 0a03b506..6a30f3a6 100644 --- a/framework/I18N/TTranslate.php +++ b/framework/I18N/TTranslate.php @@ -168,7 +168,7 @@ class TTranslate extends TI18NControl  	 */
  	protected function translateText($text, $subs)
  	{
 -		$app = $this->Application->getGlobalization();
 +		$app = $this->getApplication()->getGlobalization();
  		//no translation handler provided
  		if(is_null($config = $app->getTranslationConfiguration()))
 diff --git a/framework/PradoBase.php b/framework/PradoBase.php index 08e503b1..7e631cb8 100644 --- a/framework/PradoBase.php +++ b/framework/PradoBase.php @@ -533,14 +533,14 @@ class PradoBase  	public static function localize($text, $parameters=array(), $catalogue=null, $charset=null)
  	{
  		Prado::using('System.I18N.Translation');
 -		$app = Prado::getApplication()->getGlobalization();
 +		$app = Prado::getApplication()->getGlobalization(false);
  		$params = array();
  		foreach($parameters as $key => $value)
  			$params['{'.$key.'}'] = $value;
  		//no translation handler provided
 -		if(($config = $app->getTranslationConfiguration())===null)
 +		if($app===null || ($config = $app->getTranslationConfiguration())===null)
  			return strtr($text, $params);
  		Translation::init();
 diff --git a/framework/TApplication.php b/framework/TApplication.php index 893856de..ef2fd1a1 100644 --- a/framework/TApplication.php +++ b/framework/TApplication.php @@ -755,10 +755,13 @@ class TApplication extends TComponent  	}  	/** +	 * @param boolean whether to create globalization if it does not exist  	 * @return TGlobalization globalization module  	 */ -	public function getGlobalization() +	public function getGlobalization($createIfNotExists=true)  	{ +		if($this->_globalization===null && $createIfNotExists) +			$this->_globalization=new TGlobalization;  		return $this->_globalization;  	} diff --git a/framework/Util/TPropelLogRoute.php b/framework/Util/TPropelLogRoute.php deleted file mode 100644 index eb87ca19..00000000 --- a/framework/Util/TPropelLogRoute.php +++ /dev/null @@ -1,98 +0,0 @@ -<?php
 -/**
 - * TLogger class file
 - *
 - * @author Jason Ragsdale <jrags@jasrags.net>
 - * @link http://www.pradosoft.com/
 - * @copyright Copyright © 2006 PradoSoft
 - * @license http://www.pradosoft.com/license/
 - * @version $Revision: $  $Date: $
 - * @package System.Util
 - */
 -
 -/**
 - * TPropelLogRoute class.
 - *
 - * TPropelLogRoute saves selected log messages into a Propel database.
 - * The name of the Propel database object used to represent each message
 - * is specified by {@link setPropelObjectName PropelObjectName}, which defaults
 - * to 'PradoLog'.
 - *
 - * The schema of the Propel object must be as follows (the table name can be
 - * changed to the value of {@link getPropelObjectName PropelObjectName}.
 - * <code>
 - * <table name="Pradolog">
 - * 	<column
 - * 		name="ID"
 - * 		required="true"
 - * 		primaryKey="true"
 - * 		autoIncrement="true"
 - * 		type="INTEGER" />
 - * 	<column
 - * 		name="Category"
 - * 		required="true"
 - * 		type="VARCHAR"
 - * 		size="255" />
 - * 	<column
 - * 		name="Level"
 - * 		required="true"
 - * 		type="VARCHAR"
 - * 		size="255" />
 - * 	<column
 - * 		name="Message"
 - * 		required="true"
 - * 		type="LONGVARCHAR"
 - * 		size="2048" />
 - * 	<column
 - * 		name="Time"
 - * 		required="true"
 - * 		type="DOUBLE"
 - *		size="14"
 - *		scale="4" />
 - * </table>
 - * </code>
 - *
 - * @author Jason Ragsdale <jrags@jasrags.net>
 - * @version $Revision: $  $Date: $
 - * @package System.Util
 - * @since 3.0
 - */
 -class TPropelLogRoute extends TLogRoute
 -{
 -	private $_className='Pradolog';
 -
 -	/**
 -	 * @return string the name of the Prople object used to save each log message. Defaults to 'PradoLog'.
 -	 */
 -	public function getPropelObjectName()
 -	{
 -		return $this->_className;
 -	}
 -
 -	/**
 -	 * @param string the name of the Prople object used to save each log message. The name can be in namespace format.
 -	 */
 -	public function setPropelObjectName($value)
 -	{
 -		$this->_className=$value;
 -	}
 -
 -	/**
 -	 * Saves log messages to the Propel database object.
 -	 *
 -	 * @param array $logs
 -	 */
 -	protected function processLogs($logs)
 -	{
 -		foreach($logs as $log)
 -		{
 -			$pradoLog=Prado::createComponent($this->_className);
 -			$pradoLog->setMessage($log[0]);
 -			$pradoLog->setLevel($this->getLevelName($log[1]));
 -			$pradoLog->setCategory($log[2]);
 -			$pradoLog->setTime($log[3]);
 -			$pradoLog->save();
 -		}
 -	}
 -}
 -?>
\ No newline at end of file diff --git a/framework/Web/THttpResponse.php b/framework/Web/THttpResponse.php index d4a62cc6..f76218ca 100644 --- a/framework/Web/THttpResponse.php +++ b/framework/Web/THttpResponse.php @@ -69,7 +69,7 @@ class THttpResponse extends TModule implements ITextWriter  	/**
  	 * @var string character set, e.g. UTF-8
  	 */
 -	private $_charset;
 +	private $_charset='';
  	/**
  	 * Destructor.
 @@ -285,10 +285,10 @@ class THttpResponse extends TModule implements ITextWriter  	 */
  	protected function sendContentTypeHeader()
  	{
 -		$charset = $this->getCharset();
 -		if(empty($charset) && ($globalization=$this->getApplication()->getGlobalization())!==null)
 -			$charset = $globalization->getCharset();
 -		if(!empty($charset))
 +		$charset=$this->getCharset();
 +		if($charset==='' && ($globalization=$this->getApplication()->getGlobalization(false))!==null)
 +			$charset=$globalization->getCharset();
 +		if($charset==='')
  		{
  			$header='Content-Type: '.$this->getContentType().';charset='.$charset;
  			$this->appendHeader($header);
 diff --git a/framework/Web/UI/TTemplateManager.php b/framework/Web/UI/TTemplateManager.php index 488a3a3b..6b7202f7 100644 --- a/framework/Web/UI/TTemplateManager.php +++ b/framework/Web/UI/TTemplateManager.php @@ -105,7 +105,7 @@ class TTemplateManager extends TModule  	 */
  	protected function getLocalizedTemplate($filename)
  	{
 -		if(($app=$this->getApplication()->getGlobalization())===null)
 +		if(($app=$this->getApplication()->getGlobalization(false))===null)
  			return $filename;
  		foreach($app->getLocalizedResource($filename) as $file)
  		{
 diff --git a/framework/Web/UI/WebControls/TDatePicker.php b/framework/Web/UI/WebControls/TDatePicker.php index 9bb352d6..c6a2345b 100644 --- a/framework/Web/UI/WebControls/TDatePicker.php +++ b/framework/Web/UI/WebControls/TDatePicker.php @@ -406,7 +406,7 @@ class TDatePicker extends TTextBox  	 */
  	protected function getCurrentCulture()
  	{
 -		$app = $this->getApplication()->getGlobalization();
 +		$app = $this->getApplication()->getGlobalization(false);
  		return $this->getCulture() == '' ?
  				($app ? $app->getCulture() : 'en') : $this->getCulture();
  	}
 @@ -36,21 +36,23 @@ PRADO has been tested with Apache 2.0 on both Windows XP and RedHat Linux.  </p>
  <h2>Installation</h2>
 +<p>
 +After downloading the latest PRADO release file, unpack it to a Web-accessible directory.
 +The installation is done! You will see the following subdirectories,
 +</p>
  <ul>
 -  <li>Unpack the distribution file using "unzip" command on Linux or
 -    "winzip" program on Windows.</li>
 -  <li>Copy all the files and directories under the unpacked "prado"
 -    directory to the DocumentRoot of the Web server (or a subdirectory of that).</li>
 -  <li>Browse the URL, http://<Web-server-address>/requirements/index.php, to see
 -    if your Web server configuration satisfies the requirement for using PRADO.</li>
 -  <li>The directory "framework" contains the core code of PRADO.</li>
 -  <li>The directory "docs/manual" contains the PRADO API documentation
 -    in HTML format.</li>
 +  <li>framework - contains the core code of PRADO. This directory does NOT need
 +  to reside in a Web directory.</li>
 +  <li>demos - contains several demo applications.</li>
 +  <li>docs - contains tutorials and documentation.</li>
 +  <li>requirements - contains a requirement checker script that can check if your
 +  system can run PRADO applications.</li>
  </ul>
 +
  <h2>Included Demos</h2>
  <ul>
    <li><a href="demos/helloworld/index.php">Hello World</a></li>
 -  <li><a href="demos/quickstart/index.php">Prado QuickStart Tutorial</a></li>
 +  <li><a href="demos/quickstart/index.php">Prado QuickStart Tutorial</a> (contains many small demos)</li>
    <li><a href="demos/composer/index.php">Prado Component Writer</a></li>
    <li><a href="demos/peronsal/index.php">Personal Website</a> (incomplete)</li>
  </ul>
 diff --git a/tests/FunctionalTests/features/protected/pages/ImageMap/Home.page b/tests/FunctionalTests/features/protected/pages/ImageMap/Home.page deleted file mode 100644 index 34631125..00000000 --- a/tests/FunctionalTests/features/protected/pages/ImageMap/Home.page +++ /dev/null @@ -1,43 +0,0 @@ -<com:TContent ID="Content">
 -
 -<com:TImageMap ImageUrl=<%~hotspot.jpg%> AlternateText="Navigate buttons" OnClick="buttonClicked" >
 -
 -<com:TRectangleHotSpot
 -	hotspotmode="Navigate"
 -	NavigateUrl="navigate1.htm"
 -	alternatetext="Button 1"
 -	top="30"
 -	left="175"
 -	bottom="110"
 -	right="355" />
 -
 -<com:TRectangleHotSpot
 -	hotspotmode="PostBack"
 -	PostBackValue="test"
 -	CausesValidation="true"
 -	ValidationGroup="Group1"
 -	alternatetext="Button 2"
 -	top="155"
 -	left="175"
 -	bottom="240"
 -	right="355" />
 -
 -<com:TRectangleHotSpot
 -	hotspotmode="Inactive"
 -	NavigateUrl="navigate3.htm"
 -	alternatetext="Button 3"
 -	top="285"
 -	left="175"
 -	bottom="365"
 -	right="355" />
 -
 -</com:TImageMap>
 -
 -<com:TTextBox ID="TextBox" />
 -<com:TRequiredFieldValidator
 -	ValidationGroup="Group1"
 -	EnableClientScript="true"
 -	ControlToValidate="TextBox"
 -	Text="required" />
 -
 -</com:TContent>
\ No newline at end of file diff --git a/tests/FunctionalTests/features/protected/pages/ImageMap/Home.php b/tests/FunctionalTests/features/protected/pages/ImageMap/Home.php deleted file mode 100644 index 36ec7e9c..00000000 --- a/tests/FunctionalTests/features/protected/pages/ImageMap/Home.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php
 -
 -class Home extends TPage
 -{
 -	public function buttonClicked($sender,$param)
 -	{
 -		//echo $param->getPostBackValue();
 -		print_r($param);
 -	}
 -}
 -
 -?>
\ No newline at end of file diff --git a/tests/FunctionalTests/features/protected/pages/ImageMap/hotspot.jpg b/tests/FunctionalTests/features/protected/pages/ImageMap/hotspot.jpgBinary files differ deleted file mode 100644 index 3491813f..00000000 --- a/tests/FunctionalTests/features/protected/pages/ImageMap/hotspot.jpg +++ /dev/null diff --git a/tests/FunctionalTests/features/protected/pages/MultiView/Home.page b/tests/FunctionalTests/features/protected/pages/MultiView/Home.page deleted file mode 100644 index 30ee1bbe..00000000 --- a/tests/FunctionalTests/features/protected/pages/MultiView/Home.page +++ /dev/null @@ -1,24 +0,0 @@ -<com:TContent ID="Content">
 -
 -<com:TMultiView ActiveViewIndex="2">
 -  <com:TView ID="View1">
 -  view 1
 -  <com:TTextBox Text="view 1" />
 -  <com:TButton Text="see view 2" CommandName="SwitchViewIndex" CommandParameter="1" />
 -  <com:TButton Text="see view 3" CommandName="SwitchViewIndex" CommandParameter="2" />
 -  </com:TView>
 -  <com:TView ID="View2">
 -  view 2
 -  <com:TTextBox Text="view 2" />
 -  <com:TButton Text="see view 1" CommandName="SwitchViewID" CommandParameter="View1" />
 -  <com:TButton Text="see view 3" CommandName="NextView" />
 -  </com:TView>
 -  <com:TView ID="View3">
 -  view 3
 -  <com:TTextBox Text="view 3" />
 -  <com:TButton Text="see view 1" CommandName="SwitchViewIndex" CommandParameter="0" />
 -  <com:TButton Text="see view 2" CommandName="PreviousView" />
 -  </com:TView>
 -</com:TMultiView>
 -
 -</com:TContent>
\ No newline at end of file diff --git a/tests/FunctionalTests/features/protected/pages/Wizard/Home.page b/tests/FunctionalTests/features/protected/pages/Wizard/Home.page deleted file mode 100644 index bcd93fef..00000000 --- a/tests/FunctionalTests/features/protected/pages/Wizard/Home.page +++ /dev/null @@ -1,35 +0,0 @@ -<com:TContent ID="Content">
 -
 -<com:TWizard
 -	HeaderText="Wizard Test"
 -	Width="300px"
 -	NavigationStyle.BackColor="silver"
 -	NavigationButtonStyle.BackColor="green"
 -	FinishCompleteButtonStyle.BackColor="red"
 -	>
 -  <com:TWizardStep Title="Step 1">
 -    step 1
 -    <com:TTextBox Text="step 1" ID="TextBox1" />
 -    <com:TRequiredFieldValidator ControlToValidate="TextBox1" Text="required 1" />
 -  </com:TWizardStep>
 -  <com:TWizardStep Title="Step 2" AllowReturn="false">
 -    step 2
 -    <com:TTextBox Text="step 2" ID="TextBox2" />
 -    <com:TRequiredFieldValidator ControlToValidate="TextBox2" Text="required 2" />
 -  </com:TWizardStep>
 -  <com:TTemplatedWizardStep Title="Step 22">
 -    <prop:ContentTemplate>
 -    <com:TTextBox Text="step 22" ID="TextBox22" />
 -    </prop:ContentTemplate>
 -    <prop:NavigationTemplate>
 -    <com:TButton Text="N...ext" CommandName="Complete" />
 -    </prop:NavigationTemplate>
 -  </com:TTemplatedWizardStep>
 -  <com:TWizardStep Title="Step 3" StepType="Complete">
 -    step 3
 -    <com:TTextBox Text="step 3" ID="TextBox3" />
 -    <com:TRequiredFieldValidator ControlToValidate="TextBox3" Text="required 3" />
 -  </com:TWizardStep>
 -</com:TWizard>
 -
 -</com:TContent>
\ No newline at end of file diff --git a/tests/FunctionalTests/index.php b/tests/FunctionalTests/index.php index 2cfcfd1f..c22543c0 100644 --- a/tests/FunctionalTests/index.php +++ b/tests/FunctionalTests/index.php @@ -8,6 +8,7 @@ Prado Functional Test Suites  <h1>Prado Functional Test Suites</h1>  <ul>    <li><a href="quickstart.php">Tests of QuickStart Tutorial Demo</a></li> +  <li><a href="validators.php">Tests of Validators</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> diff --git a/tests/FunctionalTests/validators.php b/tests/FunctionalTests/validators.php new file mode 100644 index 00000000..c86604c8 --- /dev/null +++ b/tests/FunctionalTests/validators.php @@ -0,0 +1,8 @@ +<?php + +require(dirname(__FILE__).'/PradoTester.php'); + +$tester=new PradoTester(dirname(__FILE__).'/validators/tests'); +$tester->run(new SimpleReporter()); + +?>
\ No newline at end of file diff --git a/tests/FunctionalTests/validators/index.php b/tests/FunctionalTests/validators/index.php new file mode 100644 index 00000000..fe127639 --- /dev/null +++ b/tests/FunctionalTests/validators/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/validators/protected/pages/Button.page b/tests/FunctionalTests/validators/protected/pages/Button.page new file mode 100644 index 00000000..5acc596b --- /dev/null +++ b/tests/FunctionalTests/validators/protected/pages/Button.page @@ -0,0 +1,37 @@ +<com:TContent ID="Content">
 +<h1>Validations Triggered by TButton</h1>
 +
 +<com:TTextBox ID="TextBox1" />
 +<com:TRequiredFieldValidator
 +	Text="Textbox1 required"
 +	ControlToValidate="TextBox1"
 +	ValidationGroup="Group1" />
 +<com:TButton Text="Submit1"
 +	ValidationGroup="Group1"
 +	OnClick="button1Clicked" />
 +<com:TLabel ID="Result1" />
 +
 +<hr/>
 +
 +<com:TTextBox ID="TextBox2" />
 +<com:TRequiredFieldValidator
 +	Text="Textbox2 required"
 +	ControlToValidate="TextBox2" />
 +<com:TButton Text="Submit2"
 +	OnClick="button2Clicked" />
 +<com:TLabel ID="Result2" />
 +
 +<hr/>
 +
 +<com:TTextBox ID="TextBox3" />
 +<com:TRequiredFieldValidator
 +	Text="Textbox3 required"
 +	EnableClientScript="false"
 +	ControlToValidate="TextBox3"
 +	ValidationGroup="Group3" />
 +<com:TButton Text="Submit3"
 +	ValidationGroup="Group3"
 +	OnClick="button3Clicked" />
 +<com:TLabel ID="Result3" />
 +
 +</com:TContent>
\ No newline at end of file diff --git a/tests/FunctionalTests/validators/protected/pages/Button.php b/tests/FunctionalTests/validators/protected/pages/Button.php new file mode 100644 index 00000000..3dbbc7d6 --- /dev/null +++ b/tests/FunctionalTests/validators/protected/pages/Button.php @@ -0,0 +1,27 @@ +<?php
 +
 +class Button extends TPage
 +{
 +	public function button1Clicked($sender,$param)
 +	{
 +		$this->Result1->Text="Button1 is clicked";
 +		if($this->IsValid)
 +			$this->Result1->Text.=' and valid';
 +	}
 +
 +	public function button2Clicked($sender,$param)
 +	{
 +		$this->Result2->Text="Button2 is clicked";
 +		if($this->IsValid)
 +			$this->Result2->Text.=' and valid';
 +	}
 +
 +	public function button3Clicked($sender,$param)
 +	{
 +		$this->Result3->Text="Button3 is clicked";
 +		if($this->IsValid)
 +			$this->Result3->Text.=' and valid';
 +	}
 +}
 +
 +?>
\ No newline at end of file diff --git a/tests/FunctionalTests/validators/protected/pages/CheckBox.page b/tests/FunctionalTests/validators/protected/pages/CheckBox.page new file mode 100644 index 00000000..e5cb39ff --- /dev/null +++ b/tests/FunctionalTests/validators/protected/pages/CheckBox.page @@ -0,0 +1,40 @@ +<com:TContent ID="Content">
 +<h1>Validations Triggered by TCheckBox</h1>
 +
 +<com:TTextBox ID="TextBox1" />
 +<com:TRequiredFieldValidator
 +	Text="Textbox1 required"
 +	ControlToValidate="TextBox1"
 +	ValidationGroup="Group1" />
 +<com:TCheckBox Text="Submit1"
 +	AutoPostBack="true"
 +	ValidationGroup="Group1"
 +	OnCheckedChanged="button1Clicked" />
 +<com:TLabel ID="Result1" />
 +
 +<hr/>
 +
 +<com:TTextBox ID="TextBox2" />
 +<com:TRequiredFieldValidator
 +	Text="Textbox2 required"
 +	ControlToValidate="TextBox2" />
 +<com:TCheckBox Text="Submit2"
 +	AutoPostBack="true"
 +	OnCheckedChanged="button2Clicked" />
 +<com:TLabel ID="Result2" />
 +
 +<hr/>
 +
 +<com:TTextBox ID="TextBox3" />
 +<com:TRequiredFieldValidator
 +	Text="Textbox3 required"
 +	EnableClientScript="false"
 +	ControlToValidate="TextBox3"
 +	ValidationGroup="Group3" />
 +<com:TCheckBox Text="Submit3"
 +	AutoPostBack="true"
 +	ValidationGroup="Group3"
 +	OnCheckedChanged="button3Clicked" />
 +<com:TLabel ID="Result3" />
 +
 +</com:TContent>
\ No newline at end of file diff --git a/tests/FunctionalTests/validators/protected/pages/CheckBox.php b/tests/FunctionalTests/validators/protected/pages/CheckBox.php new file mode 100644 index 00000000..700ac171 --- /dev/null +++ b/tests/FunctionalTests/validators/protected/pages/CheckBox.php @@ -0,0 +1,27 @@ +<?php
 +
 +class CheckBox extends TPage
 +{
 +	public function button1Clicked($sender,$param)
 +	{
 +		$this->Result1->Text="Button1 is clicked";
 +		if($this->IsValid)
 +			$this->Result1->Text.=' and valid';
 +	}
 +
 +	public function button2Clicked($sender,$param)
 +	{
 +		$this->Result2->Text="Button2 is clicked";
 +		if($this->IsValid)
 +			$this->Result2->Text.=' and valid';
 +	}
 +
 +	public function button3Clicked($sender,$param)
 +	{
 +		$this->Result3->Text="Button3 is clicked";
 +		if($this->IsValid)
 +			$this->Result3->Text.=' and valid';
 +	}
 +}
 +
 +?>
\ No newline at end of file diff --git a/tests/FunctionalTests/validators/protected/pages/ImageButton.page b/tests/FunctionalTests/validators/protected/pages/ImageButton.page new file mode 100644 index 00000000..d1fae361 --- /dev/null +++ b/tests/FunctionalTests/validators/protected/pages/ImageButton.page @@ -0,0 +1,37 @@ +<com:TContent ID="Content">
 +<h1>Validations Triggered by TImageButton</h1>
 +
 +<com:TTextBox ID="TextBox1" />
 +<com:TRequiredFieldValidator
 +	Text="Textbox1 required"
 +	ControlToValidate="TextBox1"
 +	ValidationGroup="Group1" />
 +<com:TImageButton ImageUrl="http://www.pradosoft.com/images/powered.gif"
 +	ValidationGroup="Group1"
 +	OnClick="button1Clicked" />
 +<com:TLabel ID="Result1" />
 +
 +<hr/>
 +
 +<com:TTextBox ID="TextBox2" />
 +<com:TRequiredFieldValidator
 +	Text="Textbox2 required"
 +	ControlToValidate="TextBox2" />
 +<com:TImageButton ImageUrl="http://www.pradosoft.com/images/powered.gif"
 +	OnClick="button2Clicked" />
 +<com:TLabel ID="Result2" />
 +
 +<hr/>
 +
 +<com:TTextBox ID="TextBox3" />
 +<com:TRequiredFieldValidator
 +	Text="Textbox3 required"
 +	EnableClientScript="false"
 +	ControlToValidate="TextBox3"
 +	ValidationGroup="Group3" />
 +<com:TImageButton ImageUrl="http://www.pradosoft.com/images/powered.gif"
 +	ValidationGroup="Group3"
 +	OnClick="button3Clicked" />
 +<com:TLabel ID="Result3" />
 +
 +</com:TContent>
\ No newline at end of file diff --git a/tests/FunctionalTests/validators/protected/pages/ImageButton.php b/tests/FunctionalTests/validators/protected/pages/ImageButton.php new file mode 100644 index 00000000..ecedd5bf --- /dev/null +++ b/tests/FunctionalTests/validators/protected/pages/ImageButton.php @@ -0,0 +1,27 @@ +<?php
 +
 +class ImageButton extends TPage
 +{
 +	public function button1Clicked($sender,$param)
 +	{
 +		$this->Result1->Text="Button1 is clicked";
 +		if($this->IsValid)
 +			$this->Result1->Text.=' and valid';
 +	}
 +
 +	public function button2Clicked($sender,$param)
 +	{
 +		$this->Result2->Text="Button2 is clicked";
 +		if($this->IsValid)
 +			$this->Result2->Text.=' and valid';
 +	}
 +
 +	public function button3Clicked($sender,$param)
 +	{
 +		$this->Result3->Text="Button3 is clicked";
 +		if($this->IsValid)
 +			$this->Result3->Text.=' and valid';
 +	}
 +}
 +
 +?>
\ No newline at end of file diff --git a/tests/FunctionalTests/validators/protected/pages/Layout.php b/tests/FunctionalTests/validators/protected/pages/Layout.php new file mode 100644 index 00000000..ba96038b --- /dev/null +++ b/tests/FunctionalTests/validators/protected/pages/Layout.php @@ -0,0 +1,7 @@ +<?php
 +
 +class Layout extends TTemplateControl
 +{
 +}
 +
 +?>
\ No newline at end of file diff --git a/tests/FunctionalTests/validators/protected/pages/Layout.tpl b/tests/FunctionalTests/validators/protected/pages/Layout.tpl new file mode 100644 index 00000000..224481e1 --- /dev/null +++ b/tests/FunctionalTests/validators/protected/pages/Layout.tpl @@ -0,0 +1,34 @@ +<!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>
 +<com:TContentPlaceHolder ID="Content" />
 +<hr style="margin-top: 2em" />
 +<com:TJavascriptLogger />
 +</com:TForm>
 +</body>
 +</html>
\ No newline at end of file diff --git a/tests/FunctionalTests/validators/protected/pages/LinkButton.page b/tests/FunctionalTests/validators/protected/pages/LinkButton.page new file mode 100644 index 00000000..8ed1c338 --- /dev/null +++ b/tests/FunctionalTests/validators/protected/pages/LinkButton.page @@ -0,0 +1,37 @@ +<com:TContent ID="Content">
 +<h1>Validations Triggered by TLinkButton</h1>
 +
 +<com:TTextBox ID="TextBox1" />
 +<com:TRequiredFieldValidator
 +	Text="Textbox1 required"
 +	ControlToValidate="TextBox1"
 +	ValidationGroup="Group1" />
 +<com:TLinkButton Text="Submit1"
 +	ValidationGroup="Group1"
 +	OnClick="button1Clicked" />
 +<com:TLabel ID="Result1" />
 +
 +<hr/>
 +
 +<com:TTextBox ID="TextBox2" />
 +<com:TRequiredFieldValidator
 +	Text="Textbox2 required"
 +	ControlToValidate="TextBox2" />
 +<com:TLinkButton Text="Submit2"
 +	OnClick="button2Clicked" />
 +<com:TLabel ID="Result2" />
 +
 +<hr/>
 +
 +<com:TTextBox ID="TextBox3" />
 +<com:TRequiredFieldValidator
 +	Text="Textbox3 required"
 +	EnableClientScript="false"
 +	ControlToValidate="TextBox3"
 +	ValidationGroup="Group3" />
 +<com:TLinkButton Text="Submit3"
 +	ValidationGroup="Group3"
 +	OnClick="button3Clicked" />
 +<com:TLabel ID="Result3" />
 +
 +</com:TContent>
\ No newline at end of file diff --git a/tests/FunctionalTests/validators/protected/pages/LinkButton.php b/tests/FunctionalTests/validators/protected/pages/LinkButton.php new file mode 100644 index 00000000..5130dd01 --- /dev/null +++ b/tests/FunctionalTests/validators/protected/pages/LinkButton.php @@ -0,0 +1,27 @@ +<?php
 +
 +class LinkButton extends TPage
 +{
 +	public function button1Clicked($sender,$param)
 +	{
 +		$this->Result1->Text="Button1 is clicked";
 +		if($this->IsValid)
 +			$this->Result1->Text.=' and valid';
 +	}
 +
 +	public function button2Clicked($sender,$param)
 +	{
 +		$this->Result2->Text="Button2 is clicked";
 +		if($this->IsValid)
 +			$this->Result2->Text.=' and valid';
 +	}
 +
 +	public function button3Clicked($sender,$param)
 +	{
 +		$this->Result3->Text="Button3 is clicked";
 +		if($this->IsValid)
 +			$this->Result3->Text.=' and valid';
 +	}
 +}
 +
 +?>
\ No newline at end of file diff --git a/tests/FunctionalTests/validators/protected/pages/config.xml b/tests/FunctionalTests/validators/protected/pages/config.xml new file mode 100644 index 00000000..83bb5791 --- /dev/null +++ b/tests/FunctionalTests/validators/protected/pages/config.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?>
 +
 +<configuration>
 +  <pages MasterClass="Application.pages.Layout" />
 +</configuration>
\ No newline at end of file diff --git a/tests/FunctionalTests/validators/tests/ButtonTestCase.php b/tests/FunctionalTests/validators/tests/ButtonTestCase.php new file mode 100644 index 00000000..46e037dc --- /dev/null +++ b/tests/FunctionalTests/validators/tests/ButtonTestCase.php @@ -0,0 +1,65 @@ +<?php
 +
 +class ButtonTestCase extends SeleniumTestCase
 +{
 +	function test()
 +	{
 +		$this->open('validators/index.php?page=Button');
 +
 +
 +		// verify all error messages are invisible
 +		$this->verifyNotVisible('ctl0_Content_ctl0');
 +		$this->verifyNotVisible('ctl0_Content_ctl2');
 +		$this->verifyNotVisible('ctl0_Content_ctl4');
 +
 +		// verify the first validator shows the error
 +		$this->click("ctl0_Content_ctl1");
 +		$this->verifyVisible('ctl0_Content_ctl0');
 +		$this->verifyNotVisible('ctl0_Content_ctl2');
 +		$this->verifyNotVisible('ctl0_Content_ctl4');
 +
 +		// verify the first validation is passed
 +		$this->pause(500);
 +		$this->verifyTextNotPresent('Button1 is clicked');
 +		$this->type("ctl0_Content_TextBox1", "test");
 +		$this->clickAndWait("ctl0_Content_ctl1");
 +		$this->verifyNotVisible('ctl0_Content_ctl0');
 +		$this->verifyNotVisible('ctl0_Content_ctl2');
 +		$this->verifyNotVisible('ctl0_Content_ctl4');
 +		$this->verifyTextPresent('Button1 is clicked and valid');
 +
 +		// verify the second validator shows the error
 +		$this->click("ctl0_Content_ctl3");
 +		$this->verifyNotVisible('ctl0_Content_ctl0');
 +		$this->verifyVisible('ctl0_Content_ctl2');
 +		$this->verifyNotVisible('ctl0_Content_ctl4');
 +
 +		// verify the second validation is passed
 +		$this->pause(500);
 +		$this->verifyTextNotPresent('Button2 is clicked');
 +		$this->type("ctl0_Content_TextBox2", "test");
 +		$this->clickAndWait("ctl0_Content_ctl3");
 +		$this->verifyNotVisible('ctl0_Content_ctl0');
 +		$this->verifyNotVisible('ctl0_Content_ctl2');
 +		$this->verifyNotVisible('ctl0_Content_ctl4');
 +		$this->verifyTextPresent('Button2 is clicked and valid');
 +
 +		// verify the third validator shows the error
 +		$this->clickAndWait("ctl0_Content_ctl5");
 +		$this->verifyNotVisible('ctl0_Content_ctl0');
 +		$this->verifyNotVisible('ctl0_Content_ctl2');
 +		$this->verifyVisible('ctl0_Content_ctl4');
 +
 +		// verify the third validation is passed
 +		$this->verifyTextPresent('Button3 is clicked');
 +		$this->verifyTextNotPresent('Button3 is clicked and valid');
 +		$this->type("ctl0_Content_TextBox3", "test");
 +		$this->clickAndWait("ctl0_Content_ctl5");
 +		$this->verifyNotVisible('ctl0_Content_ctl0');
 +		$this->verifyNotVisible('ctl0_Content_ctl2');
 +		$this->verifyNotVisible('ctl0_Content_ctl4');
 +		$this->verifyTextPresent('Button3 is clicked and valid');
 +	}
 +}
 +
 +?>
\ No newline at end of file diff --git a/tests/FunctionalTests/validators/tests/CheckBoxTestCase.php b/tests/FunctionalTests/validators/tests/CheckBoxTestCase.php new file mode 100644 index 00000000..6783572d --- /dev/null +++ b/tests/FunctionalTests/validators/tests/CheckBoxTestCase.php @@ -0,0 +1,67 @@ +<?php
 +
 +class CheckBoxTestCase extends SeleniumTestCase
 +{
 +	function test()
 +	{
 +		$this->open('validators/index.php?page=CheckBox');
 +
 +
 +		// verify all error messages are invisible
 +		$this->verifyNotVisible('ctl0_Content_ctl0');
 +		$this->verifyNotVisible('ctl0_Content_ctl2');
 +		$this->verifyNotVisible('ctl0_Content_ctl4');
 +
 +		// verify the first validator shows the error
 +		$this->click("ctl0_Content_ctl1");
 +		$this->verifyVisible('ctl0_Content_ctl0');
 +		$this->verifyNotVisible('ctl0_Content_ctl2');
 +		$this->verifyNotVisible('ctl0_Content_ctl4');
 +
 +		// verify the first validation is passed
 +		$this->pause(500);
 +		$this->verifyTextNotPresent('Button1 is clicked');
 +		$this->type("ctl0_Content_TextBox1", "test");
 +		$this->clickAndWait("ctl0_Content_ctl1");
 +		$this->clickAndWait("ctl0_Content_ctl1");
 +		$this->verifyNotVisible('ctl0_Content_ctl0');
 +		$this->verifyNotVisible('ctl0_Content_ctl2');
 +		$this->verifyNotVisible('ctl0_Content_ctl4');
 +		$this->verifyTextPresent('Button1 is clicked and valid');
 +
 +		// verify the second validator shows the error
 +		$this->click("ctl0_Content_ctl3");
 +		$this->verifyNotVisible('ctl0_Content_ctl0');
 +		$this->verifyVisible('ctl0_Content_ctl2');
 +		$this->verifyNotVisible('ctl0_Content_ctl4');
 +
 +		// verify the second validation is passed
 +		$this->pause(500);
 +		$this->verifyTextNotPresent('Button2 is clicked');
 +		$this->type("ctl0_Content_TextBox2", "test");
 +		$this->clickAndWait("ctl0_Content_ctl3");
 +		$this->clickAndWait("ctl0_Content_ctl3");
 +		$this->verifyNotVisible('ctl0_Content_ctl0');
 +		$this->verifyNotVisible('ctl0_Content_ctl2');
 +		$this->verifyNotVisible('ctl0_Content_ctl4');
 +		$this->verifyTextPresent('Button2 is clicked and valid');
 +
 +		// verify the third validator shows the error
 +		$this->clickAndWait("ctl0_Content_ctl5");
 +		$this->verifyNotVisible('ctl0_Content_ctl0');
 +		$this->verifyNotVisible('ctl0_Content_ctl2');
 +		$this->verifyVisible('ctl0_Content_ctl4');
 +
 +		// verify the third validation is passed
 +		$this->verifyTextPresent('Button3 is clicked');
 +		$this->verifyTextNotPresent('Button3 is clicked and valid');
 +		$this->type("ctl0_Content_TextBox3", "test");
 +		$this->clickAndWait("ctl0_Content_ctl5");
 +		$this->verifyNotVisible('ctl0_Content_ctl0');
 +		$this->verifyNotVisible('ctl0_Content_ctl2');
 +		$this->verifyNotVisible('ctl0_Content_ctl4');
 +		$this->verifyTextPresent('Button3 is clicked and valid');
 +	}
 +}
 +
 +?>
\ No newline at end of file diff --git a/tests/FunctionalTests/validators/tests/ImageButtonTestCase.php b/tests/FunctionalTests/validators/tests/ImageButtonTestCase.php new file mode 100644 index 00000000..1a4d88c1 --- /dev/null +++ b/tests/FunctionalTests/validators/tests/ImageButtonTestCase.php @@ -0,0 +1,65 @@ +<?php
 +
 +class ImageButtonTestCase extends SeleniumTestCase
 +{
 +	function test()
 +	{
 +		$this->open('validators/index.php?page=ImageButton');
 +
 +
 +		// verify all error messages are invisible
 +		$this->verifyNotVisible('ctl0_Content_ctl0');
 +		$this->verifyNotVisible('ctl0_Content_ctl2');
 +		$this->verifyNotVisible('ctl0_Content_ctl4');
 +
 +		// verify the first validator shows the error
 +		$this->click("ctl0_Content_ctl1");
 +		$this->verifyVisible('ctl0_Content_ctl0');
 +		$this->verifyNotVisible('ctl0_Content_ctl2');
 +		$this->verifyNotVisible('ctl0_Content_ctl4');
 +
 +		// verify the first validation is passed
 +		$this->pause(500);
 +		$this->verifyTextNotPresent('Button1 is clicked');
 +		$this->type("ctl0_Content_TextBox1", "test");
 +		$this->clickAndWait("ctl0_Content_ctl1");
 +		$this->verifyNotVisible('ctl0_Content_ctl0');
 +		$this->verifyNotVisible('ctl0_Content_ctl2');
 +		$this->verifyNotVisible('ctl0_Content_ctl4');
 +		$this->verifyTextPresent('Button1 is clicked and valid');
 +
 +		// verify the second validator shows the error
 +		$this->click("ctl0_Content_ctl3");
 +		$this->verifyNotVisible('ctl0_Content_ctl0');
 +		$this->verifyVisible('ctl0_Content_ctl2');
 +		$this->verifyNotVisible('ctl0_Content_ctl4');
 +
 +		// verify the second validation is passed
 +		$this->pause(500);
 +		$this->verifyTextNotPresent('Button2 is clicked');
 +		$this->type("ctl0_Content_TextBox2", "test");
 +		$this->clickAndWait("ctl0_Content_ctl3");
 +		$this->verifyNotVisible('ctl0_Content_ctl0');
 +		$this->verifyNotVisible('ctl0_Content_ctl2');
 +		$this->verifyNotVisible('ctl0_Content_ctl4');
 +		$this->verifyTextPresent('Button2 is clicked and valid');
 +
 +		// verify the third validator shows the error
 +		$this->clickAndWait("ctl0_Content_ctl5");
 +		$this->verifyNotVisible('ctl0_Content_ctl0');
 +		$this->verifyNotVisible('ctl0_Content_ctl2');
 +		$this->verifyVisible('ctl0_Content_ctl4');
 +
 +		// verify the third validation is passed
 +		$this->verifyTextPresent('Button3 is clicked');
 +		$this->verifyTextNotPresent('Button3 is clicked and valid');
 +		$this->type("ctl0_Content_TextBox3", "test");
 +		$this->clickAndWait("ctl0_Content_ctl5");
 +		$this->verifyNotVisible('ctl0_Content_ctl0');
 +		$this->verifyNotVisible('ctl0_Content_ctl2');
 +		$this->verifyNotVisible('ctl0_Content_ctl4');
 +		$this->verifyTextPresent('Button3 is clicked and valid');
 +	}
 +}
 +
 +?>
\ No newline at end of file diff --git a/tests/FunctionalTests/validators/tests/LinkButtonTestCase.php b/tests/FunctionalTests/validators/tests/LinkButtonTestCase.php new file mode 100644 index 00000000..47122442 --- /dev/null +++ b/tests/FunctionalTests/validators/tests/LinkButtonTestCase.php @@ -0,0 +1,64 @@ +<?php
 +
 +class LinkButtonTestCase extends SeleniumTestCase
 +{
 +	function test()
 +	{
 +		$this->open('validators/index.php?page=LinkButton');
 +
 +		// verify all error messages are invisible
 +		$this->verifyNotVisible('ctl0_Content_ctl0');
 +		$this->verifyNotVisible('ctl0_Content_ctl2');
 +		$this->verifyNotVisible('ctl0_Content_ctl4');
 +
 +		// verify the first validator shows the error
 +		$this->click("ctl0_Content_ctl1");
 +		$this->verifyVisible('ctl0_Content_ctl0');
 +		$this->verifyNotVisible('ctl0_Content_ctl2');
 +		$this->verifyNotVisible('ctl0_Content_ctl4');
 +
 +		// verify the first validation is passed
 +		$this->pause(500);
 +		$this->verifyTextNotPresent('Button1 is clicked');
 +		$this->type("ctl0_Content_TextBox1", "test");
 +		$this->clickAndWait("ctl0_Content_ctl1");
 +		$this->verifyNotVisible('ctl0_Content_ctl0');
 +		$this->verifyNotVisible('ctl0_Content_ctl2');
 +		$this->verifyNotVisible('ctl0_Content_ctl4');
 +		$this->verifyTextPresent('Button1 is clicked and valid');
 +
 +		// verify the second validator shows the error
 +		$this->click("ctl0_Content_ctl3");
 +		$this->verifyNotVisible('ctl0_Content_ctl0');
 +		$this->verifyVisible('ctl0_Content_ctl2');
 +		$this->verifyNotVisible('ctl0_Content_ctl4');
 +
 +		// verify the second validation is passed
 +		$this->pause(500);
 +		$this->verifyTextNotPresent('Button2 is clicked');
 +		$this->type("ctl0_Content_TextBox2", "test");
 +		$this->clickAndWait("ctl0_Content_ctl3");
 +		$this->verifyNotVisible('ctl0_Content_ctl0');
 +		$this->verifyNotVisible('ctl0_Content_ctl2');
 +		$this->verifyNotVisible('ctl0_Content_ctl4');
 +		$this->verifyTextPresent('Button2 is clicked and valid');
 +
 +		// verify the third validator shows the error
 +		$this->clickAndWait("ctl0_Content_ctl5");
 +		$this->verifyNotVisible('ctl0_Content_ctl0');
 +		$this->verifyNotVisible('ctl0_Content_ctl2');
 +		$this->verifyVisible('ctl0_Content_ctl4');
 +
 +		// verify the third validation is passed
 +		$this->verifyTextPresent('Button3 is clicked');
 +		$this->verifyTextNotPresent('Button3 is clicked and valid');
 +		$this->type("ctl0_Content_TextBox3", "test");
 +		$this->clickAndWait("ctl0_Content_ctl5");
 +		$this->verifyNotVisible('ctl0_Content_ctl0');
 +		$this->verifyNotVisible('ctl0_Content_ctl2');
 +		$this->verifyNotVisible('ctl0_Content_ctl4');
 +		$this->verifyTextPresent('Button3 is clicked and valid');
 +	}
 +}
 +
 +?>
\ No newline at end of file | 
