本文整理汇总了PHP中GroupTest::addTestFile方法的典型用法代码示例。如果您正苦于以下问题:PHP GroupTest::addTestFile方法的具体用法?PHP GroupTest::addTestFile怎么用?PHP GroupTest::addTestFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GroupTest
的用法示例。
在下文中一共展示了GroupTest::addTestFile方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create_groups
/**
* Enter description here...
*
* @param unknown_type $path
* @param GroupTest $toGroup
*/
function create_groups($path, $toGroup)
{
global $groups, $testcase;
$over = new DirectoryIterator($path);
foreach ($over as $directory) {
if (strpos($directory, '.') === 0) {
continue;
}
$item_name = $path . DIRECTORY_SEPARATOR . $directory;
if (is_dir($item_name)) {
$group_name = str_replace('_testcases_', '', str_replace(DIRECTORY_SEPARATOR, '_', str_replace(dirname(__FILE__), '', $item_name)));
// create a group and pass it recursively
$group = new GroupTest($group_name);
create_groups($item_name, $group);
} else {
if ($testcase != null && $testcase != $directory) {
continue;
}
// Add the testcase to the current group
/* @var $toGroup GroupTest */
if (strrpos(strrev($item_name), 'php.') === 0) {
$toGroup->addTestFile($item_name);
}
}
}
$groups[] = $toGroup;
}
示例2: call_simpletest
public static function call_simpletest($task, $type = 'text', $dirs = array())
{
// remove E_STRICT because simpletest is not E_STRICT compatible
$old_error_reporting = error_reporting();
$new_error_reporting = $old_error_reporting;
if ($new_error_reporting & E_STRICT) {
$new_error_reporting = $new_error_reporting ^ E_STRICT;
}
include_once 'simpletest/unit_tester.php';
include_once 'simpletest/web_tester.php';
if (!class_exists('GroupTest')) {
throw new pakeException('You must install SimpleTest to use this task.');
}
require_once 'simpletest/reporter.php';
require_once 'simpletest/mock_objects.php';
set_include_path('test' . PATH_SEPARATOR . 'lib' . PATH_SEPARATOR . get_include_path());
$base_test_dir = 'test';
$test_dirs = array();
// run tests only in these subdirectories
if ($dirs) {
foreach ($dirs as $dir) {
$test_dirs[] = $base_test_dir . DIRECTORY_SEPARATOR . $dir;
}
} else {
$test_dirs[] = $base_test_dir;
}
$test = new GroupTest('Test suite in (' . implode(', ', $test_dirs) . ')');
$files = pakeFinder::type('file')->name('*Test.php')->in($test_dirs);
if (count($files) > 0) {
foreach ($files as $file) {
$test->addTestFile($file);
}
ob_start();
if ($type == 'html') {
$result = $test->run(new HtmlReporter());
} else {
if ($type == 'xml') {
$result = $test->run(new XmlReporter());
} else {
$result = $test->run(new TextReporter());
}
}
$content = ob_get_contents();
ob_end_clean();
if ($task->is_verbose()) {
echo $content;
}
} else {
throw new pakeException('No test to run.');
}
error_reporting($old_error_reporting);
}
示例3: GroupTest
<?php
require_once 'simpletest/unit_tester.php';
require_once 'simpletest/reporter.php';
$test = new GroupTest('All tests');
$test->addTestFile('RGBTest.php');
$test->addTestFile('HexTest.php');
$test->addTestFile('HSVTest.php');
$test->addTestFile('CMYTest.php');
$test->addTestFile('CMYKTest.php');
$test->addTestFile('XYZTest.php');
$test->addTestFile('YxyTest.php');
$test->addTestFile('CIELabTest.php');
$test->addTestFile('CIELChTest.php');
$test->run(new HtmlReporter());
示例4: addTestFile
function addTestFile($file, $internalcall = false)
{
if ($this->showsearch) {
if ($internalcall) {
echo '<li><b>' . basename($file) . '</b></li>';
} else {
echo '<p>Adding test file: ' . realpath($file) . '</p>';
}
// Make sure that syntax errors show up suring the search, otherwise you often
// get blank screens because evil people turn down error_reporting elsewhere.
error_reporting(E_ALL);
}
if (!is_file($file)) {
parent::addTestCase(new BadTest($file, 'Not a file or does not exist'));
}
parent::addTestFile($file);
}
示例5: ConsoleOptions
// include_once('simpletest/web_tester.php');
include_once 'simpletest/unit_tester.php';
include_once 'simpletest/reporter.php';
include_once 'configurator/LoggerConfigurator.php';
include_once 'logger/Logger.php';
// }}}
// {{{ configure console
$options = new ConsoleOptions();
$options->setNoValueFor('debug', '-d', '--debug');
$options->load(isset($argv) ? $argv : $_SERVER['argv']);
$options->alias('debug', '-d, --debug');
// }}}
// {{{ logger.
$logger = new Logger(new LoggerConfigurator());
// }}}
$test = new GroupTest("=== Medick Framework Unit Tests ===");
$test_files = Folder::recursiveFindRelative('.', 'test', 'Test.php');
foreach ($test_files as $file) {
if ($options->has('debug')) {
$logger->debug('Adding test file: ' . $file);
}
$test->addTestFile($file);
}
$test->run(new TextReporter());
if ($options->has('debug')) {
$time_end = microtime(true);
$logger->debug('Done in ' . round($time_end - $time_start, 4) . ' seconds');
}
// {{{ clean-up
@unlink(TMP . 'test.db');
// }}}
示例6: define
*
*
* @package harmoni.utilities.tests
*
* @copyright Copyright © 2005, Middlebury College
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
*
* @version $Id: testList.php,v 1.4 2007/09/04 20:25:56 adamfranco Exp $
**/
if (!defined('HARMONI')) {
require_once "../../harmoni.inc.php";
}
if (!defined('SIMPLE_TEST')) {
define('SIMPLE_TEST', HARMONI . 'simple_test/');
}
require_once HARMONI . "errorHandler/ErrorHandler.class.php";
if (!Services::serviceAvailable("ErrorHandler")) {
Services::registerService("ErrorHandler", "ErrorHandler");
require_once OKI2 . "osid/OsidContext.php";
$context = new OsidContext();
$context->assignContext('harmoni', $harmoni);
require_once HARMONI . "oki2/shared/ConfigurationProperties.class.php";
$configuration = new ConfigurationProperties();
Services::startManagerAsService("ErrorHandler", $context, $configuration);
}
require_once SIMPLE_TEST . 'simple_unit.php';
require_once SIMPLE_TEST . 'dobo_simple_html_test.php';
$test = new GroupTest('Utilities tests');
$test->addTestFile(HARMONI . 'utilities/tests/OrderedListTestCase.class.php');
$test->attachObserver(new DoboTestHtmlDisplay());
$test->run();
示例7: define
<?php
defined('ALL_TESTS_CALL') ? null : define("ALL_TESTS_CALL",true);
defined('AK_ENABLE_PROFILER') ? null : define('AK_ENABLE_PROFILER',true);
require_once(dirname(__FILE__).'/../../fixtures/config/config.php');
if(!defined('ALL_TESTS_RUNNER') && empty($test)){
$test = new GroupTest('Akelos Framework AkRequest Tests');
define('ALL_TESTS_RUNNER', false);
}
$partial_tests = array(
'base',
'invalid_requests',
);
foreach ($partial_tests as $partial_test){
$test->addTestFile(AK_LIB_TESTS_DIRECTORY.DS.'AkRequest'.DS.'_'.$partial_test.'.php');
}
if(!ALL_TESTS_RUNNER){
if (TextReporter::inCli()) {
exit ($test->run(new TextReporter()) ? 0 : 1);
}
$test->run(new HtmlReporter());
}
?>
示例8: OsidContext
require_once SIMPLE_TEST . 'dobo_simple_html_test.php';
$context = new OsidContext();
$configuration = new ConfigurationProperties();
Services::startManagerAsService("DatabaseManager");
require_once HARMONI . "errorHandler/ErrorHandler.class.php";
$errorHandler = Services::getService("ErrorHandler", true);
$dbHandler = Services::getService("DBHandler", true);
$dbIndex = $dbHandler->addDatabase(new MySQLDatabase("devo", "doboHarmoniTest", "test", "test"));
$dbHandler->pConnect($dbIndex);
$configuration->addProperty('database_index', $dbIndex);
$configuration->addProperty('database_name', $arg0 = "doboHarmoniTest");
unset($arg0);
Services::startManagerAsService("IdManager", $context, $configuration);
$errorHandler->setDebugMode(TRUE);
$test = new GroupTest('Hierarchy Tests');
$test->addTestFile(HARMONI . '/oki2/hierarchy/tests/NodeTestCase.class.php');
$test->addTestFile(HARMONI . '/oki2/hierarchy/tests/HierarchyTestCase.class.php');
$test->addTestFile(HARMONI . '/oki2/hierarchy/tests/HierarchyManagerTestCase.class.php');
$test->attachObserver(new DoboTestHtmlDisplay());
$test->run();
$timer->end();
print "\n<br />Harmoni Load Time: " . $harmonyLoadupTimer->printTime();
print "\n<br />Overall Time: " . $timer->printTime();
print "\n</p>";
$num = $dbHandler->getTotalNumberOfQueries();
debug::output("Total # of queries: " . $num, 1, "DBHandler");
debug::printAll();
unset($dbHandler, $errorHandler, $userError);
unset($num);
// $errorHandler->printErrors(HIGH_DETAIL);
// print "<pre>";
示例9: startedIndexPhp
* test installation
*/
#$grouptest = new GroupTest('Installation');
#$grouptest->addTestFile('test_install.php');
#$grouptest->run(new HtmlReporter());
#
### create a function to make sure we are starting at index.php ###
function startedIndexPhp()
{
return true;
}
### include some core libraries ###
require_once '../std/common.inc.php';
require_once dirname(__FILE__) . '/../conf/conf.inc.php';
require_once dirname(__FILE__) . '/class.test_environment.php';
#confChange('DB_TABLE_PREFIX_UNITTEST', ''); # overwrite development database!!!
TestEnvironment::initStreberUrl();
TestEnvironment::prepare('fixtures/project_setup.sql');
$grouptest = new GroupTest('Efforts');
$grouptest->addTestFile('test_efforts.php');
$grouptest->run(new HtmlReporter());
$grouptest = new GroupTest('Item visibility');
$grouptest->addTestFile('test_item_visibility.php');
$grouptest->run(new HtmlReporter());
$grouptest = new GroupTest('Login logic');
$grouptest->addTestFile('test_pages_login.php');
$grouptest->run(new HtmlReporter());
$grouptest = new GroupTest('Render all pages');
$grouptest->addTestFile('test_pages_all.php');
$result = $grouptest->run(new HtmlReporter());
#TestEnvironment::prepare('fixtures/remove_tables.sql');
示例10: dirname
<?php
error_reporting(E_ALL);
/**
* You nead to install SimpleTest to run tests
* {@link http://www.lastcraft.com/simple_test.php}
*/
define('SIMPLETEST_PATH', 'D:/phplibs/simpletest_1.0.1alpha2');
define('PICOCONTAINER_TEST_PATH', dirname(__FILE__));
define('PICOCONTAINER_PATH', PICOCONTAINER_TEST_PATH . '/../src');
require_once SIMPLETEST_PATH . '/unit_tester.php';
require_once SIMPLETEST_PATH . '/reporter.php';
require_once PICOCONTAINER_PATH . '/pico.inc.php';
require_once 'model.classes.inc.php';
$test = new GroupTest('All Pico tests');
$test->addTestFile(PICOCONTAINER_TEST_PATH . '/DefaultPicoContainerTests.php');
$test->addTestFile(PICOCONTAINER_TEST_PATH . '/ComponentKeyTests.php');
$test->addTestFile(PICOCONTAINER_TEST_PATH . '/ComponentAdapterTests.php');
$test->addTestFile(PICOCONTAINER_TEST_PATH . '/ContainerHierarchiesTests.php');
$test->addTestFile(PICOCONTAINER_TEST_PATH . '/ExceptionsTests.php');
$test->addTestFile(PICOCONTAINER_TEST_PATH . '/SetterInjectionComponentAdapterTestCase.php');
$test->addTestFile(PICOCONTAINER_TEST_PATH . '/LazyIncludingCATests.php');
$test->addTestFile(PICOCONTAINER_TEST_PATH . '/SitePointTests.php');
$test->addTestFile(PICOCONTAINER_TEST_PATH . '/ParameterTests.php');
if (TextReporter::inCli()) {
exit($test->run(new ColorTextReporter()) ? 0 : 1);
}
$test->run(new HtmlReporter());
示例11: define
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 Static Method and utilities Tests');
define('ALL_TESTS_RUNNER', false);
}
@session_start();
$partial_tests = array(
'Ak_convert',
'Ak_file_functions',
'Ak_object_inspection',
//'Ak_file_functions_over_ftp',
'Ak_support_functions',
);
foreach ($partial_tests as $partial_test){
$test->addTestFile(AK_LIB_TESTS_DIRECTORY.DS.'utils'.DS.'_'.$partial_test.'.php');
}
if(!ALL_TESTS_RUNNER){
if (TextReporter::inCli()) {
exit ($test->run(new TextReporter()) ? 0 : 1);
}
$test->run(new HtmlReporter());
}
?>
示例12: define
*
* @copyright Copyright © 2005, Middlebury College
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
*
* @version $Id: test.php,v 1.4 2007/09/04 20:25:56 adamfranco Exp $
**/
if (!defined('HARMONI')) {
require_once "../../harmoni.inc.php";
}
if (!defined('SIMPLE_TEST')) {
define('SIMPLE_TEST', HARMONI . 'simple_test/');
}
require_once HARMONI . "errorHandler/ErrorHandler.class.php";
if (!Services::serviceAvailable("ErrorHandler")) {
Services::registerService("ErrorHandler", "ErrorHandler");
require_once OKI2 . "osid/OsidContext.php";
$context = new OsidContext();
$context->assignContext('harmoni', $harmoni);
require_once HARMONI . "oki2/shared/ConfigurationProperties.class.php";
$configuration = new ConfigurationProperties();
Services::startManagerAsService("ErrorHandler", $context, $configuration);
}
require_once SIMPLE_TEST . 'simple_unit.php';
require_once SIMPLE_TEST . 'dobo_simple_html_test.php';
$test = new GroupTest('Utilities tests');
$test->addTestFile(HARMONI . 'utilities/tests/QueueTestCase.class.php');
$test->addTestFile(HARMONI . 'utilities/tests/ArgumentValidatorTestCase.class.php');
$test->addTestFile(HARMONI . 'utilities/tests/ArgumentRendererTestCase.class.php');
$test->addTestFile(HARMONI . 'utilities/FieldSetValidator/tests/test.php');
$test->attachObserver(new DoboTestHtmlDisplay());
$test->run();
示例13: define
<?php
/**
* A group test template using the SimpleTest unit testing package.
* Just add the UnitTestCase files below using addTestFile().
*
* @version $Id: grouptest.php,v 1.2 2007/09/04 20:25:50 adamfranco Exp $
* @copyright 2003
**/
if (!defined('SIMPLE_TEST')) {
define('SIMPLE_TEST', '/www/simple_test/');
}
require_once SIMPLE_TEST . 'simple_unit.php';
require_once SIMPLE_TEST . 'simple_html_test.php';
$test = new GroupTest('All tests');
$test->addTestFile('test.php');
$test->attachObserver(new TestHtmlDisplay());
$test->run();
示例14: runTestFile
function runTestFile($testcase_file, &$reporter)
{
$manager = new TestManager();
if (!file_exists($testcase_file)) {
trigger_error("Test case {$testcase_file} cannot be found", E_USER_ERROR);
}
$test = new GroupTest("Individual test case: " . $testcase_file);
$test->addTestFile($testcase_file);
$test->run($reporter);
}
示例15: define
<?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 Action Controller Tests');
define('ALL_TESTS_RUNNER', false);
}
@session_start();
$partial_tests = array('forbidden_actions', 'filters', 'locale_detection', 'partials', 'http_authentication', 'model_instantiation', 'page_caching', 'action_caching', 'sweeper', 'respond_to_format', 'renders_format');
foreach ($partial_tests as $partial_test) {
$test->addTestFile(AK_LIB_TESTS_DIRECTORY . DS . 'AkActionController' . DS . '_' . $partial_test . '.php');
}
if (!ALL_TESTS_RUNNER) {
if (TextReporter::inCli()) {
exit($test->run(new TextReporter()) ? 0 : 1);
}
$test->run(new HtmlReporter());
}