public function run($pathToApp)
 {
     $additionalArgs = array("-SimulateApplication", $pathToApp);
     $this->appName = end(explode("/", $pathToApp));
     $this->additionalArguments = $additionalArgs;
     return parent::run();
 }
Пример #2
0
 public function testPhpRQ()
 {
     if (!self::$redis instanceof Client) {
         throw new \Exception('The PhpRQ test suit can be run only with php-rq-run-tests binary or by implementing
             the ClientProvider and running the TestRunner in your test suite.');
     }
     $redisProvider = new ClientProvider();
     $redisProvider->registerProvider(function () {
         self::$redis->flushdb();
         self::$redis->script('flush');
         return self::$redis;
     });
     $test = new TestRunner($redisProvider);
     $test->run();
 }
        $this->assert($this->Mail->Send(), "Send failed");
    }
}
/**
 * Create and run test instance.
 */
if (isset($HTTP_GET_VARS)) {
    $global_vars = $HTTP_GET_VARS;
} else {
    $global_vars = $_REQUEST;
}
if (isset($global_vars["submitted"])) {
    echo "Test results:<br>";
    $suite = new TestSuite("phpmailerTest");
    $testRunner = new TestRunner();
    $testRunner->run($suite);
    echo "<hr noshade/>";
}
function get($sName)
{
    global $global_vars;
    if (isset($global_vars[$sName])) {
        return $global_vars[$sName];
    } else {
        return "";
    }
}
?>

<html>
<body>
 public function run($app)
 {
     $this->app = $app;
     if (empty($app) || !is_file($app)) {
         return FAILURE;
     }
     parent::run();
 }
Пример #5
0
	php RunTests.php [options] [file or directory]

Options:
	-p <php>    Specify PHP-CGI executable to run.
	-c <path>   Look for php.ini in directory <path> or use <path> as php.ini.
	-d key=val  Define INI entry 'key' with value 'val'.
	-l <path>   Specify path to shared library files (LD_LIBRARY_PATH)
	-s          Show information about skipped tests

<?php
}



/**
 * Execute tests
 */
try {
	@unlink(__DIR__ . '/coverage.dat'); // @ - file may not exist


	$manager = new TestRunner;
	$manager->parseArguments();
	$res = $manager->run();
	die($res ? 0 : 1);

} catch (Exception $e) {
	echo 'Error: ', $e->getMessage(), "\n";
	die(2);
}
		$runner->codeCoverageIgnoreFiles($codeCoverageIgnoreFileList);
	}
	
	/*$testRunnerURL = "http://localhost/~txau/blank/test2/TestRunner/";*/	
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">

<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<title>Test Runner</title>
	<link rel="stylesheet" href="<?php echo $testRunnerURL ?>misc/style.css" type="text/css"></link> 
	<script type="text/javascript" src="<?php echo $testRunnerURL ?>misc/folding.js"></script>
	<script type="text/javascript" src="<?php echo $testRunnerURL ?>misc/selection.js"></script>
</head>

<body>
	
<?php
	$runner->run();
	echo $runner->getTestSelector();
?>

<div id="testResultsContainer">
	<?php echo $runner->getReport(); ?>
</div>

</body>
</html>
Пример #7
0
                            }
                        }
                    }
                    // check results
                    $this->check($test, $test->expect, $result);
                } catch (JsonLdException $e) {
                    echo $eol . $e;
                    $this->failed += 1;
                    echo "FAIL{$eol}";
                }
            }
            if (property_exists($manifest, 'name')) {
                $this->ungroup();
            }
        }
    }
}
// get command line options
$options = getopt('d:');
if ($options === false || !array_key_exists('d', $options)) {
    $var = 'path to json-ld.org/test-suite/tests';
    echo "Usage: php jsonld-tests.php -d <{$var}>{$eol}";
    exit(0);
}
// load and run tests
$tr = new TestRunner();
$tr->group('JSON-LD');
$tr->run($tr->load($options['d']));
$tr->ungroup();
echo "Done. Total:{$tr->total} Passed:{$tr->passed} Failed:{$tr->failed}{$eol}";
/* end of file, omit ?> */
Пример #8
0
        return false;
    }
    protected function getMedian($values)
    {
        sort($values);
        if (count($values) % 2 == 0) {
            // even, take an average of the middle two
            $top = count($values) / 2;
            $bottom = $top - 1;
            $median = bcdiv($values[$bottom] + $values[$top], 2, 6);
        } else {
            $idx = floor(count($values) / 2);
            $median = $values[$idx];
        }
        return $median;
    }
}
$classes = array();
foreach (glob("profiles/*.php") as $filename) {
    include_once $filename;
}
foreach (get_declared_classes() as $strClass) {
    $class = new ReflectionClass($strClass);
    if ($class->implementsInterface('IProfile')) {
        $classes[] = $strClass;
    }
}
$tr = new TestRunner();
$tr->setClasses($classes);
$tr->run();
Пример #9
0
                if ($rmethod->isPublic() && preg_match("/^test_/", $rmethod->getName())) {
                    try {
                        $tests++;
                        $rmethod->invoke($test);
                    } catch (AssertionError $aerr) {
                        $failures++;
                        echo "--> [" . $rclass->getName() . "::" . $rmethod->getName() . "] " . $aerr->getMessage() . "\n";
                    }
                }
            }
        } catch (Exception $ex) {
            $errors++;
        }
        echo sprintf("[%s/%d] assertions: %d, failures: %d, errors: %d\n", $rclass->getName(), $tests, $test->assertions(), $failures, $errors);
    }
}
class FooTest extends UnitTest
{
    public function test_one()
    {
        $this->assert(false);
        $this->assert(true);
    }
    public function test_two()
    {
        $this->assert(true);
        $this->assert(true);
    }
}
TestRunner::run(new FooTest());
Пример #10
0
        }
    }
    private function validateArgv()
    {
        try {
            $argvLen = count($this->argv);
            foreach (range(1, $argvLen - 1) as $argvIndex) {
                if (preg_match('/\\.php$/', $this->argv[$argvIndex])) {
                    $this->testFile = $this->argv[$argvIndex];
                }
            }
            if ($this->testFile == null) {
                throw new \Exception('Missing argument: test file');
            }
            // if($argvLen > 2) {
            // 	throw new \Exception('Too many arguments');
            // }
        } catch (\Exception $e) {
            $this->fail($e->getMessage());
        }
    }
}
// $stop = getopt('', ['stop-on-fail:']);
// var_dump($stop);
// die();
// var_dump($argv);
// //var_dump($argc);
// die();
$testRunner = new TestRunner($argv);
$testRunner->run();
Пример #11
0
function define_test_suite($filename)
{
    // using the naming convention that the file name is "TestXXXX.php"
    // and the class that is the unit test class is "UnitTestXXXX"
    if (defined("BEING_INCLUDED")) {
        // we're being included, that implies that a $suite global exists
        global $suite;
        $suite->addTest(new TestSuite(_filename_to_classname($filename)));
    } else {
        // doing a single test, no global suite
        global $old_error_handler;
        $suite = new TestSuite(_filename_to_classname($filename));
        $testRunner = new TestRunner();
        $testRunner->run($suite);
        mkdb_check_did_db_fail_calls();
        global $start_time;
        $time = getmicrotime() - $start_time;
        print "Completed test in {$time} seconds\n";
    }
}
Пример #12
0
    </head>
    <body>
    	<h1>Test results</h1>
    	<?	using('lepton.utils.tests'); ?>
    	<?	using('tests.*'); ?>
    	<?	using('app.tests.*'); ?>
    	<?	
    		class HtmlReporter extends TestReporter {
    			function beginGroup($title) {
    				printf('<h2>%s</h2>',$title);
    				printf('<table><tr>');
    				foreach(array(
    					'Test' => 50,
    					'Text' => 300,
    					'Status' => 90
    				) as $title=>$width) printf('<th width="%d">%s</th>', $width, $title);
    				printf('</tr>');
    			}
    			function addItem($index,$text,$status) {
    				printf('<tr><td>%s</td><td>%s</td><td>%s</td></tr>', $index, $text, $status);
    			}
    			function endGroup() {
    				printf('</table>');
    			}
    		}
    		TestRunner::run(new HtmlReporter());
    	?>
        <p>If you can read this, Lepton-ng is working!</p>
    </body>
</html>
Пример #13
0
function init($folder)
{
    $runner = new TestRunner($folder);
    $runner->run();
}
Пример #14
0
 /**
  * Runs the test case from $runnerArgs
  *
  * @param array $runnerArgs list of arguments as obtained from parseArgs()
  * @param array $options list of options as constructed by runnerOptions()
  * @return void
  */
 protected function run($runnerArgs, $options = array())
 {
     require_once CAKE . 'tests' . DS . 'lib' . DS . 'test_runner.php';
     restore_error_handler();
     restore_error_handler();
     $testCli = new TestRunner($runnerArgs);
     $testCli->run($options);
 }