7 * @author Kazuhiro Hosoi <hosoi@gree.co.jp>
8 * @license http://www.opensource.org/licenses/bsd-license.php The BSD License
13 /** Ethnaインストールルートディレクトリ */
14 define('ETHNA_INSTALL_BASE', dirname(dirname(__FILE__)));
16 /** include_pathの設定(このtest runnerがあるディレクトリを追加) */
17 ini_set('include_path', dirname(ETHNA_INSTALL_BASE) . PATH_SEPARATOR . ini_get('include_path'));
19 /** Ethna関連クラスのインクルード */
20 require_once 'Ethna/Ethna.php';
22 /** SimpleTestのインクルード */
23 require_once 'simpletest/unit_tester.php';
24 require_once 'simpletest/reporter.php';
25 require_once 'Ethna/test/TextDetailReporter.php';
26 require_once 'Ethna/test/Ethna_UnitTestBase.php';
28 /** テストケースがあるディレクトリ */
29 $test_dir = ETHNA_INSTALL_BASE . '/test';
31 $test = &new GroupTest('Ethna All tests');
34 require_once ETHNA_INSTALL_BASE . '/class/Ethna_Getopt.php';
35 $opt = new Ethna_Getopt();
36 $args = $opt->readPHPArgv();
37 list($args, $opts) = $opt->getopt($args, '', array());
39 if (count($opts) > 0) {
42 $file_list = getFileList($test_dir);
46 foreach ($file_list as $file) {
47 $test->addTestFile($file);
51 $test->run(new TextDetailReporter());
57 * @param string $dir_path
59 function getFileList($dir_path)
63 $dir = opendir($dir_path);
69 while($file_path = readdir($dir)) {
71 $full_path = $dir_path . '/'. $file_path;
73 if (is_file($full_path)){
76 if (preg_match('/^(Ethna_)(.*)(_Test.php)$/',$file_path,$matches)) {
77 $file_list[] = $full_path;
80 // サブディレクトリがある場合は,再帰的に読み込む.
81 // "."で始まるディレクトリは読み込まない.
82 } else if (is_dir($full_path) && !preg_match('/^\./',$file_path,$matches)) {
84 $file_list = array_merge($file_list,getFileList($full_path));