Esempio n. 1
0
/**
 * 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;
}
Esempio n. 2
0
 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);
 }
Esempio n. 3
0
<?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());
Esempio n. 4
0
 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);
 }
Esempio n. 5
0
// 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');
// }}}
Esempio n. 6
0
 *
 *
 * @package harmoni.utilities.tests
 * 
 * @copyright Copyright &copy; 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();
Esempio n. 7
0
<?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());
}

?>
Esempio n. 8
0
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>";
Esempio n. 9
0
* 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');
Esempio n. 10
0
<?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());
Esempio n. 11
0
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());
}

?>
Esempio n. 12
0
 * 
 * @copyright Copyright &copy; 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();
Esempio n. 13
0
<?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();
Esempio n. 14
0
 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);
 }
Esempio n. 15
0
<?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());
}
Esempio n. 16
0
<?php

// $Id: parse_error_test.php,v 1.1 2006/03/03 19:49:16 sjhannah Exp $
require_once '../unit_tester.php';
require_once '../reporter.php';
$test = new GroupTest('This should fail');
$test->addTestFile('test_with_parse_error.php');
$test->run(new HtmlReporter());
Esempio n. 17
0
 function single()
 {
     $rep = $this->_prepareResponse();
     $module = $this->param('mod');
     $testname = $this->param('test');
     if (isset($this->testsList[$module])) {
         $reporter = jClasses::create("junittests~jtextrespreporter");
         jClasses::inc('junittests~junittestcase');
         jClasses::inc('junittests~junittestcasedb');
         $reporter->setResponse($rep);
         foreach ($this->testsList[$module] as $test) {
             if ($test[1] == $testname) {
                 $group = new GroupTest('"' . $module . '" module , ' . $test[2]);
                 $group->addTestFile($GLOBALS['gJConfig']->_modulesPathList[$module] . 'tests/' . $test[0]);
                 jContext::push($module);
                 $result = $group->run($reporter);
                 if (!$result) {
                     $rep->setExitCode(jResponseCmdline::EXIT_CODE_ERROR);
                 }
                 jContext::pop();
                 break;
             }
         }
     } else {
         $rep->addContent("\n" . 'no tests for "' . $module . '" module.' . "\n");
     }
     return $this->_finishResponse($rep);
 }
Esempio n. 18
0
<?php

ini_set('error_reporting', E_ALL ^ E_NOTICE);
ini_set('display_errors', 1);
ini_set('log_errors', 'Off');
require_once 'config.php';
require_once SIMPLETESTDIR . 'simpletest.php';
require_once SIMPLETESTDIR . 'unit_tester.php';
require_once SIMPLETESTDIR . 'reporter.php';
$base_dir = dirname(__FILE__) . "/unit/";
if (isset($_GET['test']) && file_exists($base_dir . $_GET['test'])) {
    $testfile = $_GET['test'];
    $title = "Test File {$testfile}";
} else {
    $testfile = '';
    $title = 'All Test Files';
}
//$test = new TestSuite($title);
$test = new GroupTest($title);
if ($testfile) {
    $test->addTestFile($base_dir . $testfile);
} else {
    foreach (glob($base_dir . "*Test.php") as $testfile) {
        $test->addTestFile($testfile);
    }
}
if (TextReporter::inCli()) {
    $test->run(new TextReporter());
} else {
    $test->run(new HtmlReporter());
}
Esempio n. 19
0
	define("LOAD_DATAMANAGER", false);
	if(!defined("LOAD_AUTHN")) define("LOAD_AUTHN", false);
	define("LOAD_DR", false);
	define("LOAD_SETS", false);

    if (!defined('HARMONI')) {
        require_once("../../../harmoni.inc.php");
    }

	$errorHandler = Services::getService("ErrorHandler");
	$dbHandler = Services::getService("DatabaseManager");
	$dbIndex = $dbHandler->addDatabase( new MySQLDatabase("devo.middlebury.edu","doboHarmoniTest","test","test") );
	$dbHandler->pConnect($dbIndex);
	Services::startService("Shared", $dbIndex, "doboHarmoniTest");
	$errorHandler->setDebugMode(TRUE);

    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('GUI tests');
$test->addTestFile(HARMONI . 'GUIManager/test/StylePropertiesTestCase.class.php');
$test->addTestFile(HARMONI . 'GUIManager/test/StyleComponentsTestCase.class.php');
$test->addTestFile(HARMONI . 'GUIManager/test/StyleCollectionsTestCase.class.php');
$test->addTestFile(HARMONI . 'GUIManager/test/ComponentsTestCase.class.php');
$test->addTestFile(HARMONI . 'GUIManager/test/ThemesTestCase.class.php');
$test->addTestFile(HARMONI . 'GUIManager/test/GUIManagerTestCase.class.php');
$test->attachObserver(new DoboTestHtmlDisplay());
$test->run();
echo printErrors(new SimpleHTMLErrorPrinter());
Esempio n. 20
0
        $coverage = new HTMLCoverageReport($file, $filename, explode(',', $_GET['lines']));
        $coverage->show();
    } else {
        echo 'Access Denied!';
    }
    die;
}
if ($doTest) {
    ob_start();
    $test = new GroupTest('All tests');
    $dir = dir(dirname(__FILE__));
    while (false !== ($entry = $dir->read())) {
        if (is_file($entry) && strtolower(substr($entry, 0, 4)) == 'test') {
            if (strpos(strtolower($entry), 'mysql')) {
                if (extension_loaded('mysql')) {
                    $test->addTestFile($entry);
                }
            } else {
                $test->addTestFile($entry);
            }
        }
    }
    $dir->close();
    $sapi = php_sapi_name();
    if ($sapi == 'cli' || $sapi == 'cgi-fcgi') {
        exit($test->run(new TextReporter()) ? 0 : 1);
    }
    $test->run(new HtmlReporterWithCoverage('index.php', FRAMEWORK_BASE));
    file_put_contents($mycachefile, ob_get_contents());
} else {
    echo file_get_contents($mycachefile);
Esempio n. 21
0
 /**
  * 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");
     }
 }
Esempio n. 22
0
EOT;
    exit(1);
}
$files = array();
$reportClass = 'TextReporter';
array_shift($argv);
foreach ($argv as $option) {
    if ($option == '--earl') {
        require_once dirname(__FILE__) . '/EarlReporter.php';
        $reportClass = 'EarlReporter';
    } else {
        //file?
        if (!file_exists($option)) {
            echo "File {$option} does not exist\n";
            exit(2);
        }
        $files[] = $option;
    }
}
require_once SIMPLETEST_INCLUDE_DIR . 'unit_tester.php';
require_once SIMPLETEST_INCLUDE_DIR . 'reporter.php';
require_once 'show_passes.php';
require_once RDFAPI_INCLUDE_DIR . 'RdfAPI.php';
$_SESSION['passes'] = 0;
$_SESSION['fails'] = 0;
$test_sparql = new GroupTest('some RDF API for PHP tests');
foreach ($files as $file) {
    $test_sparql->addTestFile($file);
}
//$test_sparql->run(new ShowPasses());
$test_sparql->run(new $reportClass());
Esempio n. 23
0
<?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 &copy; 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();
Esempio n. 24
0
<?php

/**
 * A group test template using the SimpleTest unit testing package.
 * Just add the UnitTestCase files below using addTestFile().
 *
 * @package harmoni.tests
 * 
 * @copyright Copyright &copy; 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:54 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('ExamplePackage tests');
$test->addTestFile(HARMONI . 'examplePackage/tests/ExampleClassTestCase.class.php');
$test->attachObserver(new DoboTestHtmlDisplay());
$test->run();
Esempio n. 25
0
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>";
// $num = $dbHandler->getTotalNumberOfQueries();
Esempio n. 26
0
 * Just add the UnitTestCase files below using addTestFile().
 *
 * @since 5/23/05
 *
 * @package harmoni.osid_v2.chronology.tests
 * 
 * @copyright Copyright &copy; 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:26 adamfranco Exp $
 *
 * @link http://harmoni.sourceforge.net/
 * @author Adam Franco <adam AT adamfranco DOT com> <afranco AT middlebury DOT edu>
 */
if (!defined('HARMONI')) {
    define('HARMONI', dirname(__FILE__) . "/../../../../");
}
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('Chronology StringParser Tests');
$test->addTestFile(dirname(__FILE__) . '/ISO8601StringParserTestCase.class.php');
$test->addTestFile(dirname(__FILE__) . '/DayMonthNameYearStringParserTestCase.class.php');
$test->addTestFile(dirname(__FILE__) . '/MonthNameDayYearStringParserTestCase.class.php');
$test->addTestFile(dirname(__FILE__) . '/MonthNumberDayYearStringParserTestCase.class.php');
$test->addTestFile(dirname(__FILE__) . '/KeywordStringParserTestCase.class.php');
$test->addTestFile(dirname(__FILE__) . '/DateAndTimeStringParserTestCase.class.php');
$test->attachObserver(new DoboTestHtmlDisplay());
$test->run();
Esempio n. 27
0
<?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;
Esempio n. 28
0
    print "SimpleTest could not be found and so no tests can be made.\n";
    exit(1);
}
require_once SIMPLE_TEST . 'unit_tester.php';
require_once SIMPLE_TEST . 'reporter.php';
if (!empty($argc) and $argc > 1) {
    /* If command line arguments are given, then only test those. */
    array_shift($argv);
    $tests = $argv;
    $group = new GroupTest('Selected PEL tests');
} else {
    /* otherwive test all .php files, except this file (run-tests.php). */
    $tests = array_diff(glob('*.php'), array('run-tests.php', 'config.local.php', 'config.local.example.php'));
    $group = new GroupTest('All PEL tests');
    /* Also test all image tests (if they are available). */
    if (is_dir('image-tests')) {
        $image_tests = array_diff(glob('image-tests/*.php'), array('image-tests/make-image-test.php'));
        $image_group = new GroupTest('Image Tests');
        foreach ($image_tests as $image_test) {
            $image_group->addTestFile($image_test);
        }
        $group->addTestCase($image_group);
    } else {
        echo "Found no image tests, only core functionality will be tested.\n";
        echo "Image tests are available from http://pel.sourceforge.net/.\n";
    }
}
foreach ($tests as $test) {
    $group->addTestFile($test);
}
$group->run(new TextReporter());
Esempio n. 29
0
<?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());
}
Esempio n. 30
0
 * @copyright Copyright &copy; 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:26 adamfranco Exp $
 *
 * @link http://harmoni.sourceforge.net/
 * @author Adam Franco <adam AT adamfranco DOT com> <afranco AT middlebury DOT edu>
 */
if (!defined('HARMONI')) {
    require_once dirname(__FILE__) . "/../../../../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('Chronology Tests');
$test->addTestFile(dirname(__FILE__) . '/DateTestCase.class.php');
$test->addTestFile(dirname(__FILE__) . '/DateAndTimeTestCase.class.php');
$test->addTestFile(dirname(__FILE__) . '/DurationTestCase.class.php');
$test->addTestFile(dirname(__FILE__) . '/MonthTestCase.class.php');
$test->addTestFile(dirname(__FILE__) . '/ScheduleTestCase.class.php');
$test->addTestFile(dirname(__FILE__) . '/TimeTestCase.class.php');
$test->addTestFile(dirname(__FILE__) . '/TimeStampTestCase.class.php');
$test->addTestFile(dirname(__FILE__) . '/TimespanTestCase.class.php');
$test->addTestFile(dirname(__FILE__) . '/YearTestCase.class.php');
$test->addTestFile(dirname(__FILE__) . '/WeekTestCase.class.php');
$test->addTestFile(dirname(__FILE__) . '/SObjectTestCase.class.php');
$test->addTestFile(dirname(__FILE__) . '/../StringParser/tests/test.php');
$test->attachObserver(new DoboTestHtmlDisplay());
$test->run();