本文整理汇总了PHP中TextReporter::inCli方法的典型用法代码示例。如果您正苦于以下问题:PHP TextReporter::inCli方法的具体用法?PHP TextReporter::inCli怎么用?PHP TextReporter::inCli使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextReporter
的用法示例。
在下文中一共展示了TextReporter::inCli方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setPreference
public static function setPreference()
{
if (TextReporter::inCli()) {
SimpleTest::prefer(new Xml_Chris());
} else {
SimpleTest::prefer(new Html_Chris());
}
}
示例2: report
/**
* Genereates a nice report of the test.
*
* It instantiate a SimpleTest TestSuite and launches a Reporter.
* This method is typically called by a TestRunner.
*
* @return void
* @see KortTestRunner
* @see KortCliReporter
* @see KortHTMLReporter
*/
public function report()
{
$test = new \TestSuite($this->getLabel());
$test->add($this);
if (\TextReporter::inCli()) {
exit($test->run(new KortCliReporter()) ? 0 : 1);
}
$test->run(new KortHTMLReporter());
}
示例3: defined
<?php
defined('ALL_TESTS_CALL') ? null : define("ALL_TESTS_CALL", true);
defined('AK_ENABLE_PROFILER') ? null : define('AK_ENABLE_PROFILER', true);
defined('AK_TEST_DATABASE_ON') ? null : define('AK_TEST_DATABASE_ON', true);
require_once dirname(__FILE__) . '/../../fixtures/config/config.php';
if (!defined('ALL_TESTS_RUNNER') && empty($test)) {
$test = new GroupTest('Akelos Framework Active Record Tests');
define('ALL_TESTS_RUNNER', false);
@session_start();
}
//these partials are not refactored yet. so they must be run in sequence!
$partial_tests = array('_AkActiveRecord_1.php', '_AkActiveRecord_2.php', '_AkActiveRecord_3.php');
foreach ($partial_tests as $partial_test) {
$test->addTestFile(AK_LIB_TESTS_DIRECTORY . DS . 'AkActiveRecord' . DS . $partial_test);
}
foreach (Ak::dir(AK_LIB_TESTS_DIRECTORY . DS . 'AkActiveRecord') as $active_record_test) {
if (!is_array($active_record_test) && !in_array($active_record_test, $partial_tests)) {
if (!ALL_TESTS_RUNNER || $active_record_test[0] == '_') {
$test->addTestFile(AK_LIB_TESTS_DIRECTORY . DS . 'AkActiveRecord' . DS . $active_record_test);
}
}
}
if (!ALL_TESTS_RUNNER) {
if (TextReporter::inCli()) {
exit($test->run(new TextReporter()) ? 0 : 1);
}
$test->run(new HtmlReporter());
}
示例4: ak_test
function ak_test($test_case_name, $use_sessions = false)
{
if (!defined('ALL_TESTS_CALL')) {
$use_sessions ? @session_start() : null;
$test =& new $test_case_name();
if (defined('AK_CLI') && AK_CLI || TextReporter::inCli() || defined('AK_CONSOLE_MODE') && AK_CONSOLE_MODE || defined('AK_WEB_REQUEST') && !AK_WEB_REQUEST) {
$test->run(new TextReporter());
} else {
$test->run(new HtmlReporter());
}
}
}
示例5: dirname
<?php
require_once 'simpletest/unit_tester.php';
require_once 'simpletest/reporter.php';
require_once dirname(__FILE__) . '/addendum_test.php';
require_once dirname(__FILE__) . '/acceptance_test.php';
require_once dirname(__FILE__) . '/annotation_test.php';
require_once dirname(__FILE__) . '/constrained_annotation_test.php';
require_once dirname(__FILE__) . '/annotation_parser_test.php';
require_once dirname(__FILE__) . '/doc_comment_test.php';
$suite = new TestSuite('All tests');
$suite->add(new TestOfAddendum());
$suite->add(new TestOfAnnotations());
$suite->add(new TestOfPerformanceFeatures());
$suite->add(new TestOfSupportingFeatures());
$suite->add(new TestOfAnnotation());
$suite->add(new TestOfAnnotationCollection());
$suite->add(new TestOfConstrainedAnnotation());
$suite->add(new TestOfMatchers());
$suite->add(new TestOfAnnotationMatchers());
$suite->add(new TestOfDocComment());
if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
require_once dirname(__FILE__) . '/namespaces_test.php';
$suite->add(new TestOfNamespaces());
}
$reporter = TextReporter::inCli() ? new TextReporter() : new HtmlReporter();
Addendum::setRawMode(false);
$suite->run($reporter);
Addendum::setRawMode(true);
$suite->run($reporter);
示例6: ak_test
function ak_test($test_case_name, $use_sessions = false, $prevent_double_test_running = true, $custom_reporter = false)
{
static $ran_tests = array();
if (!isset($ran_tests[$test_case_name]) || !$prevent_double_test_running) {
if (!defined('ALL_TESTS_CALL')) {
$use_sessions ? @session_start() : null;
$test = new $test_case_name();
if (empty($custom_reporter)) {
if (defined('AK_CLI') && AK_CLI || TextReporter::inCli() || defined('AK_CONSOLE_MODE') && AK_CONSOLE_MODE || defined('AK_WEB_REQUEST') && !AK_WEB_REQUEST) {
$test->run(new TextReporter());
} else {
$test->run(new HtmlReporter());
}
} else {
$test->run(new $custom_reporter());
}
}
$ran_tests[$test_case_name] = true;
}
}
示例7: run_tests
public function run_tests($argv)
{
error_reporting(E_ALL ^ E_WARNING ^ E_NOTICE);
define("ENV", "test");
$this->app_setup();
define("CLI_ENV", true);
if (!(include 'simpletest/unit_tester.php') || !(include 'simpletest/mock_objects.php')) {
throw new WXDependencyException("Simpletest library required. Install it somewhere in the include path", "Simpletest Dependency Failure");
}
if ($argv[1] == "wax") {
$testdir = FRAMEWORK_DIR . "/tests";
} elseif ($argv[1] && is_dir(PLUGIN_DIR . $argv[1] . "/tests")) {
$testdir = PLUGIN_DIR . $argv[1] . "/tests";
} else {
$testdir = APP_DIR . "tests";
}
AutoLoader::include_dir($testdir);
$test = new GroupTest('All tests');
foreach (scandir($testdir) as $file) {
if (substr($file, -3) == "php" && substr($file, 0, 1) != ".") {
$class = substr($file, 0, -4);
$test->addTestClass($class);
}
}
if (TextReporter::inCli()) {
exit($test->run(new TextReporter()) ? 0 : 1);
}
$test->run(new HtmlReporter());
}