From 3c03a42d1edb0ec26110ace00f42e156cabff67b Mon Sep 17 00:00:00 2001 From: wei <> Date: Sat, 9 Dec 2006 09:17:22 +0000 Subject: Fixed #433, #384, #439, #477, #435, #422, #401, #359. Add more class docs for sqlmap. --- .../protected/pages/AutoCompleteTest.php | 1 - .../protected/pages/TimeTriggeredCallbackTest.page | 2 +- .../tickets/protected/pages/Ticket359.page | 40 ++++++++ .../tickets/protected/pages/Ticket359.php | 13 +++ .../tickets/protected/pages/Ticket384.page | 51 ++++++++++ .../tickets/protected/pages/Ticket384.php | 46 +++++++++ .../tickets/protected/pages/Ticket422.page | 25 +++++ .../tickets/protected/pages/Ticket422.php | 108 +++++++++++++++++++++ .../tickets/protected/pages/Ticket433.page | 6 ++ .../tickets/protected/pages/Ticket433.php | 24 +++++ .../tickets/protected/pages/Ticket439.page | 6 ++ .../tickets/protected/pages/Ticket439.php | 15 +++ .../tickets/protected/pages/Ticket477.page | 29 ++++++ .../tickets/protected/pages/Ticket477.php | 16 +++ .../tickets/tests/Ticket433TestCase.php | 18 ++++ .../tickets/tests/Ticket439TestCase.php | 16 +++ .../tickets/tests/Ticket477TestCase.php | 24 +++++ 17 files changed, 438 insertions(+), 2 deletions(-) create mode 100644 tests/FunctionalTests/tickets/protected/pages/Ticket359.page create mode 100644 tests/FunctionalTests/tickets/protected/pages/Ticket359.php create mode 100644 tests/FunctionalTests/tickets/protected/pages/Ticket384.page create mode 100644 tests/FunctionalTests/tickets/protected/pages/Ticket384.php create mode 100644 tests/FunctionalTests/tickets/protected/pages/Ticket422.page create mode 100644 tests/FunctionalTests/tickets/protected/pages/Ticket422.php create mode 100644 tests/FunctionalTests/tickets/protected/pages/Ticket433.page create mode 100644 tests/FunctionalTests/tickets/protected/pages/Ticket433.php create mode 100644 tests/FunctionalTests/tickets/protected/pages/Ticket439.page create mode 100644 tests/FunctionalTests/tickets/protected/pages/Ticket439.php create mode 100644 tests/FunctionalTests/tickets/protected/pages/Ticket477.page create mode 100644 tests/FunctionalTests/tickets/protected/pages/Ticket477.php create mode 100644 tests/FunctionalTests/tickets/tests/Ticket433TestCase.php create mode 100644 tests/FunctionalTests/tickets/tests/Ticket439TestCase.php create mode 100644 tests/FunctionalTests/tickets/tests/Ticket477TestCase.php (limited to 'tests') diff --git a/tests/FunctionalTests/active-controls/protected/pages/AutoCompleteTest.php b/tests/FunctionalTests/active-controls/protected/pages/AutoCompleteTest.php index dbce7531..b45fc740 100644 --- a/tests/FunctionalTests/active-controls/protected/pages/AutoCompleteTest.php +++ b/tests/FunctionalTests/active-controls/protected/pages/AutoCompleteTest.php @@ -9,7 +9,6 @@ class AutoCompleteTest extends TPage { $sender->setDataSource($this->matchCountries($param->getCallbackParameter())); $sender->dataBind(); - $sender->render($param->getNewWriter()); $this->label1->Text = "suggestion for ".$param->getCallbackParameter(); } diff --git a/tests/FunctionalTests/active-controls/protected/pages/TimeTriggeredCallbackTest.page b/tests/FunctionalTests/active-controls/protected/pages/TimeTriggeredCallbackTest.page index f7515a36..a285f03d 100644 --- a/tests/FunctionalTests/active-controls/protected/pages/TimeTriggeredCallbackTest.page +++ b/tests/FunctionalTests/active-controls/protected/pages/TimeTriggeredCallbackTest.page @@ -5,7 +5,7 @@
- + diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket359.page b/tests/FunctionalTests/tickets/protected/pages/Ticket359.page new file mode 100644 index 00000000..036560e6 --- /dev/null +++ b/tests/FunctionalTests/tickets/protected/pages/Ticket359.page @@ -0,0 +1,40 @@ + + +

Callback Custom Validator Test

+ + + + + + + + + + + + + +
\ No newline at end of file diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket359.php b/tests/FunctionalTests/tickets/protected/pages/Ticket359.php new file mode 100644 index 00000000..1e544e9b --- /dev/null +++ b/tests/FunctionalTests/tickets/protected/pages/Ticket359.php @@ -0,0 +1,13 @@ +IsValid = $param->Value == 'Prado'; + } +} + +?> \ No newline at end of file diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket384.page b/tests/FunctionalTests/tickets/protected/pages/Ticket384.page new file mode 100644 index 00000000..79e5c0c1 --- /dev/null +++ b/tests/FunctionalTests/tickets/protected/pages/Ticket384.page @@ -0,0 +1,51 @@ + + + +

Dynamic TAutoComplete Functional Test

+ + + + + + + + + +
\ No newline at end of file diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket384.php b/tests/FunctionalTests/tickets/protected/pages/Ticket384.php new file mode 100644 index 00000000..e928632d --- /dev/null +++ b/tests/FunctionalTests/tickets/protected/pages/Ticket384.php @@ -0,0 +1,46 @@ +AutoCompleteRepeater->setDataSource(array(1, 2)); + $this->AutoCompleteRepeater->dataBind(); + } + + public function submitCallback($sender, $param) + { + $this->AutoCompleteRepeater->setDataSource(array(1,2,3,4)); + $this->AutoCompleteRepeater->dataBind(); + $this->AutoCompletePanel->render($this->getResponse()->createHtmlWriter()); + } + + public function suggestCountries($sender, $param) + { + $sender->setDataSource($this->matchCountries($param->getCallbackParameter())); + $sender->dataBind(); + } + + protected function matchCountries($token) + { + $info = Prado::createComponent('System.I18N.core.CultureInfo', 'en'); + $list = array(); + $count = 0; + $token = strtolower($token); + foreach($info->getCountries() as $country) + { + if(strpos(strtolower($country), $token) === 0) + { + $list[] = $country; + $count++; + if($count > 10) break; + } + } + return $list; + } +} + +?> \ No newline at end of file diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket422.page b/tests/FunctionalTests/tickets/protected/pages/Ticket422.page new file mode 100644 index 00000000..d6303d84 --- /dev/null +++ b/tests/FunctionalTests/tickets/protected/pages/Ticket422.page @@ -0,0 +1,25 @@ + + + + + + +
+ +
+ +
+ + + + +
+ +
\ No newline at end of file diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket422.php b/tests/FunctionalTests/tickets/protected/pages/Ticket422.php new file mode 100644 index 00000000..9a46ff75 --- /dev/null +++ b/tests/FunctionalTests/tickets/protected/pages/Ticket422.php @@ -0,0 +1,108 @@ +_listItemsA[] = array("title" => "Please select", "id" => -1,"category" => -1); + $this->_listItemsA[] = array("title" => "Item A", "id" => 1,"category" => 1); + $this->_listItemsA[] = array("title" => "Item B", "id" => 2,"category" => 1); + $this->_listItemsA[] = array("title" => "Item C", "id" => 3,"category" => 1); + $this->_listItemsA[] = array("title" => "Item D", "id" => 4,"category" => 1); + $this->_listItemsA[] = array("title" => "Item E", "id" => 5,"category" => 1); + + $this->_listItemsB[] = array("title" => "List 2 Item A", "id" => 1,"category" => 1); + $this->_listItemsB[] = array("title" => "List 2 Item B", "id" => 2,"category" => 1); + $this->_listItemsB[] = array("title" => "List 2 Item C", "id" => 3,"category" => 1); + $this->_listItemsB[] = array("title" => "List 2 Item D", "id" => 4,"category" => 2); + $this->_listItemsB[] = array("title" => "List 2 Item E", "id" => 5,"category" => 2); + $this->_listItemsB[] = array("title" => "List 2 Item F", "id" => 6,"category" => 2); + $this->_listItemsB[] = array("title" => "List 2 Item G", "id" => 7,"category" => 3); + $this->_listItemsB[] = array("title" => "List 2 Item H", "id" => 8,"category" => 3); + $this->_listItemsB[] = array("title" => "List 2 Item I", "id" => 9,"category" => 3); + $this->_listItemsB[] = array("title" => "List 2 Item J", "id" => 10,"category" => 4); + $this->_listItemsB[] = array("title" => "List 2 Item K", "id" => 11,"category" => 4); + $this->_listItemsB[] = array("title" => "List 2 Item L", "id" => 12,"category" => 4); + + $this->list1->DataValueField ='id'; + $this->list1->DataTextField = 'title'; + } + + public function onLoad($param) + { + parent::onLoad($param); + if(!$this->IsPostBack) + { + $this->list1->DataSource = $this->_listItemsA; + $this->list1->dataBind(); + } + } + + function list1_changed($sender) + { + if ($sender->getSelectedValue() == -1) + { + $this->label1->setText("Please select a category"); + $this->list2->setEnabled(false); + return; + } + + $this->addOptionsToListProblem($sender->getSelectedValue()); + } + + function addOptionsToListProblem($parent) + { + $foo = array(); + $bar = 0; + $sel = array("title" => "Please select", "id" => -1,"category" => -1); + $foo[] = $sel; + foreach ($this->_listItemsB as $p) + { + if ($p["category"] == $parent) + { + $foo[] = $p; + } + } + + $this->list2->DataValueField = 'id'; + $this->list2->DataTextField = 'title'; + $this->list2->DataSource = $foo; + $this->list2->dataBind(); + $this->list2->setEnabled(true); + } + + function list2_changed($sender) + { + $this->label1->setText("Selection 2: ".$sender->getSelectedValue()); + } + + function select_index_3() + { + $this->list1->setSelectedIndex(3); + } + + function clear_selections() + { + $this->list1->clearSelection(); + } + + function select_value_2() + { + $this->list1->setSelectedValue("value 2"); + } + + function select_index_3_plus() + { + $this->list1->setSelectedValue("value 3"); + $this->list1_changed($this->list1); + $this->list2->setSelectedValue("value 3 - item 3"); + } +} + +?> \ No newline at end of file diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket433.page b/tests/FunctionalTests/tickets/protected/pages/Ticket433.page new file mode 100644 index 00000000..b76245f5 --- /dev/null +++ b/tests/FunctionalTests/tickets/protected/pages/Ticket433.page @@ -0,0 +1,6 @@ + + + \ No newline at end of file diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket433.php b/tests/FunctionalTests/tickets/protected/pages/Ticket433.php new file mode 100644 index 00000000..2e5c1ff7 --- /dev/null +++ b/tests/FunctionalTests/tickets/protected/pages/Ticket433.php @@ -0,0 +1,24 @@ +IsPostBack) + $this->VoteClick->Text = "BEFORE click"; + } + + public function onUpdateVoteClick($sender, $param) + { + $sender->Text = 'AFTER click'; + } + + public function onUpdateVoteCallback($sender, $param) + { + $sender->Text .= ' CALLBACK DONE'; + } +} + +?> \ No newline at end of file diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket439.page b/tests/FunctionalTests/tickets/protected/pages/Ticket439.page new file mode 100644 index 00000000..554696e2 --- /dev/null +++ b/tests/FunctionalTests/tickets/protected/pages/Ticket439.page @@ -0,0 +1,6 @@ + + + \ No newline at end of file diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket439.php b/tests/FunctionalTests/tickets/protected/pages/Ticket439.php new file mode 100644 index 00000000..eaebc250 --- /dev/null +++ b/tests/FunctionalTests/tickets/protected/pages/Ticket439.php @@ -0,0 +1,15 @@ +Service->constructUrl('Home'); + $this->Response->redirect($page); + } +} + +?> \ No newline at end of file diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket477.page b/tests/FunctionalTests/tickets/protected/pages/Ticket477.page new file mode 100644 index 00000000..b7f23bc3 --- /dev/null +++ b/tests/FunctionalTests/tickets/protected/pages/Ticket477.page @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket477.php b/tests/FunctionalTests/tickets/protected/pages/Ticket477.php new file mode 100644 index 00000000..49c72b9e --- /dev/null +++ b/tests/FunctionalTests/tickets/protected/pages/Ticket477.php @@ -0,0 +1,16 @@ +IsValid=false; + } + + function do_validate_2($sender, $param) + { + $param->IsValid=false; + } +} + +?> \ No newline at end of file diff --git a/tests/FunctionalTests/tickets/tests/Ticket433TestCase.php b/tests/FunctionalTests/tickets/tests/Ticket433TestCase.php new file mode 100644 index 00000000..1bbfb7ec --- /dev/null +++ b/tests/FunctionalTests/tickets/tests/Ticket433TestCase.php @@ -0,0 +1,18 @@ +open('tickets/index.php?page=Ticket433'); + $this->assertTitle("Verifying Ticket 433"); + $this->assertText("{$base}VoteClick", "BEFORE click"); + + $this->click("{$base}VoteClick"); + $this->pause(800); + $this->assertText("{$base}VoteClick", "AFTER click CALLBACK DONE"); + } +} + +?> \ No newline at end of file diff --git a/tests/FunctionalTests/tickets/tests/Ticket439TestCase.php b/tests/FunctionalTests/tickets/tests/Ticket439TestCase.php new file mode 100644 index 00000000..8ba47e87 --- /dev/null +++ b/tests/FunctionalTests/tickets/tests/Ticket439TestCase.php @@ -0,0 +1,16 @@ +open('tickets/index.php?page=Ticket439'); + $this->assertTitle("Verifying Ticket 439"); + $this->click("{$base}button1"); + $this->waitForPageToLoad(3000); + $this->pause(800); + $this->assertTitle("Verifying Ticket Home"); + } +} +?> \ No newline at end of file diff --git a/tests/FunctionalTests/tickets/tests/Ticket477TestCase.php b/tests/FunctionalTests/tickets/tests/Ticket477TestCase.php new file mode 100644 index 00000000..ea32ff5f --- /dev/null +++ b/tests/FunctionalTests/tickets/tests/Ticket477TestCase.php @@ -0,0 +1,24 @@ +open('tickets/index.php?page=Ticket477'); + $this->assertTitle("Verifying Ticket 477"); + $this->assertNotVisible("{$base}validator1"); + $this->assertNotVisible("{$base}validator2"); + + $this->clickAndWait("{$base}list1_c1"); + $this->assertVisible("{$base}validator1"); + $this->assertNotVisible("{$base}validator2"); + + + $this->clickAndWait("{$base}list2_c1"); + $this->assertNotVisible("{$base}validator1"); + $this->assertVisible("{$base}validator2"); + } +} + +?> \ No newline at end of file -- cgit v1.2.3