Source for file ethna_run_test.php
Documentation is available at ethna_run_test.php
* @author Kazuhiro Hosoi <hosoi@gree.co.jp>
* @license http://www.opensource.org/licenses/bsd-license.php The BSD License
* @version $Id: d16562e7ebc3613271e9118a5894276b324b62c5 $
/** Ethnaインストールルートディレクトリ */
define('ETHNA_INSTALL_BASE', dirname(dirname(__FILE__
)));
$symlink_filename =
null;
/** シンボリックリンクをインストールディレクトリの親に張る */
/** symlink 関数は 5.3.0 以前では Windows 上で動作しない */
/** が、Cygwinでテストするため問題はない。 */
echo
"Base dir 'Ethna' exists and it's not ETHNA_INSTALL_BASE.\n";
// もとから存在した symlink は削除しない
$symlink_filename =
null;
/** include_pathの設定(このtest runnerがあるディレクトリを追加) */
//ini_set('include_path', realpath(ETHNA_INSTALL_BASE . '/class') . PATH_SEPARATOR . ini_get('include_path'));
require_once 'Ethna/Ethna.php';
// simpletest を使っているため、E_DEPRECATED, E_STRICT は解除
require_once 'simpletest/unit_tester.php';
require_once 'simpletest/reporter.php';
require_once $test_dir .
'/TextSimpleReporter.php';
require_once $test_dir .
'/TextDetailReporter.php';
require_once $test_dir .
'/UnitTestBase.php';
$test =
new TestSuite('Ethna All tests');
require_once 'Ethna/class/Getopt.php';
$args =
$opt->readPHPArgv();
$opt_ret =
$opt->getopt($args, "", array('coverage', 'verbose'));
echo
$opt_ret->getMessage(), PHP_EOL;
list
($args, $opts) =
$opt_ret;
foreach ($args as $arg) {
foreach ($file_list as $file) {
require_once 'PHP/CodeCoverage.php';
$filter =
PHP_CodeCoverage_Filter::getInstance();
$filter->addDirectoryToBlacklist($base.
'/test');
$filter->addDirectoryToBlacklist($base .
'/src');
$filter->addDirectoryToBlacklist($base .
'/bin');
$filter->addFileToBlacklist(__FILE__
);
require_once 'PEAR/Config.php';
$pear_config =
PEAR_Config::singleton();
$pear_dir =
$pear_config->get('php_dir');
$filter->addDirectoryToBlacklist($pear_dir);
$code_coverage =
new PHP_CodeCoverage();
$code_coverage->start('ethna');
$test->run(new TextDetailReporter());
$test->run(new TextSimpleReporter());
if ($symlink_filename !==
null &&
is_link($symlink_filename)) {
require
'PHP/CodeCoverage/Report/HTML.php';
$writer =
new PHP_CodeCoverage_Report_HTML();
$writer->process($code_coverage, getcwd().
'/coverage');
* @param string $dir_path
while($file_path =
readdir($dir)) {
$full_path =
$dir_path .
'/'.
$file_path;
if (preg_match('/^(.*)(_Test.php)$/',$file_path,$matches)) {
$file_list[] =
$full_path;
// サブディレクトリがある場合は,再帰的に読み込む.
Documentation generated on Fri, 11 Nov 2011 03:58:06 +0900 by phpDocumentor 1.4.3