本文整理汇总了PHP中SimpleTest::prefer方法的典型用法代码示例。如果您正苦于以下问题:PHP SimpleTest::prefer方法的具体用法?PHP SimpleTest::prefer怎么用?PHP SimpleTest::prefer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimpleTest
的用法示例。
在下文中一共展示了SimpleTest::prefer方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setPreference
public static function setPreference()
{
if (TextReporter::inCli()) {
SimpleTest::prefer(new Xml_Chris());
} else {
SimpleTest::prefer(new Html_Chris());
}
}
示例2: TextReporter
<?php
require_once 'simpletest/autorun.php';
require_once 'simpletest/WMS_web_tester.php';
SimpleTest::prefer(new TextReporter());
require_once '../institution.cfg.php';
require_once '../lang.cfg.php';
class SetupTestData extends TestSuite
{
function SetupTestData()
{
$this->TestSuite('Digital Field Notebooks test data creation');
# Setup test data
$this->addFile('TestOfSetupTestData.php');
}
}
示例3: paintException
require_once __DIR__ . '/../vendor/autoload.php';
require_once __DIR__ . '/../vendor/simpletest/simpletest/autorun.php';
$loader = new \Composer\Autoload\ClassLoader();
$loader->add('test', __DIR__ . '/..');
$loader->register();
class TraceReporter extends \TextReporter
{
public function paintException($exception)
{
parent::paintException($exception);
print $exception->getTraceAsString();
print "\n";
}
}
\SimpleTest::prefer(new TraceReporter());
class gihpPlumbingTests extends \TestSuite
{
public function __construct()
{
parent::__construct('Gihp plumbing tests');
$this->add(new plumbing\io());
$this->add(new plumbing\blob());
$this->add(new plumbing\tree());
$this->add(new plumbing\commit());
$this->add(new plumbing\annotatedtag());
$this->add(new plumbing\head());
$this->add(new plumbing\tag());
}
}
class gihpPorcelainTests extends \TestSuite
示例4: paintPass
{
function paintPass($message)
{
parent::paintPass($message);
print "&<span class=\"pass\">Pass</span>: ";
$breadcrumb = $this->getTestList();
array_shift($breadcrumb);
print implode("->", $breadcrumb);
print "->{$message}<br />\n";
}
protected function getCss()
{
return parent::getCss() . ' .pass { color: green; }';
}
}
SimpleTest::prefer(new ShowPasses());
require_once 'simpletest/autorun.php';
require_once 'blackjack.php';
class TestDeck implements Deck
{
private $deck = 0;
public function __construct($cardarray)
{
$this->deck = $cardarray;
}
public function next()
{
return array_shift($this->deck);
}
}
class TestBlackjackGame extends UnitTestCase
示例5: var_export
{
print "<pre>";
var_export($var);
print "</pre>";
}
}
if (!function_exists('printDebug')) {
function printDebug($text)
{
return;
}
}
require_once PIWIK_INCLUDE_PATH . '/core/Loader.php';
require_once PIWIK_INCLUDE_PATH . '/libs/Zend/Exception.php';
require_once PIWIK_INCLUDE_PATH . '/core/ErrorHandler.php';
require_once PIWIK_INCLUDE_PATH . '/libs/Zend/Registry.php';
require_once PIWIK_INCLUDE_PATH . '/libs/Zend/Db.php';
require_once PIWIK_INCLUDE_PATH . '/libs/Zend/Db/Table.php';
require_once PIWIK_INCLUDE_PATH . '/core/FrontController.php';
require_once PIWIK_INCLUDE_PATH . '/core/Config.php';
require_once PIWIK_INCLUDE_PATH . '/core/Timer.php';
require_once PIWIK_INCLUDE_PATH . '/core/Access.php';
require_once PIWIK_INCLUDE_PATH . '/core/Log.php';
require_once PIWIK_INCLUDE_PATH . '/core/Piwik.php';
assert_options(ASSERT_ACTIVE, 1);
assert_options(ASSERT_WARNING, 1);
assert_options(ASSERT_BAIL, 0);
define('PIWIK_CONFIG_TEST_INCLUDED', true);
require_once 'HtmlTimerReporter.php';
SimpleTest::prefer(new HtmlTimerReporter());
示例6: define
<?php
if (!defined("PIWIK_PATH_TEST_TO_ROOT")) {
define('PIWIK_PATH_TEST_TO_ROOT', '..');
}
if (!defined('PIWIK_INCLUDE_PATH')) {
define('PIWIK_INCLUDE_PATH', PIWIK_PATH_TEST_TO_ROOT);
}
set_include_path(PIWIK_INCLUDE_PATH . '/core/' . PATH_SEPARATOR . PIWIK_INCLUDE_PATH . '/libs/' . PATH_SEPARATOR . PIWIK_INCLUDE_PATH . '/plugins/');
require_once 'Loader.php';
require_once 'simpletest/autorun.php';
require_once 'simpletest/mock_objects.php';
SimpleTest::prefer(new HtmlReporter());
error_reporting(E_ALL | E_NOTICE);
date_default_timezone_set('Europe/London');
require_once "Zend/Exception.php";
require_once "Zend/Loader.php";
require_once "ErrorHandler.php";
//set_error_handler('Piwik_ErrorHandler');
function dump($var)
{
print "<pre>";
var_export($var);
print "</pre>";
}
require_once 'Zend/Registry.php';
require_once 'Zend/Config/Ini.php';
require_once 'Zend/Config.php';
require_once 'Zend/Db.php';
require_once 'Zend/Db/Table.php';
require_once 'FrontController.php';
示例7: dirname
<?php
# Includes the usual includes, saves constant repition
require_once dirname(__FILE__) . '/simpletest/autorun.php';
require_once dirname(__FILE__) . '/pretty_passes_reporter.php';
require_once dirname(__FILE__) . '/extended_web_test_case.php';
require_once dirname(__FILE__) . '/solr.php';
require_once dirname(__FILE__) . '/helpers.php';
require_once dirname(__FILE__) . '/similarity_test_case.php';
SimpleTest::prefer(new PrettyPassesReporter());
示例8: _getReporter
protected function _getReporter()
{
if (!$this->reporter) {
require_once dirname(__FILE__) . '/lmbTestShellReporter.class.php';
SimpleTest::prefer(new lmbTestShellReporter());
return clone SimpleTest::preferred(array('SimpleReporter', 'SimpleReporterDecorator'));
} else {
return clone $this->reporter;
}
}
示例9: paintHeader
/// A reporter that prints nothing unless a test fails
class QuietReporter extends TextReporter
{
function paintHeader($test_name)
{
// Store the test name for use later if we output anything
$this->test_name = $test_name;
}
function paintFooter($test_name)
{
if ($this->getFailCount() + $this->getExceptionCount() > 0) {
print "{$test_name}: Failures:\n";
print "Test cases run: " . $this->getTestCaseProgress() . "/" . $this->getTestCaseCount() . ", Passes: " . $this->getPassCount() . ", Failures: " . $this->getFailCount() . ", Exceptions: " . $this->getExceptionCount() . "\n";
}
}
function paintFail($message)
{
SimpleReporter::paintFail($message);
if ($this->getFailCount() <= 10) {
print $this->test_name . ": {$message}\n";
$breadcrumb = $this->getTestList();
array_shift($breadcrumb);
print "\tin " . implode("\n\tin ", array_reverse($breadcrumb));
print "\n";
}
}
}
// Use the quiet reporter if verbose output has not been requested
if (!getenv('UNITTEST_VERBOSE')) {
SimpleTest::prefer(new QuietReporter());
}
示例10: error_reporting
<?php
error_reporting((E_ALL | E_NOTICE) & ~E_DEPRECATED);
define("PATH_ROOT", "/Volumes/Users/Entwicklung/php/workspace/koala-2_1/classes/");
define("PATH_UNITTEST", "/Volumes/Users/Entwicklung/php/workspace/koala-2_1/classes/PHPsTeam/unittest/");
/*require(PATH_ROOT . 'Autoloader.class.php');
Autoloader::setCacheFilePath(PATH_ROOT . '../temp/class_path_cache.txt');
Autoloader::excludeFolderNamesMatchingRegex('/^CVS|\..*$/');
Autoloader::setClassPaths(array(
PATH_ROOT . "PHPsTeam/"
));
spl_autoload_register(array('Autoloader', 'loadClass'));*/
require PATH_ROOT . "autoloader/Autoloader.php";
Autoloader::getRegisteredAutoloader()->remove();
$autoloader = new Autoloader(PATH_ROOT);
$autoloader->register();
$autoloader->getIndex()->setIndexPath(PATH_ROOT . "../temp/phpsteam_unittest_autoloader.gz");
require_once 'classes/autorun.php';
//require_once PATH_UNITTEST . 'classes/simpletest.php';
//require_once PATH_UNITTEST . 'inc/showpasses.class.php';
SimpleTest::prefer(new showpasses());
class PHPsTeam_TestSuite extends TestSuite
{
function PHPsTeam_TestSuite()
{
$this->TestSuite("all PHPsTeam unit tests");
$this->addFile(PATH_UNITTEST . "steam_connector_test.class.php");
$this->addFile(PATH_UNITTEST . "steam_factory_test.class.php");
$this->addFile(PATH_UNITTEST . "steam_document_test.class.php");
}
}
示例11: define_url_test
*
* URL_TEST = http://127.0.0.1:8080/LOG210-LAB/;
*/
function define_url_test()
{
$url_test = "http://" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . dirname(URL);
if (strcmp($url_test[strlen($url_test) - 1], '/')) {
$url_test = $url_test . '/';
}
define('URL_TEST', $url_test);
}
require_once 'AfficherTest.php';
require_once 'simpletest/autorun.php';
require_once '../application/config/config.php';
require_once '../application/libs/controller.php';
SimpleTest::prefer(new AfficherTest());
define_url_test();
class AllTests extends TestSuite
{
function AllTests()
{
$this->TestSuite('All tests');
// Commence par test les models
$this->addFile('test_models_user.php');
$this->addFile('test_models_restaurant.php');
// Test la création de comptes divers et de restaurants
$this->addFile('test_user_creation.php');
$this->addFile('test_restaurant_creation.php');
// Test la gestion de comptes et restaurants
$this->addFile('test_user_manage.php');
$this->addFile('test_restaurant_manage.php');