本文整理汇总了PHP中GroupTest::addTestClass方法的典型用法代码示例。如果您正苦于以下问题:PHP GroupTest::addTestClass方法的具体用法?PHP GroupTest::addTestClass怎么用?PHP GroupTest::addTestClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GroupTest
的用法示例。
在下文中一共展示了GroupTest::addTestClass方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GroupTest
function _createGroupFromClasses($title, $classes)
{
$group = new GroupTest($title);
foreach ($classes as $class) {
if (SimpleTestOptions::isIgnored($class)) {
continue;
}
$group->addTestClass($class);
}
return $group;
}
示例2: array
error_reporting(E_ALL);
// Configuration
$simpletest_location = 'simpletest/';
if (file_exists('../test-settings.php')) {
include_once '../test-settings.php';
}
// Includes
require_once '../class.csstidy.php';
require_once 'Text/Diff.php';
require_once 'Text/Diff/Renderer.php';
require_once $simpletest_location . 'unit_tester.php';
require_once $simpletest_location . 'reporter.php';
require_once 'unit-tests/class.csstidy_reporter.php';
require_once 'unit-tests/class.csstidy_harness.php';
require_once 'unit-tests.inc';
// Test files
$test_files = array();
require 'unit-tests/_files.php';
// Setup test files
$test = new GroupTest('CSSTidy unit tests');
foreach ($test_files as $test_file) {
require_once "unit-tests/{$test_file}";
list($x, $class_suffix) = explode('.', $test_file);
$test->addTestClass("csstidy_test_{$class_suffix}");
}
if (SimpleReporter::inCli()) {
$reporter = new TextReporter();
} else {
$reporter = new csstidy_reporter('UTF-8');
}
$test->run($reporter);
示例3: GroupTest
/**
* Builds a group test from a class list.
* @param string $title Title of new group.
* @param array $classes Test classes.
* @return GroupTest Group loaded with the new
* test cases.
* @access private
*/
function &_createGroupFromClasses($title, $classes)
{
SimpleTest::ignoreParentsIfIgnored($classes);
$group = new GroupTest($title);
foreach ($classes as $class) {
if (!SimpleTest::isIgnored($class)) {
$group->addTestClass($class);
}
}
return $group;
}
示例4: GroupTest
/**
* Builds a group test from a class list.
* @param string $title Title of new group.
* @param array $classes Test classes.
* @return GroupTest Group loaded with the new
* test cases.
* @access private
*/
function _createGroupFromClasses($title, $classes)
{
$group = new GroupTest($title);
foreach ($classes as $class) {
$group->addTestClass($class);
}
return $group;
}
示例5: addTestFile
/**
* Builds a group test from a library of test cases.
* The new group is composed into this one.
* @param string $test_file File name of library with
* test case classes.
* @access public
*/
function addTestFile($test_file)
{
$existing_classes = get_declared_classes();
require $test_file;
$group = new GroupTest($test_file);
foreach (get_declared_classes() as $class) {
if (in_array($class, $existing_classes)) {
continue;
}
if (!$this->_isTestCase($class)) {
continue;
}
if (SimpleTestOptions::isIgnored($class)) {
continue;
}
$group->addTestClass($class);
}
$this->addTestCase($group);
}
示例6: realpath
<?php
require 'simpletest/unit_tester.php';
require 'simpletest/mock_objects.php';
require 'simpletest/reporter.php';
define('MIO_PATH', realpath(dirname(__FILE__) . '/../') . '/');
require 'spikecoverage/CoverageRecorder.php';
require 'spikecoverage/reporter/HtmlCoverageReporter.php';
$coverage_reporter = new HtmlCoverageReporter("Code Coverage Report", "", "reports");
$include = array(MIO_PATH);
$exclude = array(MIO_PATH . "tests", MIO_PATH . "example");
$coverage_recorder = new CoverageRecorder($include, $exclude, $coverage_reporter);
$group = new GroupTest('All Muliplexing I/O Tests');
$dir = opendir(MIO_PATH . '/tests');
while ($file = readdir($dir)) {
if (is_file($file) && substr($file, 0, 1) != '.' && $file != 'testRunner.php') {
require MIO_PATH . 'tests/' . $file;
$class = 'Mio' . substr($file, 0, -4);
$group->addTestClass(new $class());
}
}
$coverage_recorder->startInstrumentation();
$group->run(new TextReporter());
$coverage_recorder->stopInstrumentation();
$coverage_recorder->generateReport();
$coverage_reporter->printTextSummary();
示例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());
}
示例8: testSend
//}}}
/**{{{testSend
*/
public function testSend()
{
$this->assertEqual($this->server->send('S' . pack('NN', strlen('mykey'), strlen('myvalue')) . 'mykey' . 'myvalue'), "OK\n");
}
//}}}
/**{{{testToString
*/
public function testToString()
{
$this->assertEqual($this->server->__toString(), '[' . $this->server->host . ':' . $this->server->port . ']');
}
}
$group->addTestClass(new testSharedanceServer());
Mock::generatePartial('SharedanceServer', 'MockSharedanceServer', array('send', 'close'));
class MyMockSharedanceServer extends MockSharedanceServer
{
public $throwException = false;
public function send($data)
{
$return = parent::send($data);
if ($this->throwException) {
throw new SharedanceException("Mocked Out Exception");
}
return $return;
}
}
/**
* Test case for the overall manager class.