From a1ed7c2ad592b6fad8a0ec27f9714ec608cc3cc0 Mon Sep 17 00:00:00 2001
From: xue <>
Date: Sun, 16 Apr 2006 17:51:39 +0000
Subject: Added FT for validators working with TButton, TLinkButton,
TImageButton and TCheckBox.
---
tests/FunctionalTests/validators/index.php | 8 +++
.../validators/protected/pages/Button.page | 37 ++++++++++++
.../validators/protected/pages/Button.php | 27 +++++++++
.../validators/protected/pages/CheckBox.page | 40 +++++++++++++
.../validators/protected/pages/CheckBox.php | 27 +++++++++
.../validators/protected/pages/ImageButton.page | 37 ++++++++++++
.../validators/protected/pages/ImageButton.php | 27 +++++++++
.../validators/protected/pages/Layout.php | 7 +++
.../validators/protected/pages/Layout.tpl | 34 +++++++++++
.../validators/protected/pages/LinkButton.page | 37 ++++++++++++
.../validators/protected/pages/LinkButton.php | 27 +++++++++
.../validators/protected/pages/config.xml | 5 ++
.../validators/tests/ButtonTestCase.php | 65 +++++++++++++++++++++
.../validators/tests/CheckBoxTestCase.php | 67 ++++++++++++++++++++++
.../validators/tests/ImageButtonTestCase.php | 65 +++++++++++++++++++++
.../validators/tests/LinkButtonTestCase.php | 64 +++++++++++++++++++++
16 files changed, 574 insertions(+)
create mode 100644 tests/FunctionalTests/validators/index.php
create mode 100644 tests/FunctionalTests/validators/protected/pages/Button.page
create mode 100644 tests/FunctionalTests/validators/protected/pages/Button.php
create mode 100644 tests/FunctionalTests/validators/protected/pages/CheckBox.page
create mode 100644 tests/FunctionalTests/validators/protected/pages/CheckBox.php
create mode 100644 tests/FunctionalTests/validators/protected/pages/ImageButton.page
create mode 100644 tests/FunctionalTests/validators/protected/pages/ImageButton.php
create mode 100644 tests/FunctionalTests/validators/protected/pages/Layout.php
create mode 100644 tests/FunctionalTests/validators/protected/pages/Layout.tpl
create mode 100644 tests/FunctionalTests/validators/protected/pages/LinkButton.page
create mode 100644 tests/FunctionalTests/validators/protected/pages/LinkButton.php
create mode 100644 tests/FunctionalTests/validators/protected/pages/config.xml
create mode 100644 tests/FunctionalTests/validators/tests/ButtonTestCase.php
create mode 100644 tests/FunctionalTests/validators/tests/CheckBoxTestCase.php
create mode 100644 tests/FunctionalTests/validators/tests/ImageButtonTestCase.php
create mode 100644 tests/FunctionalTests/validators/tests/LinkButtonTestCase.php
(limited to 'tests/FunctionalTests/validators')
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 @@
+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 @@
+
+Validations Triggered by TButton
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ 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 @@
+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 @@
+
+Validations Triggered by TCheckBox
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ 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 @@
+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 @@
+
+Validations Triggered by TImageButton
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ 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 @@
+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 @@
+
\ 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 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ 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 @@
+
+Validations Triggered by TLinkButton
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ 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 @@
+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 @@
+
+
+
+
+
\ 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 @@
+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 @@
+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 @@
+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 @@
+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
--
cgit v1.2.3