public static function task($name, $desc, $files = null, $addVerboseOption = true) { if (is_null($files)) { $files = pantr::fileset()->name('*Test.php')->in('test'); } $task = pantr::task($name, $desc); if ($addVerboseOption) { $task = $task->option('verbose')->shorthand('v')->desc('Output detailed test information'); } return $task->run(function ($req = array()) use($files) { return PHPUnit::forAllTests($files)->run(isset($req['verbose'])); }); }
rm('build', true); rm('dist', true); }); }); /** @hidden */ task('test:init', function () { require_once 'test/bootstrap.php'; }); /** * Run PHPUnit tests. * @option v:verbose display details * @dependsOn test:init */ task('test:unit', function ($req) { $tests = fileset('*Test.php')->in('test/unit'); return PHPUnit::forAllTests($tests)->run(isset($req['verbose']), 'test:unit'); }); /** * Runs PSpec tests * * @dependsOn test:init */ task('test:spec', function ($req) { $result = Spec::run('test/spec', array('verbose' => isset($req['verbose']), 'taskname' => 'test:spec')); }); /** * Runs PSpec "integration" tests - might take a while * * @dependsOn test:init */ task('test:integration', function ($req) {