summaryrefslogtreecommitdiff
path: root/tests/FunctionalTests/features/protected/pages/ActiveControls/AutoComplete.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/FunctionalTests/features/protected/pages/ActiveControls/AutoComplete.php')
-rw-r--r--tests/FunctionalTests/features/protected/pages/ActiveControls/AutoComplete.php23
1 files changed, 20 insertions, 3 deletions
diff --git a/tests/FunctionalTests/features/protected/pages/ActiveControls/AutoComplete.php b/tests/FunctionalTests/features/protected/pages/ActiveControls/AutoComplete.php
index 81508000..3474234e 100644
--- a/tests/FunctionalTests/features/protected/pages/ActiveControls/AutoComplete.php
+++ b/tests/FunctionalTests/features/protected/pages/ActiveControls/AutoComplete.php
@@ -5,13 +5,30 @@
class AutoComplete extends TPage
{
- public function suggestEmails($sender, $param)
+ public function suggestCountries($sender, $param)
{
- $words = array('hello', 'world');
- $sender->setDataSource($words);
+ $sender->setDataSource($this->matchCountries($param->getParameter()));
$sender->dataBind();
$sender->render($param->getOutput());
}
+
+ 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