7 * @author Kazuhiro Hosoi <hosoi@gree.co.jp>
8 * @license http://www.opensource.org/licenses/bsd-license.php The BSD License
13 /** ¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥Ù¡¼¥¹¥Ç¥£¥ì¥¯¥È¥ê */
14 define('BASE', dirname(dirname(__FILE__)));
16 // include_path¤ÎÀßÄê(¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥Ç¥£¥ì¥¯¥È¥ê¤òÄɲÃ)
20 /** Ethna´ØÏ¢¥¯¥é¥¹¤Î¥¤¥ó¥¯¥ë¡¼¥É */
21 include_once('Ethna/Ethna.php');
23 /** SimpleTest¤Î¥¤¥ó¥¯¥ë¡¼¥É */
24 include_once('simpletest/unit_tester.php');
25 include_once('simpletest/reporter.php');
27 /** ¥Æ¥¹¥È¥±¡¼¥¹¤¬¤¢¤ë¥Ç¥£¥ì¥¯¥È¥ê */
28 $test_dir = ETHNA_BASE . '/test';
30 $test = &new GroupTest('Ethna All tests');
32 // ¥Æ¥¹¥È¥±¡¼¥¹¤Î¥Õ¥¡¥¤¥ë¥ê¥¹¥È¤ò¼èÆÀ
33 $file_list = getFileList($test_dir);
36 foreach ($file_list as $file) {
37 $test->addTestFile($file);
40 // ·ë²Ì¤ò¥³¥Þ¥ó¥É¥é¥¤¥ó¤Ë½ÐÎÏ
41 $test->run(new TextReporter());
46 * @param string $dir_path
48 function getFileList($dir_path)
52 $dir = opendir($dir_path);
58 while($file_path = readdir($dir)) {
60 $full_path = $dir_path . '/'. $file_path;
62 if (is_file($full_path)){
64 // ¥Æ¥¹¥È¥±¡¼¥¹¤Î¥Õ¥¡¥¤¥ë¤Î¤ßÆɤ߹þ¤à
65 if (preg_match('/^(Ethna_)(.*)(_Test.php)$/',$file_path,$matches)) {
66 $file_list[] = $full_path;
69 // ¥µ¥Ö¥Ç¥£¥ì¥¯¥È¥ê¤¬¤¢¤ë¾ì¹ç¤Ï¡¤ºÆµ¢Åª¤ËÆɤ߹þ¤à¡¥
70 // "."¤Ç»Ï¤Þ¤ë¥Ç¥£¥ì¥¯¥È¥ê¤ÏÆɤ߹þ¤Þ¤Ê¤¤.
71 } else if (is_dir($full_path) && !preg_match('/^\./',$file_path,$matches)) {
73 $file_list = array_merge($file_list,getFileList($full_path));