本文整理汇总了PHP中runTest函数的典型用法代码示例。如果您正苦于以下问题:PHP runTest函数的具体用法?PHP runTest怎么用?PHP runTest使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了runTest函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testBasic
public function testBasic()
{
runTest(1, 'boolean sanity');
runTest(file_exists(COMMON_FILE_LOCATION), '/includes/common.php exists');
require_once COMMON_FILE_LOCATION;
runTest(class_exists('Database'), 'Database class exists');
runTest(class_exists('ErrorHandler'), 'ErrorHandler class exists');
runTest(intval(ini_get('register_globals')) == '0', 'Register globals turned off');
runTest(get_magic_quotes_gpc() === 0, 'Magic quotes turned off');
runTest(version_compare(PHP_VERSION, '5.0.0', '>'), 'PHP Version is reasonable');
runTest(file_exists(CFG_FILE_PATH), 'Config file exists');
require_once CFG_FILE_PATH;
runTest(!is_writable(CFG_FILE_PATH), 'Config file is not writable from webserver', true);
runTest(defined('CFG_DB_DSN'), 'Defined: DB_DSN');
runTest(defined('CFG_DB_USER'), 'Defined: DB_USER');
runTest(defined('CFG_DB_PASS'), 'Defined: DB_PASS');
runTest(defined('CFG_PASSWORD_SALT'), 'Defined: password salt');
runTest(strlen(CFG_PASSWORD_SALT) >= 15, 'Password salt length');
runTest(file_exists(PWD . 'htdocs'), 'htdocs exists');
runTest(function_exists('mysql_connect'), 'mysql_ functions are installed');
runTest(function_exists('mysqli_connect'), 'mysqli_ functions are installed', true);
runTest(class_exists('PDO'), 'PDO exists');
}
示例2: BadAuthDigestTestController
<?php
require_once 'test_base.inc';
function BadAuthDigestTestController($serverPort)
{
$args = array('Authorization' => 'Digest "username="admin", ' . 'realm="Restricted area", nonce="564a12f5c065e", ' . 'uri="/test_auth_digest.php", cnonce="MjIyMTg2", nc=00000001, ' . 'qop="auth", response="6dfbea52fbf13016476c1879e6436004", ' . 'opaque="cdce8a5c95a1427d74df7acbf41c9ce0"');
var_dump(request(php_uname('n'), $serverPort, "test_auth_digest.php", [], [], $args));
}
function GoodAuthDigestTestController($serverPort)
{
$args = array('Authorization' => 'Digest username="admin", ' . 'realm="Restricted area", nonce="564a12611dae8", ' . 'uri="/test_auth_digest.php", cnonce="MjIyMTg1", nc=00000001, ' . 'qop="auth", response="e544aaed06917adea3e5c74dd49f0e32", ' . 'opaque="cdce8a5c95a1427d74df7acbf41c9ce0"');
var_dump(request(php_uname('n'), $serverPort, "test_auth_digest.php", [], [], $args));
}
runTest("BadAuthDigestTestController");
runTest("GoodAuthDigestTestController");
示例3: array
// --------------------------------------------------------------------------------------------
$tcCounter++;
$method = 'createTestCaseSteps';
$unitTestDescription = "Test #{$tcCounter}- {$method}";
$args = array();
$args["devKey"] = DEV_KEY;
$args["testcaseexternalid"] = 'MKO-1';
$args["steps"][] = array('step_number' => 1, 'actions' => 'Start Server', 'expected_results' => 'green light');
$args["authorlogin"] = 'admin';
$debug = true;
echo $unitTestDescription;
$client = new IXR_Client($server_url);
$client->debug = $debug;
runTest($client, $method, $args, $tcCounter);
// ----------------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------
$tcCounter++;
$method = 'createTestCaseSteps';
$unitTestDescription = "Test #{$tcCounter}- {$method}";
$args = array();
$args["devKey"] = DEV_KEY;
$args["testcaseexternalid"] = 'MKO-1';
$args["version"] = 100;
$args["steps"][] = array('step_number' => 1, 'actions' => 'Start Server VERSION DOES NOT EXIST', 'expected_results' => 'green light');
$args["authorlogin"] = 'admin';
$debug = true;
echo $unitTestDescription;
$client = new IXR_Client($server_url);
$client->debug = $debug;
runTest($client, $method, $args, $tcCounter);
// ----------------------------------------------------------------------------------------------------
示例4: runTest
echo $unitTestDescription;
$answer = runTest($client, $method, $args);
// ---------------------------------------------------------------------------------------
$utc++;
$unitTestDescription = "Test #{$utc} - {$method} - Wrong argument - Test Case External ID ";
$args = array();
$args["devKey"] = $devKey;
$args["testplanid"] = 9;
$args["testcaseexternalid"] = 'GK-WRONG-1';
$args["buildname"] = 'WRONG - 1.0';
$args["platformname"] = 'P2';
$debug = true;
$client = new IXR_Client($server_url);
$client->debug = $debug;
echo $unitTestDescription;
$answer = runTest($client, $method, $args);
// ---------------------------------------------------------------------------------------
$utc++;
$unitTestDescription = "Test #{$utc} - {$method} - Wrong argument - Build Name ";
$args = array();
$args["devKey"] = $devKey;
$args["testplanid"] = 9;
$args["testcaseexternalid"] = 'GK-1';
$args["buildname"] = 'WRONG - 1.0';
$args["platformname"] = 'P2';
$debug = true;
$client = new IXR_Client($server_url);
$client->debug = $debug;
echo $unitTestDescription;
$answer = runTest($client, $method, $args);
// ---------------------------------------------------------------------------------------
开发者ID:CristianOspinaOspina,项目名称:testlinkpruebas,代码行数:31,代码来源:clientUnassignTestCaseExecutionTask.php
示例5: xdebug_start_code_coverage
// if (isset($backtrace['file'])) {
// $line = $backtrace['line'];
// } else {
// $line = '?';
// }
// if (!isset($tab[$file])) {
// $tab[$file] = [];
// }
// $tab[$file][(string) $line] = true;
// }
//};
if (!isset($_GET['f'])) {
//declare(ticks = 1);
//register_tick_function($profile);
xdebug_start_code_coverage();
try {
runTest(['core', 'app']);
} catch (Exception $e) {
echo $e->getMessage();
}
$couverture = xdebug_get_code_coverage();
xdebug_stop_code_coverage();
file_put_contents(ROOT . 'utilisation_fichier.srl.txt', serialize($couverture));
} else {
$fileName = str_replace('{ROOT}', ROOT, urldecode($_GET['f']));
if (is_file($fileName)) {
afficheSourceTestee($fileName);
} else {
header('location: ' . filter_input(INPUT_SERVER, 'REQUEST_URI', FILTER_SANITIZE_URL), true, 404);
}
}
示例6: test_i
function test_i(&$client, &$test_num)
{
$method = 'createTestProject';
$test_num++;
$unitTestDescription = "Test {$test_num} - {$method}() ::: COPY AS ";
$prefix = 'QAZ';
$args = array();
$args["devKey"] = DEV_KEY;
$args["testcaseprefix"] = substr(md5($prefix . $test_num . rand()), 0, 12);
$args["sourcename"] = "NAUTILUS";
$args["testprojectname"] = "API - COPY OF " . $args["sourcename"] . ' ' . $args["testcaseprefix"];
$dummy = '';
$additionalInfo = $dummy;
$args["notes"] = "test project created using XML-RPC-API - <br> {$additionalInfo}";
echo $unitTestDescription . ' ' . $additionalInfo;
$debug = true;
$client->debug = $debug;
runTest($client, $method, $args, $test_num);
}
示例7: runTest
$additionalInfo = $dummy;
$args["notes"] = "test project created using XML-RPC-API - <br> {$additionalInfo}";
echo $unitTestDescription . ' ' . $additionalInfo;
$answer = runTest($client, $method, $args, $step);
// Create Test Suite
$step++;
$method = 'createTestSuite';
$args = array();
$arg['prefix'] = $prefix;
$args["devKey"] = $devKey;
$args["testprojectid"] = $answer[0]['id'];
$args["testsuitename"] = 'TS API 2';
$args["details"] = 'This has been created by XMLRPC API Call';
$unitTestDescription = '';
$dummy = '';
$additionalInfo = $dummy;
echo $unitTestDescription . ' ' . $additionalInfo;
$answer = runTest($client, $method, $args, $step);
// Create Test Plan
$step++;
$method = 'createTestPlan';
$args = array();
$args['prefix'] = $prefix;
$args["devKey"] = $devKey;
$args["testplanname"] = 'TPLAN A';
$args["details"] = 'This has been created by XMLRPC API Call';
$dummy = '';
$additionalInfo = $dummy;
echo $unitTestDescription . ' ' . $additionalInfo;
$answer = runTest($client, $method, $args, $step);
示例8: runTestBasedOnRequest
/**
* Run the single unit test whose name is given in $_REQUEST['test'] and
* display the results. If the unit test file was blah_test.php, then
* $_REQUEST['test'] should be blah.
*/
function runTestBasedOnRequest()
{
echo "<p><a href='?activity=listTests'>See test case list</a>.</p>";
if (isset($_REQUEST['test'])) {
$name = preg_replace("/[^A-Za-z_0-9]/", '', $_REQUEST['test']) . "_test.php";
if (file_exists($name)) {
runTest($name);
}
}
}
示例9: array
<?php
require_once __DIR__ . '/test_base.inc';
$requests = array(array('-dalways_populate_raw_post_data=1', ['CONTENT_TYPE' => 'multipart/form-data; boundary=dumy']), array('-dalways_populate_raw_post_data=1', []), array('', []), array('-dvariables_order=NONE -drequest_order=', []), array('-dvariables_order=E -drequest_order=GPC', []), array('-dvariables_order=CGP -drequest_order=GP', []), array('-dvariables_order=GC -drequest_order=CG', []), array('-dvariables_order=GC -drequest_order=GC', []), array('-dvariables_order=GC -drequest_order=P', []));
foreach ($requests as $request) {
echo "------------ {$request[0]} --------\n";
runTest(function ($port) use($request) {
list($options, $extra) = $request;
$path = 'global_variables.php?var=GET&get=1';
$post = array('var' => 'POST', 'post' => 2);
$headers = array('Cookie' => 'var=COOKIE;cookie=3;');
echo request(php_uname('n'), $port, $path, $post, $headers, $extra) . "\n";
}, $request[0]);
}
示例10: allTests
function allTests($className)
{
global $_;
$_->each(get_class_methods($className), function ($varName) {
runTest($varName);
});
}
示例11: runTest
<?php
/* MorgOS is a Content Management System written in PHP
* Copyright (C) 2005-2007 MorgOS
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
include_once '../../core/tests/compwrapper.class.php';
runTest('MorgOSInterface', 'interface/tests/runtests.5.php', 'interface/tests/base.php');
示例12: invalidTestController
<?php
require_once 'test_base.inc';
function invalidTestController($port)
{
$host = php_uname('n');
$filename = __DIR__ . '/request-doesnotexist.dat';
$file = fopen($filename, 'rb');
$req_dat = fread($file, filesize($filename));
fclose($file);
// Repeat the data three times, to make it invalid. This particular bytestream
// (and ones like it -- repeat 3 times!) in particular used to tickle a
// use-after-free in the FastCGI support.
$req_dat = $req_dat . $req_dat . $req_dat;
$sock = fsockopen($host, $port);
fwrite($sock, $req_dat);
fclose($sock);
// Should still be able to recover and respond to a request over the port on a
// new TCP connection.
echo request($host, $port, 'hello.php');
echo "\n";
}
runTest("invalidTestController");
示例13: array
<?php
require "Octave_lib.php";
$instances = array('Ad hoc' => new Octave(false), 'Network' => new Octave("localhost"));
$tests = array('Initialization ($octave->init() x 1)' => 'test_init', 'Single command ($octave->run("A=1") x 1)' => 'test_single', 'Multiple commands ($octave->run("A=1") x 50)' => 'test_multiple', 'Single batch of multiple commands ($octave->run("A=1" x 50))' => 'test_batch', 'Long input ($octave->run("C=[...]"), C=eye(500))' => 'test_long_in', 'Long output ($octave->query("C"))' => 'test_long_out');
foreach ($tests as $testName => $testFunction) {
echo "\nTest: " . $testName . "\n";
foreach ($instances as $instanceName => $instance) {
runTest($testFunction, $instanceName, $instance);
}
}
function runTest($func, $name, $octave)
{
$func($octave);
echo $name . str_repeat(" ", 10 - strlen($name)) . toc() . "\n";
}
function test_init($octave)
{
tic();
$octave->init();
}
function test_single($octave)
{
tic();
$octave->run("A=1");
}
function test_multiple($octave)
{
tic();
for ($i = 0; $i < 50; $i++) {
$octave->run("A=1");
示例14: intval
// ----------------------------------------------------------------------------------------------------
// Now TRY TO Create EXISTENT STEP
$alienStartPos = intval($qtySteps / 3);
$aliens[] = array('step_number' => $alienStartPos, 'actions' => 'If you see this content => Houston we have a problem' . $action, 'expected_results' => 'Ripley Will BE INFECTED');
$args = $commonArgs;
$args["version"] = $cfg->tcaseVersionNumber;
$args["action"] = 'create';
$args['steps'] = $aliens;
$rr = runTest($client, 'createTestCaseSteps', $args, $tcCounter);
$ret = isset($rr[0]) ? $rr[0] : $rr;
if (isset($ret['code'])) {
new dBug($ret);
exit;
}
// ----------------------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------------------
// Now TRY TO UPDATE a NON EXISTENT STEP
$hint = 'You have requested UPDATE of NON EXISTENT Step => we will CREATE it';
$alienStartPos = 1000;
$aliens[] = array('step_number' => $alienStartPos, 'actions' => $hint . $action, 'expected_results' => 'Ripley Will BE INFECTED');
$args = $commonArgs;
$args["version"] = $cfg->tcaseVersionNumber;
$args["action"] = 'update';
$args['steps'] = $aliens;
$rr = runTest($client, 'createTestCaseSteps', $args, $tcCounter);
$ret = isset($rr[0]) ? $rr[0] : $rr;
if (isset($ret['code'])) {
new dBug($ret);
exit;
}
// ----------------------------------------------------------------------------------------------------
开发者ID:CristianOspinaOspina,项目名称:testlinkpruebas,代码行数:31,代码来源:clientTestSuiteTestCaseStepsManagement.php
示例15: IXR_Client
$client = new IXR_Client($server_url);
$client->debug = $debug;
runTest($client, $method, $args, $idx);
$idx++;
// --------------------------------------------------------------------------
$args = array();
$args["devKey"] = DEV_KEY;
$args["nodeid"] = -1;
$debug = true;
$client = new IXR_Client($server_url);
$client->debug = $debug;
runTest($client, $method, $args, $idx);
$idx++;
// --------------------------------------------------------------------------
$args = array();
$args["devKey"] = DEV_KEY;
$args["nodeid"] = 1;
$debug = true;
$client = new IXR_Client($server_url);
$client->debug = $debug;
runTest($client, $method, $args, $idx);
$idx++;
// --------------------------------------------------------------------------
$args = array();
$args["devKey"] = DEV_KEY;
$args["nodeid"] = 419;
$debug = true;
$client = new IXR_Client($server_url);
$client->debug = $debug;
runTest($client, $method, $args, $idx);
$idx++;