From b5c7c7b77d33aa3e04ed6c16a489a2076a30f57a Mon Sep 17 00:00:00 2001 From: wei <> Date: Wed, 5 Jul 2006 07:30:55 +0000 Subject: Move tests around. --- test_tools/functional_tests.php | 66 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 test_tools/functional_tests.php (limited to 'test_tools/functional_tests.php') diff --git a/test_tools/functional_tests.php b/test_tools/functional_tests.php new file mode 100644 index 00000000..73bd6226 --- /dev/null +++ b/test_tools/functional_tests.php @@ -0,0 +1,66 @@ +_name=$name; + if($basePath==='' || ($this->_basePath=realpath($basePath))===false) + throw new Exception('Invalid base path '.$basePath); + $this->_basePath=strtr($this->_basePath,'\\','/'); + + $this->_selenium = $selenium.'selenium/'; + } + + public function run($simpleReporter) + { + $server=SimpleSeleniumProxyServer::getInstance(dirname(__FILE__));//, '', $this->_selenium); + + $groupTest=new GroupTest($this->_name); + $this->collectTestFiles($groupTest,$this->_basePath); + $groupTest->run($simpleReporter); + + $server->handleRequest(); + } + + protected function collectTestFiles($groupTest,$basePath) + { + $folder=@opendir($basePath); + while($entry=@readdir($folder)) + { + $fullPath=strtr($basePath.'/'.$entry,'\\','/'); + if(is_file($fullPath) && $this->isValidFile($entry)) + $groupTest->addTestFile($fullPath); + else if($entry[0]!=='.') + $this->collectTestFiles($groupTest,$fullPath); + } + @closedir($folder); + } + + protected function isValidFile($entry) + { + return preg_match('/\w+\.php$/',$entry); + } +} + +?> \ No newline at end of file -- cgit v1.2.3