本文整理汇总了PHP中GroupTest类的典型用法代码示例。如果您正苦于以下问题:PHP GroupTest类的具体用法?PHP GroupTest怎么用?PHP GroupTest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GroupTest类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: fromDir
public static function fromDir($name, $dir)
{
$classes = array();
$dh = opendir($dir);
while ($file = readdir($dh)) {
if (!preg_match('/[.]php$/i', $file)) {
continue;
}
if ($file == 'suite.php') {
continue;
}
$className = preg_replace('/[.]php$/i', '', $file);
array_push($classes, $className);
$file = "{$dir}/{$file}";
require_once $file;
}
closedir($dh);
$test = new GroupTest($name);
if (count($classes)) {
foreach ($classes as $class) {
$test->addTestCase(new $class());
}
} else {
$test->addTestCase(new __tctemp());
}
$test->run(new DefaultReporter());
}
开发者ID:bprudent,项目名称:framework,代码行数:27,代码来源:FrameworkTestSuite.php
示例2: 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;
}
开发者ID:nyeholt,项目名称:injector,代码行数:33,代码来源:run.php
示例3: run
public function run()
{
$test = new GroupTest("Piwik - running '{$this->testGroupType}' tests...");
$intro = '';
if (!$this->databaseRequired) {
$intro .= $this->getTestDatabaseInfoMessage();
}
$intro .= self::$testsHelpLinks . "<hr/>";
$intro .= $this->introAppend;
$toInclude = array();
foreach ($this->dirsToGlob as $dir) {
$toInclude = array_merge($toInclude, Piwik::globr(PIWIK_INCLUDE_PATH . $dir, '*.test.php'));
}
// if present, make sure Database.test.php is first
$idx = array_search(PIWIK_INCLUDE_PATH . '/tests/core/Database.test.php', $toInclude);
if ($idx !== FALSE) {
unset($toInclude[$idx]);
array_unshift($toInclude, PIWIK_INCLUDE_PATH . '/tests/core/Database.test.php');
}
foreach ($toInclude as $file) {
$test->addFile($file);
}
$result = $test->run(new HtmlTimerReporter($intro));
if (SimpleReporter::inCli()) {
exit($result ? 0 : 1);
}
}
开发者ID:nnnnathann,项目名称:piwik,代码行数:27,代码来源:TestRunner.php
示例4: generar_layout
function generar_layout()
{
$selecciones = $this->controlador->get_selecciones();
echo "<div style='background-color: white; border: 1px solid black; text-align: left; padding: 15px'>";
try {
//Se construye un suite por categoria que tenga test seleccionados
foreach (toba_test_lista_casos::get_categorias() as $categoria) {
$test = new GroupTest($categoria['nombre']);
$hay_uno = false;
foreach (toba_test_lista_casos::get_casos() as $caso) {
if ($caso['categoria'] == $categoria['id'] && in_array($caso['id'], $selecciones['casos'])) {
$hay_uno = true;
require_once $caso['archivo'];
$test->addTestCase(new $caso['id']($caso['nombre']));
}
}
if ($hay_uno) {
//--- COBERTURA DE CODIGO (OPCIONAL) ----
if (function_exists('xdebug_start_code_coverage')) {
xdebug_start_code_coverage();
}
//-------
$test->run(new toba_test_reporter());
//--- COBERTURA DE CODIGO (OPCIONAL) ----
$arch = 'PHPUnit2/Util/CodeCoverage/Renderer.php';
$existe = toba_manejador_archivos::existe_archivo_en_path($arch);
if (function_exists('xdebug_start_code_coverage') && $existe) {
require_once $arch;
$cubiertos = xdebug_get_code_coverage();
//Se limpian las referencias a simpletest y a librerias de testing en gral.
$archivos = array();
foreach (array_keys($cubiertos) as $archivo) {
if (!strpos($archivo, 'simpletest') && !strpos($archivo, 'PHPUnit') && !strpos($archivo, 'testing_automatico/') && !strpos($archivo, '/test_')) {
$archivos[$archivo] = $cubiertos[$archivo];
}
}
$cc = PHPUnit2_Util_CodeCoverage_Renderer::factory('HTML', array('tests' => $archivos));
$path_temp = toba::proyecto()->get_path_temp_www();
$salida = $path_temp['real'] . '/cobertura.html';
$cc->renderToFile($salida);
echo "<a href='{$path_temp['browser']}/cobertura.html' target='_blank'>Ver cobertura de código</a>";
}
//-------
}
}
} catch (Exception $e) {
if (method_exists($e, 'mensaje_web')) {
echo ei_mensaje($e->mensaje_web(), 'error');
} else {
echo $e;
}
}
echo '</div><br>';
$this->dep('lista_archivos')->generar_html();
}
开发者ID:emma5021,项目名称:toba,代码行数:55,代码来源:casos_web.php
示例5: 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);
}
开发者ID:piotras,项目名称:pake,代码行数:52,代码来源:pakeSimpletestTask.class.php
示例6: LimbGroupTest
function LimbGroupTest($label = false, $auto_label = true)
{
if($label && $auto_label)
$label = make__FILE__readable($label);
parent :: GroupTest($label);
}
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:7,代码来源:LimbGroupTest.class.php
示例7: defined
<?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 Active Record Tests');
define('ALL_TESTS_RUNNER', false);
@session_start();
}
//these partials are not refactored yet. so they must be run in sequence!
$partial_tests = array('_AkActiveRecord_1.php', '_AkActiveRecord_2.php', '_AkActiveRecord_3.php');
foreach ($partial_tests as $partial_test) {
$test->addTestFile(AK_LIB_TESTS_DIRECTORY . DS . 'AkActiveRecord' . DS . $partial_test);
}
foreach (Ak::dir(AK_LIB_TESTS_DIRECTORY . DS . 'AkActiveRecord') as $active_record_test) {
if (!is_array($active_record_test) && !in_array($active_record_test, $partial_tests)) {
if (!ALL_TESTS_RUNNER || $active_record_test[0] == '_') {
$test->addTestFile(AK_LIB_TESTS_DIRECTORY . DS . 'AkActiveRecord' . DS . $active_record_test);
}
}
}
if (!ALL_TESTS_RUNNER) {
if (TextReporter::inCli()) {
exit($test->run(new TextReporter()) ? 0 : 1);
}
$test->run(new HtmlReporter());
}
开发者ID:joeymetal,项目名称:v1,代码行数:29,代码来源:AkActiveRecord.php
示例8: define
<?php
require_once 'setup_tests_environment.php';
define('SIMPLE_RUNNING', true);
$tests = new GroupTest("Running all tests");
$tests->addTestFile('test_domain_product.php');
$success = $tests->run(new TextReporter());
if (!$success) {
exit(1);
}
exit;
开发者ID:hovenko,项目名称:DF-Scrum,代码行数:11,代码来源:all_tests.php
示例9: 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');
// }}}
开发者ID:BackupTheBerlios,项目名称:medick-svn,代码行数:31,代码来源:runner.php
示例10: elseif
<?php
// $Id: remote_test.php 424 2006-07-21 02:20:17Z will $
require_once '../remote.php';
require_once '../reporter.php';
// The following URL will depend on your own installation.
if (isset($_SERVER['SCRIPT_URI'])) {
$base_uri = $_SERVER['SCRIPT_URI'];
} elseif (isset($_SERVER['HTTP_HOST']) && isset($_SERVER['PHP_SELF'])) {
$base_uri = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
}
$test_url = str_replace('remote_test.php', 'visual_test.php', $base_uri);
$test = new GroupTest('Remote tests');
$test->addTestCase(new RemoteTestCase($test_url . '?xml=yes', $test_url . '?xml=yes&dry=yes'));
if (SimpleReporter::inCli()) {
exit($test->run(new TextReporter()) ? 0 : 1);
}
$test->run(new HtmlReporter());
开发者ID:Hassanj343,项目名称:candidats,代码行数:18,代码来源:remote_test.php
示例11: run
/**
* Run the tests
*
* This method will run the tests with the correct Reporter. It will run
* grouped tests if asked to and filter results. It also has support for
* running coverage report.
*
*/
public function run()
{
$testGroup = $this->testGroup;
if (PHP_SAPI === 'cli') {
require_once dirname(__FILE__) . '/DoctrineTest/Reporter/Cli.php';
$reporter = new DoctrineTest_Reporter_Cli();
$argv = $_SERVER['argv'];
array_shift($argv);
$options = $this->parseOptions($argv);
} else {
require_once dirname(__FILE__) . '/DoctrineTest/Reporter/Html.php';
$options = $_GET;
if (isset($options['filter'])) {
if (!is_array($options['filter'])) {
$options['filter'] = explode(',', $options['filter']);
}
}
if (isset($options['group'])) {
if (!is_array($options['group'])) {
$options['group'] = explode(',', $options['group']);
}
}
$reporter = new DoctrineTest_Reporter_Html();
}
//replace global group with custom group if we have group option set
if (isset($options['group'])) {
$testGroup = new GroupTest('Doctrine Custom Test', 'custom');
foreach ($options['group'] as $group) {
if (isset($this->groups[$group])) {
$testGroup->addTestCase($this->groups[$group]);
} else {
if (class_exists($group)) {
$testGroup->addTestCase(new $group());
} else {
die($group . " is not a valid group or doctrine test class\n ");
}
}
}
}
if (isset($options['ticket'])) {
$testGroup = new GroupTest('Doctrine Custom Test', 'custom');
foreach ($options['ticket'] as $ticket) {
$class = 'Doctrine_Ticket_' . $ticket . '_TestCase';
$testGroup->addTestCase(new $class());
}
}
$filter = '';
if (isset($options['filter'])) {
$filter = $options['filter'];
}
//show help text
if (isset($options['help'])) {
$availableGroups = sort(array_keys($this->groups));
echo "Doctrine test runner help\n";
echo "===========================\n";
echo " To run all tests simply run this script without arguments. \n";
echo "\n Flags:\n";
echo " -coverage will generate coverage report data that can be viewed with the cc.php script in this folder. NB! This takes time. You need xdebug to run this\n";
echo " -group <groupName1> <groupName2> <className1> Use this option to run just a group of tests or tests with a given classname. Groups are currently defined as the variable name they are called in this script.\n";
echo " -filter <string1> <string2> case insensitive strings that will be applied to the className of the tests. A test_classname must contain all of these strings to be run\n";
echo "\nAvailable groups:\n " . implode(', ', $availableGroups) . "\n";
die;
}
//generate coverage report
if (isset($options['coverage'])) {
/*
* The below code will not work for me (meus). It would be nice if
* somebody could give it a try. Just replace this block of code
* with the one below
*
define('PHPCOVERAGE_HOME', dirname(dirname(__FILE__)) . '/vendor/spikephpcoverage');
require_once PHPCOVERAGE_HOME . '/CoverageRecorder.php';
require_once PHPCOVERAGE_HOME . '/reporter/HtmlCoverageReporter.php';
$covReporter = new HtmlCoverageReporter('Doctrine Code Coverage Report', '', 'coverage2');
$includePaths = array('../lib');
$excludePaths = array();
$cov = new CoverageRecorder($includePaths, $excludePaths, $covReporter);
$cov->startInstrumentation();
$ret = $testGroup->run($reporter, $filter);
$cov->stopInstrumentation();
$cov->generateReport();
$covReporter->printTextSummary();
return $ret;
*/
xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE);
$ret = $testGroup->run($reporter, $filter);
$result['coverage'] = xdebug_get_code_coverage();
xdebug_stop_code_coverage();
//.........这里部分代码省略.........
开发者ID:kaakshay,项目名称:audience-insight-repository,代码行数:101,代码来源:DoctrineTest.php
示例12: define
<?php
/**
* A group test template using the SimpleTest unit testing package.
* Just add the UnitTestCase files below using addTestFile().
*
* @package harmoni.utilities.fieldsetvalidator.tests
*
* @copyright Copyright © 2005, Middlebury College
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
*
* @version $Id: test.php,v 1.3 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 SIMPLE_TEST . 'simple_unit.php';
require_once SIMPLE_TEST . 'dobo_simple_html_test.php';
$test = new GroupTest('FieldSetValidator tests');
$test->addTestFile(HARMONI . 'utilities/FieldSetValidator/tests/FieldSetValidatorTestCase.class.php');
$test->attachObserver(new DoboTestHtmlDisplay());
$test->run();
开发者ID:adamfranco,项目名称:harmoni,代码行数:25,代码来源:test.php
示例13: testOfReference
$this->assertIdentical($a, $b);
// Fail.
$this->assertNotIdentical($a, $b);
}
function testOfReference()
{
$a = "fred";
$b = $a;
$this->assertReference($a, $b);
$this->assertCopy($a, $b);
// Fail.
$c = "Hello";
$this->assertReference($a, $c);
// Fail.
$this->assertCopy($a, $c);
}
function testOfPatterns()
{
$this->assertWantedPattern('/hello/i', "Hello there");
$this->assertNoUnwantedPattern('/hello/', "Hello there");
$this->assertWantedPattern('/hello/', "Hello there");
// Fail.
$this->assertNoUnwantedPattern('/hello/i', "Hello there");
// Fail.
}
}
$test = new GroupTest("Unit test case test, 14 fails and 14 passes");
$display = new TestHTMLDisplay();
$test->attachObserver($display);
$test->addTestCase(new TestOfUnitTestCase());
$test->run();
开发者ID:adamfranco,项目名称:harmoni,代码行数:31,代码来源:simple_unit_test.php
示例14: 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();
开发者ID:adamfranco,项目名称:harmoni,代码行数:31,代码来源:testList.php
示例15: main
/**
* The main entry point
*
* @throws BuildException
*/
function main()
{
$group = new GroupTest();
$filenames = $this->getFilenames();
foreach ($filenames as $testfile) {
$group->addTestFile($testfile);
}
if ($this->debug) {
$fe = new SimpleTestFormatterElement();
$fe->setType('debug');
$fe->setUseFile(false);
$this->formatters[] = $fe;
}
if ($this->printsummary) {
$fe = new SimpleTestFormatterElement();
$fe->setType('summary');
$fe->setUseFile(false);
$this->formatters[] = $fe;
}
foreach ($this->formatters as $fe) {
$formatter = $fe->getFormatter();
$formatter->setProject($this->getProject());
if ($fe->getUseFile()) {
$destFile = new PhingFile($fe->getToDir(), $fe->getOutfile());
$writer = new FileWriter($destFile->getAbsolutePath());
$formatter->setOutput($writer);
} else {
$formatter->setOutput($this->getDefaultOutput());
}
}
$this->execute($group);
if ($this->testfailed && $this->formatters[0]->getFormatter() instanceof SimpleTestDebugResultFormatter) {
$this->getDefaultOutput()->write("Failed tests: ");
$this->formatters[0]->getFormatter()->printFailingTests();
}
if ($this->testfailed) {
throw new BuildException("One or more tests failed");
}
}
开发者ID:umesecke,项目名称:phing,代码行数:44,代码来源:SimpleTestTask.php
示例16: dirname
$harmonyLoadupTimer->start();
require_once dirname(__FILE__) . "/../../../../harmoni.inc.php";
//require_once(dirname(__FILE__)."/../../../../../concerto/main/include/setup.inc.php");
$harmonyLoadupTimer->end();
require_once SIMPLE_TEST . 'simple_unit.php';
require_once SIMPLE_TEST . 'oki_simple_unit.php';
require_once SIMPLE_TEST . 'dobo_simple_html_test.php';
/* if (!defined('CONCERTODBID')) { */
/* require_once(CONCERTO.'/tests/dbconnect.inc.php'); */
/* } */
require_once HARMONI . "errorHandler/ErrorHandler.class.php";
$errorHandler = Services::getService("ErrorHandler");
$context = new OsidContext();
$configuration = new ConfigurationProperties();
Services::startManagerAsService("DatabaseManager", $context, $configuration);
$test = new GroupTest('CourseManagementTest');
$test->addTestFile(dirname(__FILE__) . '/CanonicalCourseTestCase.class.php');
$test->addTestFile(dirname(__FILE__) . '/CourseGroupTestCase.class.php');
$test->addTestFile(dirname(__FILE__) . '/CourseOfferingTestCase.class.php');
$test->addTestFile(dirname(__FILE__) . '/TermTest.class.php');
$test->addTestFile(dirname(__FILE__) . '/CourseSectionTestCase.class.php');
$test->addTestFile(dirname(__FILE__) . '/EnrollmentRecordTestCase.class.php');
$test->addTestFile(dirname(__FILE__) . '/CourseGradeRecordTest.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();
$dbhandler = Services::getService("DBHandler");
printpre("NumQueries: " . $dbhandler->getTotalNumberOfQueries());
print "\n</p>";
开发者ID:adamfranco,项目名称:harmoni,代码行数:31,代码来源:test.php
示例17: defined
<?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());
}
?>
开发者ID:joeymetal,项目名称:v1,代码行数:29,代码来源:AkRequest.php
示例18: _createGroupFromClasses
function _createGroupFromClasses($title, $classes)
{
$group = new GroupTest($title);
foreach ($classes as $class) {
if (SimpleTestOptions::isIgnored($class)) {
continue;
}
$group->addTestClass($class);
}
return $group;
}
开发者ID:BackupTheBerlios,项目名称:phpbase-svn,代码行数:11,代码来源:simple_test.php
示例19: run
/**
* ユニットテストを実行する
*
* @access private
* @return mixed 0:正常終了 Ethna_Error:エラー
*/
function run()
{
$action_class_list = $this->_getTestAction();
$view_class_list = $this->_getTestView();
$test = new GroupTest("Ethna UnitTest");
// アクション
foreach ($action_class_list as $action_name) {
$action_class = $this->ctl->getDefaultActionClass($action_name, false) . '_TestCase';
$action_form = $this->ctl->getDefaultFormClass($action_name, false) . '_TestCase';
$test->addTestCase(new $action_class($this->ctl));
$test->addTestCase(new $action_form($this->ctl));
}
// ビュー
foreach ($view_class_list as $view_name) {
$view_class = $this->ctl->getDefaultViewClass($view_name, false) . '_TestCase';
$test->addTestCase(new $view_class($this->ctl));
}
// 一般
foreach ($this->testcase as $class_name => $file_name) {
$dir = $this->ctl->getBasedir() . '/';
include_once $dir . $file_name;
$testcase_name = $class_name . '_TestCase';
$test->addTestCase(new $testcase_name($this->ctl));
}
// ActionFormのバックアップ
$af = $this->ctl->getActionForm();
//出力したい形式にあわせて切り替える
$cli_enc = $this->ctl->getClientEncoding();
$reporter = new Ethna_UnitTestReporter($cli_enc);
$test->run($reporter);
// ActionFormのリストア
$this->ctl->action_form = $af;
$this->backend->action_form = $af;
$this->backend->af = $af;
return array($reporter->report, $reporter->result);
}
开发者ID:riaf,项目名称:pastit,代码行数:42,代码来源:UnitTestManager.php
示例20: GroupTest
// Migration Tests
$migration = new GroupTest('Migration Tests', 'migration');
$migration->addTestCase(new Doctrine_Migration_TestCase());
$test->addTestCase($migration);
// File Parser Tests
$parser = new GroupTest('Parser Tests', 'parser');
$parser->addTestCase(new Doctrine_Parser_TestCase());
$test->addTestCase($parser);
// Data Fixtures Tests
$data = new GroupTest('Data exporting/importing fixtures', 'data_fixtures');
$data->addTestCase(new Doctrine_Data_Import_TestCase());
$data->addTestCase(new Doctrine_Data_Export_TestCase());
$test->addTestCase($data);
// Unsorted Tests. These need to be sorted and placed in the appropriate group
$unsorted = new GroupTest('Unsorted Tests', 'unsorted');
$unsorted->addTestCase(new Doctrine_CustomPrimaryKey_TestCase());
$unsorted->addTestCase(new Doctrine_CustomResultSetOrder_TestCase());
$unsorted->addTestCase(new Doctrine_ColumnAlias_TestCase());
//$unsorted->addTestCase(new Doctrine_RawSql_TestCase());
$unsorted->addTestCase(new Doctrine_NewCore_TestCase());
$unsorted->addTestCase(new Doctrine_Template_TestCase());
$unsorted->addTestCase(new Doctrine_NestedSet_SingleRoot_TestCase());
$unsorted->addTestCase(new Doctrine_NestedSet_MultiRoot_TestCase());
$unsorted->addTestCase(new Doctrine_PessimisticLocking_TestCase());
$test->addTestCase($unsorted);
$test->run();
开发者ID:prismhdd,项目名称:victorioussecret,代码行数:30,代码来源:run.php
注:本文中的GroupTest类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论