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());
 }
Example #2
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;
}
Example #3
0
 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);
     }
 }
Example #4
0
 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();
 }
 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);
 }
  function LimbGroupTest($label = false, $auto_label = true)
  {
    if($label && $auto_label)
      $label = make__FILE__readable($label);

    parent :: GroupTest($label);
  }
Example #7
0
 function __construct($title = false)
 {
     parent::__construct($title);
     $path = dirname(__FILE__);
     $this->addTestClass('TestOfAnnotations');
     $this->addTestClass('TestOfAnnotation');
     $this->addTestClass('TestOfAnnotationParser');
     $this->addTestClass('TestOfDocComment');
 }
Example #8
0
 function __construct($title = false)
 {
     parent::__construct($title);
     $this->addTestClass('TestOfAnnotations');
     $this->addTestClass('TestOfPerformanceFeatures');
     $this->addTestClass('TestOfSupportingFeatures');
     $this->addTestClass('TestOfAnnotation');
     $this->addTestClass('TestOfConstrainedAnnotation');
     $this->addTestClass('TestOfMatchers');
     $this->addTestClass('TestOfAnnotationMatchers');
     $this->addTestClass('TestOfDocComment');
 }
Example #9
0
 public static function setUpBeforeClass()
 {
     $adminUsername = getenv('jasmin_admin_username') ?: 'jcliadmin';
     $adminPassword = getenv('jasmin_admin_password') ?: 'jclipwd';
     $adminHost = getenv('jasmin_admin_host') ?: '127.0.0.1';
     $adminPort = getenv('jasmin_admin_port') ?: 8990;
     self::$telnetConnector = JasminConnector::init($adminUsername, $adminPassword, $adminHost, $adminPort);
     $manager = new \JasminWeb\Jasmin\Group(self::$telnetConnector);
     $manager->setId('test_new_one');
     $manager->delete();
     $manager->setId('test_not_exist');
     $manager->delete();
     $manager->setId('test_exist');
     $manager->save();
 }
Example #10
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());
}
Example #11
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);
 }
Example #12
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;
Example #13
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');
// }}}
Example #14
0
<?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());
 /**
  * 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();
         file_put_contents(dirname(__FILE__) . '/coverage/coverage.txt', serialize($result));
         require_once dirname(__FILE__) . '/DoctrineTest/Coverage.php';
         $coverageGeneration = new DoctrineTest_Coverage();
         $coverageGeneration->generateReport();
         return $ret;
         // */
     }
     if (array_key_exists('only-failed', $options)) {
         $testGroup->onlyRunFailed(true);
     }
     $result = $testGroup->run($reporter, $filter);
     global $startTime;
     $endTime = time();
     $time = $endTime - $startTime;
     if (PHP_SAPI === 'cli') {
         echo "\nTests ran in " . $time . " seconds and used " . memory_get_peak_usage() / 1024 . " KB of memory\n\n";
     } else {
         echo "<p>Tests ran in " . $time . " seconds and used " . memory_get_peak_usage() / 1024 . " KB of memory</p>";
     }
     return $result;
 }
Example #16
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();
Example #17
0
        $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();
 /**
  * Constructor.
  * Loads in all the testcases.
  */
 public function __construct()
 {
     parent::__construct("TestOfMessage");
     $this->addTestCase(new GeneralTestOfMessage());
     $this->addTestCase(new TestOfMessageWithSubParts());
     $this->addTestCase(new TestOfMessageWithAttachments());
     $this->addTestCase(new TestOfMessageWithSubPartsAndAttachments());
     $this->addTestCase(new TestOfMessageWithEmbeddedFiles());
     $this->addTestCase(new TestOfMessageWithSubPartsAndEmbeddedFiles());
     $this->addTestCase(new TestOfMessageWithAttachmentsAndEmbeddedFiles());
     $this->addTestCase(new TestOfMessageWithAttachments_EmbeddedFiles_AndSubParts());
 }
Example #19
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();
Example #20
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");
     }
 }
Example #21
0
$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>";
Example #22
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());
}

?>
 function _createGroupFromClasses($title, $classes)
 {
     $group = new GroupTest($title);
     foreach ($classes as $class) {
         if (SimpleTestOptions::isIgnored($class)) {
             continue;
         }
         $group->addTestClass($class);
     }
     return $group;
 }
Example #24
0
 /**
  *  ユニットテストを実行する
  *
  *  @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);
 }
Example #25
0
// 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();
Example #26
0
 private function runSelectedTests()
 {
     include './modules/tests/testcases/UnitTests.php';
     include './modules/tests/testcases/WebTests.php';
     include './modules/tests/testcases/AJAXTests.php';
     $microTimeArray = explode(' ', microtime());
     $microTimeStart = $microTimeArray[1] + $microTimeArray[0];
     /* FIXME: 3 groups! Unit, Web, AJAX. */
     $groupTest = new GroupTest('CATS Test Suite');
     foreach ($this->_unitTestCases as $offset => $value) {
         if ($this->isChecked($value[0], $_POST)) {
             $groupTest->addTestCase(new $value[0]());
         }
     }
     foreach ($this->_systemTestCases as $offset => $value) {
         if ($this->isChecked($value[0], $_POST)) {
             $groupTest->addTestCase(new $value[0]());
         }
     }
     foreach ($this->_AJAXTestCases as $offset => $value) {
         if ($this->isChecked($value[0], $_POST)) {
             $groupTest->addTestCase(new $value[0]());
         }
     }
     $reporter = new CATSTestReporter($microTimeStart);
     $reporter->showPasses = true;
     $reporter->showFails = true;
     $groupTest->run($reporter);
 }
Example #27
0
 /**
  *    Builds a group test from a library of test cases.
  *    The new group is composed into this one.
  *    @param $test_file        File name of library with
  *                             test case classes.
  */
 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->_is_test_case($class)) {
             continue;
         }
         $group->addTestCase(new $class());
     }
     $this->addTestCase($group);
 }
Example #28
0
 /**
  *    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;
 }
Example #29
0
require_once $dir_plugins . '/tbs_plugin_cache.php';
require_once $dir_plugins . '/tbs_plugin_mergeonfly.php';
require_once $dir_plugins . '/tbs_plugin_navbar.php';
// @require_once($dir_plugins.'/tbs_plugin_ref.php');
// @require_once($dir_plugins.'/tbs_plugin_syntaxes.php');
// other files required for unit tests
require_once $dir_testu . '/include/TBSUnitTestCase.php';
require_once $dir_testu . '/include/HtmlCodeCoverageReporter.php';
// include unit test classes
include $dir_testu . '/testcase/AttTestCase.php';
include $dir_testu . '/testcase/QuoteTestCase.php';
include $dir_testu . '/testcase/FrmTestCase.php';
include $dir_testu . '/testcase/StrconvTestCase.php';
include $dir_testu . '/testcase/FieldTestCase.php';
include $dir_testu . '/testcase/BlockTestCase.php';
include $dir_testu . '/testcase/MiscTestCase.php';
include $dir_testu . '/testcase/SubTplTestCase.php';
// launch tests
ini_set("display_errors", "On");
set_time_limit(0);
$tbs = new clsTinyButStrong();
$test = new GroupTest('TinyButStrong v' . $tbs->Version . ' (with PHP ' . PHP_VERSION . ')');
$test->addTestCase(new FieldTestCase());
$test->addTestCase(new BlockTestCase());
$test->addTestCase(new AttTestCase());
$test->addTestCase(new QuoteTestCase());
$test->addTestCase(new FrmTestCase());
$test->addTestCase(new StrconvTestCase());
$test->addTestCase(new MiscTestCase());
$test->addTestCase(new SubTplTestCase());
$test->run(new HtmlCodeCoverageReporter(array($tbsFileName, $dir_tbs . '/plugins/')));
Example #30
0
            }
        }
    }
    /**
     * @todo Implement testGetAddEditForm().
     */
    public function testGetAddEditForm()
    {
        // Remove the following lines when you implement this test.
        $this->markTestIncomplete('This test has not been implemented yet.');
    }
    /**
     * @todo Implement testGetGroups().
     */
    public function testGetGroups()
    {
        $groups = $this->object->getGroups();
        if (!is_array($groups)) {
            $this->fail();
        }
        foreach ($groups as $group) {
            if (!$group instanceof Group) {
                $this->fail();
            }
        }
    }
}
// Call GroupTest::main() if this source file is executed directly.
if (PHPUnit_MAIN_METHOD == 'GroupTest::main') {
    GroupTest::main();
}