addFile() public method

The new suite is composed into this one.
public addFile ( string $test_file )
$test_file string File name of library with test case classes.
Example #1
0
 function __construct()
 {
     parent::TestSuite("All Generic Tephlon Tests");
     $tFiles = glob("*Test.php");
     foreach ($tFiles as $f) {
         echo "adding {$f}";
         parent::addFile($f);
         parent::run(new TextReporter());
     }
 }
Example #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('TestSuite')) {
         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 TestSuite('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->addFile($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);
 }
Example #3
0
 public function testContentOfRecorderWithOnePassAndOneFailure()
 {
     $test = new TestSuite();
     $test->addFile(dirname(__FILE__) . '/support/recorder_sample.php');
     $recorder = new Recorder(new SimpleReporter());
     $test->run($recorder);
     $this->assertEqual(count($recorder->results), 2);
     $this->assertIsA($recorder->results[0], 'SimpleResultOfPass');
     $this->assertEqual('testTrueIsTrue', array_pop($recorder->results[0]->breadcrumb));
     $this->assertPattern('/ at \\[.*\\Wrecorder_sample\\.php line 9\\]/', $recorder->results[0]->message);
     $this->assertIsA($recorder->results[1], 'SimpleResultOfFail');
     $this->assertEqual('testFalseIsTrue', array_pop($recorder->results[1]->breadcrumb));
     $this->assertPattern("/Expected false, got \\[Boolean: true\\] at \\[.*\\Wrecorder_sample\\.php line 14\\]/", $recorder->results[1]->message);
 }
Example #4
0
 public function testPass()
 {
     $listener = new MockSimpleSocket();
     $fullpath = realpath(dirname(__FILE__) . '/support/test1.php');
     $testpath = EclipseReporter::escapeVal($fullpath);
     $expected = "{status:\"pass\",message:\"pass1 at [{$testpath} line 4]\",group:\"{$testpath}\",case:\"test1\",method:\"test_pass\"}";
     //this should work...but it doesn't so the next line and the last line are the hacks
     //$listener->expectOnce('write',array($expected));
     $listener->returnsByValue('write', -1);
     $pathparts = pathinfo($fullpath);
     $filename = $pathparts['basename'];
     $test = new TestSuite($filename);
     $test->addFile($fullpath);
     $test->run(new EclipseReporter($listener));
     $this->assertEqual($expected, $listener->output);
 }
Example #5
0
 function testContentOfRecorderWithOnePassAndOneFailure()
 {
     $test = new TestSuite();
     $test->addFile(dirname(__FILE__) . '/sample.php');
     $recorder = new Recorder();
     $test->run($recorder);
     $this->assertEqual(count($recorder->results), 2);
     $d = '[\\\\\\/]';
     // backslash or slash
     $this->assertEqual(count($recorder->results[0]), 4);
     $this->assertPattern("/" . substr(time(), 9) . "/", $recorder->results[0]['time']);
     $this->assertEqual($recorder->results[0]['status'], "Passed");
     $this->assertPattern("/sample\\.php->SampleTestForRecorder->testTrueIsTrue/i", $recorder->results[0]['test']);
     $this->assertPattern("/ at \\[.*recorder{$d}test{$d}sample\\.php line 7\\]/", $recorder->results[0]['message']);
     $this->assertEqual(count($recorder->results[1]), 4);
     $this->assertPattern("/" . substr(time(), 9) . "/", $recorder->results[1]['time']);
     $this->assertEqual($recorder->results[1]['status'], "Failed");
     $this->assertPattern("/sample\\.php->SampleTestForRecorder->testFalseIsTrue/i", $recorder->results[1]['test']);
     $this->assertPattern("/Expected false, got \\[Boolean: true\\] at \\[.*recorder{$d}test{$d}sample\\.php line 11\\]/", $recorder->results[1]['message']);
 }
 public static function call_simpletest(pakeTask $task, $type = 'text', $dirs = array())
 {
     if (!class_exists('TestSuite')) {
         throw new pakeException('You must install SimpleTest to use this task.');
     }
     SimpleTest::ignore('UnitTestCase');
     $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;
     }
     $files = pakeFinder::type('file')->name('*Test.php')->in($test_dirs);
     if (count($files) == 0) {
         throw new pakeException('No test to run.');
     }
     $test = new TestSuite('Test suite in (' . implode(', ', $test_dirs) . ')');
     foreach ($files as $file) {
         $test->addFile($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;
     }
 }
Example #7
0
$events = $notifications->getEvents();
foreach ($events as $type => $subtypes) {
    foreach ($subtypes as $subtype => $actions) {
        $notifications->unregisterEvent($type, $subtype);
    }
}
// disable emails
_elgg_services()->setValue('mailer', new InMemoryTransport());
// Disable maximum execution time.
// Tests take a while...
set_time_limit(0);
$suite = new TestSuite('Elgg Core Unit Tests');
// emit a hook to pull in all tests
$test_files = elgg_trigger_plugin_hook('unit_test', 'system', null, array());
foreach ($test_files as $file) {
    $suite->addFile($file);
}
if (TextReporter::inCli()) {
    // In CLI error codes are returned: 0 is success
    $start_time = microtime(true);
    $reporter = new TextReporter();
    $result = $suite->Run($reporter) ? 0 : 1;
    echo sprintf("Time: %.2f seconds, Memory: %.2fMb\n", microtime(true) - $start_time, memory_get_peak_usage() / 1048576.0);
    // deactivate plugins that were activated for test suite
    foreach ($plugins as $key => $id) {
        $plugin = elgg_get_plugin_from_id($id);
        $plugin->deactivate();
    }
    exit($result);
}
$old = elgg_set_ignore_access(true);
Example #8
0
EOM;
    exit(0);
}
$testFiles = array_filter($options->values('--file'));
$dirs = array_filter($options->values('--dir'));
// default to this app's tests
if (!$options->has('--file', '--dir')) {
    $dirs[] = BASEDIR;
}
// add all directories
foreach ($dirs as $dir) {
    $classloader->includePaths(array($dir . '/classes', $dir . '/tests'));
}
// write an include path
$classloader->export();
require_once 'autorun.php';
$suite = new TestSuite('Tests');
if ($testFiles) {
    foreach ($testFiles as $test) {
        $suite->addFile($test);
    }
} else {
    foreach ($dirs as $dir) {
        $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir . '/tests'));
        foreach ($iterator as $file) {
            if (preg_match('/(UseCase|Test).php$/', $file->getFileName())) {
                $suite->addFile($file->getPathname());
            }
        }
    }
}
Example #9
0
<?php

define('SIMPLE_TEST', '../../simpletest/');
require_once SIMPLE_TEST . 'unit_tester.php';
require_once SIMPLE_TEST . 'web_tester.php';
require_once '../../phpQuery/phpQuery.php';
define('C5_ENVIRONMENT_ONLY', true);
define('DIR_BASE', dirname(__FILE__) . '/..');
require '../concrete/dispatcher.php';
require 'testing_base.php';
$c = Page::getByID(1);
$cp = new Permissions($c);
$a = Area::get($c, 'Main');
$ap = new Permissions($a);
class ShowPasses extends HtmlReporter
{
    function ShowPasses()
    {
        $this->HtmlReporter();
    }
    function paintPass($message)
    {
        parent::paintPass($message);
        print "<span class=\"pass\">Pass</span>: ";
        print " {$message}<br />\n";
    }
}
$t = new TestSuite('All Tests');
$t->addFile($_SERVER['DOCUMENT_ROOT'] . '/web/tests/template_tests.php');
$t->addFile($_SERVER['DOCUMENT_ROOT'] . '/web/tests/block_override_tests.php');
$t->run(new ShowPasses());
Example #10
0
<?php

if (!defined('ALLTESTRUNNER')) {
    require_once '../../test_bootstrap.php';
    define('TESTGROUPRUNNER', true);
}
$editTest = new TestSuite('Edit Controllers');
$editTest->addFile('bulldoc/test/cases/edit/page_edit/controller_test.php');
if (!defined('ALLTESTRUNNER')) {
    $editTest->run(new HtmlReporter());
}
Example #11
0
if (defined('STDIN') && count($argv) > 1) {
    if ($argv[1] == 'noseeds') {
        $test_seeds = false;
    }
}
$test = new TestSuite('All tests');
// All tests should be of the form NNN_description.php
// Notably, this excludes all.php and base.php, which are special
$test_files = glob(dirname(__FILE__) . "/*_*.php");
foreach ($test_files as $file) {
    $go = true;
    if (strpos($file, 'Seed') && !$test_seeds) {
        $go = false;
    }
    if ($go) {
        $test->addFile($file);
    }
}
if (TextReporter::inCli()) {
    echo "\n\n";
    $code = $test->run(new TextReporter()) ? 0 : 1;
    if ($code == 0) {
        echo "\nResult: PASS\n";
    } else {
        echo "\nResult: FAIL\n";
    }
    exit($code);
}
?>

Example #12
0
 function testLoadIfIncluded()
 {
     $tests = new TestSuite();
     $tests->addFile(dirname(__FILE__) . '/support/test1.php');
     $this->assertEqual($tests->getSize(), 1);
 }
Example #13
0
 /**
  * Run the tests, returning the reporter output.
  */
 public function Run()
 {
     // Save superglobals that might be tested.
     if (isset($_SESSION)) {
         $oldsession = $_SESSION;
     }
     $oldrequest = $_REQUEST;
     $oldpost = $_POST;
     $oldget = $_GET;
     $oldfiles = $_FILES;
     $oldcookie = $_COOKIE;
     $group_test = new TestSuite($this->testTitle);
     // Add files in tests_dir
     if (is_dir($this->testDir)) {
         if ($dh = opendir($this->testDir)) {
             while (($file = readdir($dh)) !== FALSE) {
                 // Test if file ends with php, then include it.
                 if (substr($file, -(strlen($this->fileExtension) + 1)) == '.' . $this->fileExtension) {
                     $group_test->addFile($this->testDir . "/{$file}");
                 }
             }
             closedir($dh);
         }
     }
     // Start the tests
     ob_start();
     $group_test->run(new $this->Reporter());
     $output_buffer = ob_get_clean();
     // Restore superglobals
     if (isset($oldsession)) {
         $_SESSION = $oldsession;
     }
     $_REQUEST = $oldrequest;
     $_POST = $oldpost;
     $_GET = $oldget;
     $_FILES = $oldfiles;
     $_COOKIE = $oldcookie;
     return $output_buffer;
 }
Example #14
0
<?php

if (!defined('AROOT')) {
    die('NO AROOT!');
}
if (!defined('DS')) {
    define('DS', DIRECTORY_SEPARATOR);
}
// define constant
define('IN', true);
define('ROOT', dirname(__FILE__) . DS);
define('CROOT', ROOT . 'core' . DS);
define('TROOT', ROOT . 'simpletest' . DS);
// define
error_reporting(E_ALL ^ E_NOTICE);
ini_set('display_errors', true);
include_once CROOT . 'lib' . DS . 'core.function.php';
@(include_once AROOT . 'lib' . DS . 'app.function.php');
include_once CROOT . 'config' . DS . 'core.config.php';
include_once AROOT . 'config' . DS . 'app.config.php';
require_once TROOT . 'autorun.php';
require_once TROOT . 'web_tester.php';
$test = new TestSuite('LazyPHP Test Center');
foreach (glob(AROOT . 'test' . DS . 'phptest' . DS . '*.test.php') as $f) {
    $test->addFile($f);
}
echo date("Y-m-d H:i:s");
//$test->run(new HtmlReporter('UTF-8'));
unset($test);
$CI =& get_instance();
ob_end_clean();
$CI->load->library('session');
$CI->session->sess_destroy();
$CI->load->helper('directory');
$CI->load->helper('form');
// Get all main tests
if ($run_all or !empty($_POST) && !isset($_POST['test'])) {
    $test_objs = array('controllers', 'models', 'views', 'libraries', 'bugs', 'helpers');
    foreach ($test_objs as $obj) {
        if (isset($_POST[$obj]) or $run_all) {
            $dir = TESTS_DIR . $obj;
            $dir_files = directory_map($dir);
            foreach ($dir_files as $file) {
                if ($file != 'index.html') {
                    $test_suite->addFile($dir . '/' . $file);
                }
            }
        }
    }
} elseif (isset($_POST['test'])) {
    $file = $_POST['test'];
    if (file_exists(TESTS_DIR . $file)) {
        $test_suite->addFile(TESTS_DIR . $file);
    }
}
// ------------------------------------------------------------------------
/**
 * Function to determine if in cli mode and if so set up variables to make it work
 *
 * @param Array of commandline args
Example #16
0
define('LIQUID_INCLUDE_PREFIX', '');
require_once dirname(__FILE__) . '/../Liquid.class.php';
// include library
require_once SIMPLETEST_PATH . 'autorun.php';
// include test classes
include __DIR__ . '/LiquidTestcase.php';
$test = new TestSuite('All liquid tests');
$path = dirname(__FILE__) . '/liquid/';
// include all classes
$dir = dir($path);
while (($file = $dir->read()) !== false) {
    if (substr($file, 0, 1) == '.') {
        continue;
    }
    if (is_file($path . $file) && substr($file, -8) == 'Test.php') {
        $test->addFile($path . $file);
    }
}
class ShowPasses extends HtmlReporter
{
    function paintPass($message)
    {
        parent::paintPass($message);
        print "<span class=\"pass\">Pass</span>: ";
        $breadcrumb = $this->getTestList();
        array_shift($breadcrumb);
        // print implode("->", $breadcrumb);
        print "->{$message}<br />\n";
    }
    protected function getCss()
    {
Example #17
0
 /**
  * run all the tests
  * @return the result the test running
  * @param object $reporter
  */
 public function runAllTests(&$reporter)
 {
     $testsFile = $this->getTestCaseList();
     $test = new TestSuite('All Tests');
     foreach ($testsFile as $path => $file) {
         $test->addFile($path);
     }
     return $test->run($reporter);
 }
 function addFile($path)
 {
     parent::addFile(plugin_dir_path(CSM_PLUGIN_FILE) . 'tests/' . $path);
 }
Example #19
0
<?php

require_once 'simpletest/autorun.php';
$test = new TestSuite('All file tests');
$test->addFile(dirname(__FILE__) . '/reevoo_mark_test.php');
$test->addFile(dirname(__FILE__) . '/reevoo_mark_api_test.php');
$test->addFile(dirname(__FILE__) . '/reevoo_mark_document_test.php');
$test->addFile(dirname(__FILE__) . '/reevoo_mark_http_client_test.php');
exit($test->run(new TextReporter()) ? 0 : 1);
Example #20
0
if (($testFileFlagIndex = array_search('--testfile', $argv)) !== false) {
    $testFile = $argv[$testFileFlagIndex + 1];
    $existingClasses = get_declared_classes();
    require_once $testFile;
    $newClasses = array_diff(get_declared_classes(), $existingClasses);
    if (!($testClass = array_shift($newClasses))) {
        die('No classes declared in file: ' . $testFile);
    }
    $test = new $testClass($testFile);
} else {
    $test = new TestSuite('All Tests');
    foreach (pheanstalk_glob_recursive(dirname(__FILE__), '*Test.php') as $testFile) {
        if (!$withServer && preg_match('#ConnectionTest#', $testFile)) {
            continue;
        }
        $test->addFile($testFile);
    }
}
$test->run(new TextReporter());
// ----------------------------------------
// helper functions
/**
 * Return array of files matched, decending into subdirectories
 * @param string $dir The base directory to search from.
 * @param string $pattern The glob pattern.
 * @return array [ 'path/to/file1', 'path/to/file2', ... ]
 */
function pheanstalk_glob_recursive($dir, $pattern)
{
    $dir = escapeshellcmd($dir);
    // list of all matching files currently in the directory.
Example #21
0
 function xmlTests()
 {
     //
     //xml
     $xml_tests = new TestSuite("Xml tests.");
     $xml_tests->addFile(TEST_ROOT . 'xml/xml_builder_test.php');
     $xml_tests->addFile(TEST_ROOT . 'xml/simplexml_parser_test.php');
     $xml_tests->addFile(TEST_ROOT . 'xml/xpath_test.php');
     //add to global test suite
     $this->add($xml_tests);
 }
Example #22
0
// their own sessions. This also allows us to not contaminate test
// results with our own session information.
$ci->load->library('session');
$ci->session->sess_destroy();
$ci->load->helper('directory');
// Start your engines!
$test_start = microtime();
$test_files = null;
// TODO Revise to allow args from the CLI as folder/file names
$only_folder = isset($only_folder) && !empty($only_folder) ? TESTS_DIR . $only_folder : null;
$all_tests = discover_tests(TESTS_DIR, true);
$test_files = discover_tests($only_folder);
// Add the found test files to the suite to be tested.
if (is_array($test_files)) {
    foreach ($test_files as $file) {
        $test_suite->addFile($file);
    }
}
// ------------------------------------------------------------------------
//variables for report
/*
$controllers = map_tests(TESTS_DIR . 'controllers');
$models = map_tests(TESTS_DIR . 'models');
$views = map_tests(TESTS_DIR . 'views');
$libraries = map_tests(TESTS_DIR . 'libraries');
$bugs = map_tests(TESTS_DIR . 'bugs');
$helpers = map_tests(TESTS_DIR . 'helpers');
*/
$form_url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$test_end = microtime();
/* Benchmark */
<?php

require_once 'boot.php';
require_once 'lib/simpletest/autorun.php';
function prep_tests()
{
    global $db;
    $db = new mysqli(TEST_DB_HOST, TEST_DB_USER, TEST_DB_PASS, TEST_DB_NAME);
    $db->query("TRUNCATE `action`");
    $db->query("TRUNCATE `action_content`");
    $db->query("TRUNCATE `action_content_detail`");
    $db->query("TRUNCATE `action_target`");
    $db->query("TRUNCATE `campaign`");
    $db->query("TRUNCATE `donation`");
    $db->query("TRUNCATE `donate_page`");
    $db->query("TRUNCATE `email`");
    $db->query("TRUNCATE `email_blast`");
    $db->query("TRUNCATE `email_blast_statistics`");
    $db->query("TRUNCATE `groups`");
    $db->query("TRUNCATE `supporter`");
    $db->query("TRUNCATE `supporter_action`");
    $db->query("TRUNCATE `supporter_groups`");
    $db->query("TRUNCATE `tell_a_friend`");
    $db->query("TRUNCATE `unsubscribe`");
}
prep_tests();
$test = new TestSuite('Monsterpants');
$test->addFile('test/salsa_supporter_tests.php');
Example #24
0
<?php

// $Id$
require_once 'simple_include.php';
require_once 'pager_include.php';
$test = new TestSuite('Pager POST tests');
$test->addFile('pager_post_test.php');
$test->addFile('pager_post_test_simple.php');
exit($test->run(new HTMLReporter()) ? 0 : 1);
Example #25
0
 /**
  * The main entry point
  *
  * @throws BuildException
  */
 public function main()
 {
     $suite = new TestSuite();
     $filenames = $this->getFilenames();
     foreach ($filenames as $testfile) {
         $suite->addFile($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($suite);
     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 #26
0
 function single()
 {
     $conf = jApp::config();
     if (!isset($conf->enableTests) || !$conf->enableTests) {
         // security
         $rep = $this->getResponse('html', true);
         $rep->title = 'Error';
         $rep->setHttpStatus('404', 'Not found');
         $rep->addContent('<p>404 Not Found</p>');
         return $rep;
     }
     $rep = $this->_prepareResponse();
     $module = $this->param('mod');
     $testname = $this->param('test');
     if (isset($this->testsList[$module])) {
         $reporter = jClasses::create("junittests~jhtmlrespreporter");
         jClasses::inc('junittests~junittestcase');
         jClasses::inc('junittests~junittestcasedb');
         $reporter->setResponse($rep);
         foreach ($this->testsList[$module] as $test) {
             if ($test[1] == $testname) {
                 $group = new TestSuite('"' . $module . '" module , ' . $test[2]);
                 $group->addFile($conf->_modulesPathList[$module] . 'tests/' . $test[0]);
                 jApp::pushCurrentModule($module);
                 $group->run($reporter);
                 jApp::popCurrentModule();
                 break;
             }
         }
     } else {
         $rep->body->assign('MAIN', '<p>no tests for "' . $module . '" module.</p>');
     }
     return $this->_finishResponse($rep);
 }
 function single()
 {
     $rep = $this->_prepareResponse();
     $module = $this->param('mod');
     $testname = $this->param('test');
     $category = $this->category ? ' ' . $this->category : '';
     if (isset($this->testsList[$module])) {
         $reporter = jClasses::create($this->responseType);
         jClasses::inc('junittests~junittestcase');
         jClasses::inc('junittests~junittestcasedb');
         $reporter->setResponse($rep);
         foreach ($this->testsList[$module] as $test) {
             if ($test[1] == $testname) {
                 $group = new TestSuite('"' . $module . '" module , ' . $test[2]);
                 $group->addFile(jApp::config()->_modulesPathList[$module] . 'tests/' . $test[0]);
                 jApp::pushCurrentModule($module);
                 $result = $group->run($reporter);
                 if (!$result) {
                     $rep->setExitCode(jResponseCmdline::EXIT_CODE_ERROR);
                 }
                 jApp::popCurrentModule();
                 break;
             }
         }
     } else {
         $this->output("\n" . 'no' . $category . ' tests for "' . $module . '" module.' . "\n");
     }
     return $this->_finishResponse($rep);
 }
Example #28
0
 */
/* $Id$ */
error_reporting(E_ALL);
require_once 'simpletest/unit_tester.php';
require_once 'simpletest/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 TestSuite('Selected PEL tests');
} else {
    // otherwive test all .php files, except this file (run-tests.php).
    $tests = array_diff(glob(dirname(__FILE__) . '/*.php'), array('run-tests.php', 'config.local.php', 'config.local.example.php'));
    $group = new TestSuite('All PEL tests');
    // Also test all image tests (if they are available).
    if (is_dir(dirname(__FILE__) . '/image-tests')) {
        $image_tests = array_diff(glob(dirname(__FILE__) . '/image-tests/*.php'), array(dirname(__FILE__) . '/image-tests/make-image-test.php'));
        $image_group = new TestSuite('Image Tests');
        foreach ($image_tests as $image_test) {
            $image_group->addFile($image_test);
        }
        $group->add($image_group);
    } else {
        echo "Found no image tests, only core functionality will be tested.\n";
        echo "Image tests are available from http://github.com/lsolesen/pel/.\n";
    }
}
foreach ($tests as $test) {
    $group->addFile($test);
}
$group->run(new TextReporter());
<?php

// $Id$
require_once '../unit_tester.php';
require_once '../reporter.php';
$test = new TestSuite('This should fail');
$test->addFile('test_with_parse_error.php');
$test->run(new NoPassesReporter(new HtmlReporter()));
Example #30
0
define('EXEC_VERSION', $versionInfo[1]);
$selected = array();
if (TextReporter::inCli()) {
    $reporter = new TextReporter();
    // take parameters as tests to run
    while (1 < count($argv)) {
        $selected[] = array_pop($argv);
    }
} else {
    $reporter = new HtmlReporter();
    // run.php?selected[]=zerovalue&selected[]=lastline
    if (isset($_GET) && array_key_exists('selected', $_GET)) {
        $selected = (array) $_GET['selected'];
    }
}
// All tests, grouped
$allTests = array('Base' => array('parser', 'config', 'ignorePackageTags', 'useClassPathAsPackage', 'namespaceSyntax', 'namespaceNameOverlap', 'traits'), 'Standard Doclet' => array('standardDoclet', 'accessLevel', 'accessLevelPHP5', 'throwsTag'), 'Bugfixes' => array('linefeed', 'lastLine', 'zeroValue', 'todoTag', 'commentLinks'), 'Formatters' => array('listsUl', 'markdown'));
$suite = new TestSuite('PHPDoctor');
foreach ($allTests as $name => $tests) {
    $group = new TestSuite($name);
    foreach ($tests as $test) {
        if (!$selected || in_array($test, $selected)) {
            $group->addFile(sprintf('tests/cases/Test%s.php', ucwords($test)));
        }
    }
    $suite->add($group);
}
if (TextReporter::inCli()) {
    exit($suite->run($reporter) ? 0 : 1);
}
$suite->run($reporter);