本文整理汇总了PHP中TestRunner类的典型用法代码示例。如果您正苦于以下问题:PHP TestRunner类的具体用法?PHP TestRunner怎么用?PHP TestRunner使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TestRunner类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: run
public static function run($className)
{
$runner = new TestRunner();
$rc = new ReflectionClass($className);
$methods = $rc->GetMethods(ReflectionMethod::IS_PUBLIC);
foreach ($methods as $m) {
$name = $m->name;
if (!$runner->isValidTest($name)) {
continue;
}
$count = count($className::$errors);
$rt = new $className();
try {
$rt->setUp();
$rt->{$name}();
echo $count === count($className::$errors) ? "." : "F";
} catch (Exception $e) {
if ($e instanceof RedisException) {
$className::$errors[] = "Uncaught exception '" . $e->getMessage() . "' ({$name})\n";
echo 'F';
} else {
echo 'S';
}
}
}
echo "\n";
echo implode('', $className::$warnings);
if (empty($className::$errors)) {
echo "All tests passed.\n";
return 0;
}
echo implode('', $className::$errors);
return 1;
}
开发者ID:stonegithubs,项目名称:phpredis,代码行数:34,代码来源:test.php
示例2: runner
public function runner($reg = NULL)
{
$runner = new TestRunner();
if (!empty($reg)) {
$runner->useRegistry($reg);
}
return $runner;
}
开发者ID:masterminds,项目名称:fortissimo,代码行数:8,代码来源:TestCase.php
示例3: TestRunner
static function &get($directory = null, $writer = 'TextualWriter')
{
static $instance;
if (!isset($instance)) {
$instance = new TestRunner($directory);
$instance->set_writer(new $writer());
}
return $instance;
}
开发者ID:ento,项目名称:publishToMixi,代码行数:9,代码来源:phpunit.php
示例4: testPhpRQ
public function testPhpRQ()
{
if (!self::$redis instanceof Client) {
throw new \Exception('The PhpRQ test suit can be run only with php-rq-run-tests binary or by implementing
the ClientProvider and running the TestRunner in your test suite.');
}
$redisProvider = new ClientProvider();
$redisProvider->registerProvider(function () {
self::$redis->flushdb();
self::$redis->script('flush');
return self::$redis;
});
$test = new TestRunner($redisProvider);
$test->run();
}
开发者ID:gitter-badger,项目名称:php-rq,代码行数:15,代码来源:PhpRQTest.php
示例5: parse_options
function parse_options()
{
$options = getopt("h", array("clients-count:", "log-junit", "verbose", "build"));
if (isset($options['h'])) {
print_info();
die;
}
if (isset($options['build'])) {
$options['verbose'] = true;
$options['log-junit'] = true;
}
if (isset($options['clients-count'])) {
define('SELENIUM_CLIENTS_COUNT', $options['clients-count']);
}
if (isset($options['log-junit'])) {
TestRunner::$log_xml = true;
shell_exec("rm /tmp/TEST*.xml");
}
if (isset($options['verbose'])) {
TestRunner::$verbose = true;
}
if (!defined('SELENIUM_CLIENTS_COUNT')) {
define('SELENIUM_CLIENTS_COUNT', 5);
}
$runner = new testRunner();
$runner->start(SELENIUM_CLIENTS_COUNT);
}
开发者ID:kingsj,项目名称:core,代码行数:27,代码来源:phpunit-parallel.php
示例6: init
function init()
{
parent::init();
if (!Permission::check('ADMIN')) {
return Security::permissionFailure();
}
TestRunner::use_test_manifest();
}
开发者ID:rixrix,项目名称:sapphire,代码行数:8,代码来源:CodeViewer.php
示例7: process
/**
* Loads kernel file.
*
* @param ContainerBuilder $container
*/
public function process(ContainerBuilder $container)
{
// Connect to database and build manifest
$frameworkPath = $container->getParameter('behat.silverstripe_extension.framework_path');
$_GET['flush'] = 1;
require_once $frameworkPath . '/core/Core.php';
\TestRunner::use_test_manifest();
unset($_GET['flush']);
// Remove the error handler so that PHPUnit can add its own
restore_error_handler();
}
开发者ID:jeffreyguo,项目名称:silverstripe-behat-extension,代码行数:16,代码来源:CoreInitializationPass.php
示例8: testIsTestFile
public function testIsTestFile()
{
$this->guy->createTestFolderTree($this->tmpPath1);
$this->assertTrue($this->guy->isTestFolderTree($this->tmpPath1));
// real tests
$this->assertTrue(TestRunner::isTestFile($this->tmpPath1 . DS . 'subFolder1' . DS . 'unit' . DS . 'funTest.php'));
$this->assertTrue(TestRunner::isTestFile($this->tmpPath1 . DS . 'subFolder2' . DS . 'unit' . DS . 'boringTestCest.php'));
$this->assertTrue(TestRunner::isTestFile($this->tmpPath1 . DS . 'subFolder2' . DS . 'unit' . DS . 'interestingTestCept.php'));
// not real tests
$this->assertFalse(TestRunner::isTestFile($this->tmpPath1 . DS . 'README.txt'));
$this->assertFalse(TestRunner::isTestFile($this->tmpPath1 . DS . 'nonExistentFile.txt'));
}
开发者ID:2pisoftware,项目名称:testrunner,代码行数:12,代码来源:TestRunnerTest.php
示例9: beforeRunTests
/**
* Overwrites beforeRunTests. Initiates coverage-report generation if
* $coverage has been set to true (@see setCoverageStatus).
*/
protected function beforeRunTests()
{
if ($this->getCoverageStatus()) {
// blacklist selected folders from coverage report
$modules = $this->moduleDirectories();
foreach (TestRunner::config()->coverage_filter_dirs as $dir) {
if ($dir[0] == '*') {
$dir = substr($dir, 1);
foreach ($modules as $module) {
PHPUnit_Util_Filter::addDirectoryToFilter(BASE_PATH . '/' . $dir);
}
} else {
PHPUnit_Util_Filter::addDirectoryToFilter(BASE_PATH . '/' . $dir);
}
}
$this->getFrameworkTestResults()->collectCodeCoverageInformation(true);
}
}
开发者ID:jakedaleweb,项目名称:AtomCodeChallenge,代码行数:22,代码来源:PhpUnitWrapper_3_4.php
示例10: beforeRunTests
/**
* Overwrites beforeRunTests. Initiates coverage-report generation if
* $coverage has been set to true (@see setCoverageStatus).
*/
protected function beforeRunTests()
{
if ($this->getCoverageStatus()) {
$this->coverage = new PHP_CodeCoverage();
$coverage = $this->coverage;
$filter = $coverage->filter();
$modules = $this->moduleDirectories();
foreach (TestRunner::config()->coverage_filter_dirs as $dir) {
if ($dir[0] == '*') {
$dir = substr($dir, 1);
foreach ($modules as $module) {
$filter->addDirectoryToBlacklist(BASE_PATH . "/{$module}/{$dir}");
}
} else {
$filter->addDirectoryToBlacklist(BASE_PATH . '/' . $dir);
}
}
$filter->addFileToBlacklist(__FILE__, 'PHPUNIT');
$coverage->start(self::get_test_name());
}
}
开发者ID:jareddreyer,项目名称:catalogue,代码行数:25,代码来源:PhpUnitWrapper_3_5.php
示例11: files
php RunTests.php [options] [file or directory]
Options:
-p <php> Specify PHP-CGI executable to run.
-c <path> Look for php.ini in directory <path> or use <path> as php.ini.
-d key=val Define INI entry 'key' with value 'val'.
-l <path> Specify path to shared library files (LD_LIBRARY_PATH)
-s Show information about skipped tests
<?php
}
/**
* Execute tests
*/
try {
@unlink(__DIR__ . '/coverage.dat'); // @ - file may not exist
$manager = new TestRunner;
$manager->parseArguments();
$res = $manager->run();
die($res ? 0 : 1);
} catch (Exception $e) {
echo 'Error: ', $e->getMessage(), "\n";
die(2);
}
开发者ID:redhead,项目名称:nette,代码行数:30,代码来源:RunTests.php
示例12: tests
function tests($request)
{
return TestRunner::create();
}
开发者ID:prostart,项目名称:cobblestonepath,代码行数:4,代码来源:DevelopmentAdmin.php
示例13: validateArgv
$this->fail($e->getMessage());
}
}
private function validateArgv()
{
try {
$argvLen = count($this->argv);
foreach (range(1, $argvLen - 1) as $argvIndex) {
if (preg_match('/\\.php$/', $this->argv[$argvIndex])) {
$this->testFile = $this->argv[$argvIndex];
}
}
if ($this->testFile == null) {
throw new \Exception('Missing argument: test file');
}
// if($argvLen > 2) {
// throw new \Exception('Too many arguments');
// }
} catch (\Exception $e) {
$this->fail($e->getMessage());
}
}
}
// $stop = getopt('', ['stop-on-fail:']);
// var_dump($stop);
// die();
// var_dump($argv);
// //var_dump($argc);
// die();
$testRunner = new TestRunner($argv);
$testRunner->run();
开发者ID:aaleksu,项目名称:fun_tests,代码行数:31,代码来源:run.php
示例14: testUpgrade
/**
* The master test class that performs the various upgrades of the system,
* and calls private methods to test various sections of the upgrade.
*/
function testUpgrade()
{
$aConf = $GLOBALS['_MAX']['CONF'];
// Run the tests for every set of preferences that have been defined
foreach (array_keys($this->aPrefsOld) as $set) {
if ($set == 1 && $aConf['database']['type'] != 'mysql') {
// OpenX 2.4.4 is only valid for MySQL
continue;
}
// Initialise the database at schema 542
$this->initDatabase(542, array('agency', 'affiliates', 'application_variable', 'audit', 'channel', 'clients', 'preference', 'preference_advertiser', 'preference_publisher', 'acls', 'acls_channel', 'banners', 'campaigns', 'tracker_append', 'trackers', 'userlog', 'variables', 'zones'));
// Set up the database with the standard set of accounts,
// preferences and settings
$this->_setupAccounts();
$this->_setupPreferences($set);
// Perform the required upgrade on the database
$this->upgradeToVersion(543);
$this->upgradeToVersion(544);
$this->upgradeToVersion(546);
// Test the results of the upgrade
$this->_testMigratePrefsToSettings($set);
$this->_testMigratePrefsToAppVars($set);
$this->_testMigratePrefsToPrefs($set);
$this->_testMigrateUsers($set);
// Restore the testing environment
TestRunner::setupEnv(null);
$this->oDbh =& OA_DB::singleton();
}
}
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:33,代码来源:UserMigration.mig.test.php
示例15: dirname
<?php
ini_set("display_errors", 1);
ini_set("error_reporting", E_ALL);
require_once dirname(__FILE__).DIRECTORY_SEPARATOR."config.php";
require_once "PHPUnit/Autoload.php";
require_once "class/TestRunner.php";
$includeCoverage = false;
if(isset($_GET["coverage"]))
{
$includeCoverage = true;
}
$runner = new TestRunner(false);
if(isset($testSuite))
{
foreach($testSuite as $onePath)
{
$runner->readFolder($onePath);
}
}
if(isset($codeCoverageIgnoreDirectoryList))
{
foreach($codeCoverageIgnoreDirectoryList as $oneDirectory)
{
$runner->codeCoverageIgnoreDirectory($oneDirectory);
}
}
开发者ID:ramielrowe,项目名称:Radford-Reservation-System,代码行数:31,代码来源:testLauncher.php
示例16: catch
}
}
}
// check results
$this->check($test, $test->expect, $result);
} catch (JsonLdException $e) {
echo $eol . $e;
$this->failed += 1;
echo "FAIL{$eol}";
}
}
if (property_exists($manifest, 'name')) {
$this->ungroup();
}
}
}
}
// get command line options
$options = getopt('d:');
if ($options === false || !array_key_exists('d', $options)) {
$var = 'path to json-ld.org/test-suite/tests';
echo "Usage: php jsonld-tests.php -d <{$var}>{$eol}";
exit(0);
}
// load and run tests
$tr = new TestRunner();
$tr->group('JSON-LD');
$tr->run($tr->load($options['d']));
$tr->ungroup();
echo "Done. Total:{$tr->total} Passed:{$tr->passed} Failed:{$tr->failed}{$eol}";
/* end of file, omit ?> */
开发者ID:iAhmadZain,项目名称:iksce,代码行数:31,代码来源:jsonld-tests.php
示例17: setUp
return "Hello, " . $name;
}
}
class GreeterTest
{
private $testObj;
public function setUp()
{
$this->testObj = new Greeter();
}
public function testGreetUsesNameInHelloMessage()
{
$name = "Justin";
$expected = "Hello, " . $name;
$actual = $this->testObj->greet($name);
Test::assertEqual($expected, $actual);
}
public function testGreetAddsWorldWhenNameIsNotSpecified()
{
$expected = "Hello, World";
$actual = $this->testObj->greet("");
Test::assertEqual($expected, $actual);
}
public function tearDown()
{
unset($this->testObj);
}
}
TestRunner::addTestClass("GreeterTest");
TestRunner::runAll();
开发者ID:EyeOfMidas,项目名称:punit-lib,代码行数:30,代码来源:UsingClassesTest.php
示例18: array
$output = array();
}
// run all test suites in each test folder
$passedAllTests = true;
foreach ($testFolders as $key => $folder) {
// take a snapshot of all log files
$snapshots = [];
if (!empty(TestConfig::getConfig('testLogFiles'))) {
foreach (explode(",", TestConfig::getConfig('testLogFiles')) as $k => $logFile) {
$snapshots[$logFile] = FileSystemTools::tail($logFile, 30);
}
}
// run the test
echo 'RUN TESTS ' . $folder;
ob_start();
$testResult = TestRunner::runTests($folder);
$testOutput = ob_get_contents();
ob_end_clean();
if (!$testResult['result']) {
$passedAllTests = false;
$output[] = "TEST FAILED";
} else {
$output[] = "TEST PASSED";
}
$output[] = $testOutput;
//$output=array_merge($output,$testResult['output']);
// CHECK PHP LOG FILE
if (!empty(TestConfig::getConfig('testLogFiles'))) {
foreach (explode(",", TestConfig::getConfig('testLogFiles')) as $k => $logFile) {
$lines = FileSystemTools::checkChangesToFile($snapshots[$logFile], $logFile);
if (count($lines) > 0) {
开发者ID:2pisoftware,项目名称:testrunner,代码行数:31,代码来源:index.php
示例19: TestSuite
$this->Mail->AddAddress(get("mail_to"));
$this->assert($this->Mail->Send(), "Send failed");
}
}
/**
* Create and run test instance.
*/
if (isset($HTTP_GET_VARS)) {
$global_vars = $HTTP_GET_VARS;
} else {
$global_vars = $_REQUEST;
}
if (isset($global_vars["submitted"])) {
echo "Test results:<br>";
$suite = new TestSuite("phpmailerTest");
$testRunner = new TestRunner();
$testRunner->run($suite);
echo "<hr noshade/>";
}
function get($sName)
{
global $global_vars;
if (isset($global_vars[$sName])) {
return $global_vars[$sName];
} else {
return "";
}
}
?>
<html>
开发者ID:piotrPiechura,项目名称:3dPathProject,代码行数:31,代码来源:phpmailer_test.php
示例20: findTestFolders
static function findTestFolders($paths)
{
$suites = array();
foreach (explode("::::", $paths) as $path) {
if (is_dir($path)) {
if (TestRunner::isTestSuiteFolder($path)) {
$stagingSuiteName = str_replace(':', '_', str_replace(DS, '_', $path));
$suites[$stagingSuiteName] = $path;
}
$objects = scandir($path);
if (sizeof($objects) > 0) {
foreach ($objects as $file) {
if ($file == "." || $file == "..") {
continue;
}
if (is_dir($path . DS . basename($file))) {
if (TestRunner::isTestSuiteFolder($path . DS . basename($file))) {
$stagingSuiteName = str_replace(':', '_', str_replace(DS, '_', $path . DS . basename($file)));
// ensure absolute file references
$suites[$stagingSuiteName] = $path . DS . basename($file);
}
// recurse into folder
$suites = array_merge($suites, TestRunner::findTestFolders($path . DS . basename($file)));
}
}
}
}
}
return $suites;
}
开发者ID:2pisoftware,项目名称:testrunner,代码行数:30,代码来源:TestRunner.php
注:本文中的TestRunner类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论