summaryrefslogtreecommitdiff
path: root/tests/FunctionalTests
diff options
context:
space:
mode:
authorwei <>2007-04-12 08:05:03 +0000
committerwei <>2007-04-12 08:05:03 +0000
commitdc3bf922d9715bfd1b2105be04a9aabc84a1d7d4 (patch)
treeff97362f718b6ebb482128527402efe03fe1ac43 /tests/FunctionalTests
parent6178a99df0c722581bc61e35559ac5f8af1cc6e8 (diff)
Refactor and add TTableGateway, System.Data.Common, System.Data.DataGateway
Diffstat (limited to 'tests/FunctionalTests')
-rw-r--r--tests/FunctionalTests/features/protected/pages/ClientScripts.page6
-rw-r--r--tests/FunctionalTests/features/protected/pages/MyJavascriptLib.php32
-rw-r--r--tests/FunctionalTests/features/protected/pages/TestComp.php20
-rw-r--r--tests/FunctionalTests/features/protected/pages/myscripts/packages.php10
4 files changed, 68 insertions, 0 deletions
diff --git a/tests/FunctionalTests/features/protected/pages/ClientScripts.page b/tests/FunctionalTests/features/protected/pages/ClientScripts.page
new file mode 100644
index 00000000..18aca48b
--- /dev/null
+++ b/tests/FunctionalTests/features/protected/pages/ClientScripts.page
@@ -0,0 +1,6 @@
+<com:TContent ID="Content">
+
+<com:Application.pages.TestComp Class="test"/>
+<com:Application.pages.TestComp Class="test"/>
+
+</com:TContent> \ No newline at end of file
diff --git a/tests/FunctionalTests/features/protected/pages/MyJavascriptLib.php b/tests/FunctionalTests/features/protected/pages/MyJavascriptLib.php
new file mode 100644
index 00000000..964b48a5
--- /dev/null
+++ b/tests/FunctionalTests/features/protected/pages/MyJavascriptLib.php
@@ -0,0 +1,32 @@
+<?php
+
+class MyJavascriptLib extends TComponent
+{
+ private $_packages=array(); //keep track of all registrations
+
+ private $_manager;
+
+ protected function __construct(TPage $owner)
+ {
+ $this->_manager = $owner->getClientScript();
+ $owner->onPreRenderComplete = array($this, 'registerScriptLoader');
+ }
+
+ public static function registerPackage(TControl $control, $name)
+ {
+ static $instance;
+ if($instance===null)
+ $instance=new self($control->getPage());
+ $instance->_packages[$name]=true;
+ }
+
+ protected function registerScriptLoader()
+ {
+ $dir = dirname(__FILE__).'/myscripts'; //contains my javascript files
+ $scripts = array_keys($this->_packages);
+ $url = $this->_manager->registerJavascriptPackages($dir, $scripts);
+ $this->_manager->registerScriptFile($url,$url);
+ }
+}
+
+?> \ No newline at end of file
diff --git a/tests/FunctionalTests/features/protected/pages/TestComp.php b/tests/FunctionalTests/features/protected/pages/TestComp.php
new file mode 100644
index 00000000..f9d02c77
--- /dev/null
+++ b/tests/FunctionalTests/features/protected/pages/TestComp.php
@@ -0,0 +1,20 @@
+<?php
+
+Prado::using('Application.pages.MyJavascriptLib');
+
+class TestComp extends TControl
+{
+ private $_class;
+ public function setClass($value)
+ {
+ $this->_class=$value;
+ }
+
+ public function onPreRender($param)
+ {
+ parent::onPreRender($param);
+ MyJavascriptLib::registerPackage($this,$this->_class);
+ }
+}
+
+?> \ No newline at end of file
diff --git a/tests/FunctionalTests/features/protected/pages/myscripts/packages.php b/tests/FunctionalTests/features/protected/pages/myscripts/packages.php
new file mode 100644
index 00000000..41561a71
--- /dev/null
+++ b/tests/FunctionalTests/features/protected/pages/myscripts/packages.php
@@ -0,0 +1,10 @@
+<?php
+
+$packages['test'] = array('test.js');
+
+$deps['test'] = array('test');
+$deps['test2'] = array('test');
+
+return array($packages,$deps);
+
+?> \ No newline at end of file