本文整理汇总了PHP中SimpleTest类的典型用法代码示例。如果您正苦于以下问题:PHP SimpleTest类的具体用法?PHP SimpleTest怎么用?PHP SimpleTest使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SimpleTest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: warmup
/**
* Runs an empty test to determine the benchmark overhead and run each test once
*/
private function warmup()
{
$warmup = new SimpleTest('warmup', function () {
});
$warmup->run();
foreach ($this->tests as $test) {
$test->run();
}
$this->base_results = $warmup->run($this->n);
}
示例2: tests_have_run
/**
* Checks the current test context to see if a test has
* ever been run.
* @return boolean True if tests have run.
*/
function tests_have_run()
{
if ($context = SimpleTest::getContext()) {
return (bool) $context->getTest();
}
return false;
}
示例3: run
function run($reporter)
{
$context = SimpleTest::getContext();
$context->setTest($this);
$context->setReporter($reporter);
$this->reporter = $reporter;
$this->reporter->paintCaseStart($this->getLabel());
if ($this->needPDO) {
$this->reporter->makeDry(!$this->assertTrue(class_exists('PDO', false), 'PDO does not exists ! You should install PDO because tests need it.'));
}
$this->setUpRun();
foreach ($this->getTests() as $method) {
if ($this->reporter->shouldInvoke($this->getLabel(), $method)) {
$this->skip();
if ($this->shouldSkip()) {
break;
}
$invoker = $this->reporter->createInvoker($this->createInvoker());
$invoker->before($method);
$invoker->invoke($method);
$invoker->after($method);
}
}
$this->tearDownRun();
$this->reporter->paintCaseEnd($this->getLabel());
unset($this->reporter);
return $reporter->getStatus();
}
示例4: AllTests
function AllTests()
{
$this->TestSuite('FlatDB tests - Simple test' . SimpleTest::getVersion());
$this->addFile(dirname(__FILE__) . '/test_rows.php');
$this->addFile(dirname(__FILE__) . '/test_columns.php');
$this->addFile(dirname(__FILE__) . '/test_read_add.php');
}
示例5: setPreference
public static function setPreference()
{
if (TextReporter::inCli()) {
SimpleTest::prefer(new Xml_Chris());
} else {
SimpleTest::prefer(new Html_Chris());
}
}
示例6: shouldInvoke
/**
* @param string $testCase
* @param string $method
* @return boolean
*/
public function shouldInvoke($testCase, $method)
{
$test = SimpleTest::getContext()->getTest();
if ($test instanceof CakeTestCase && in_array(strtolower($method), $test->methods)) {
return true;
}
return parent::shouldInvoke($testCase, $method);
}
示例7: AllTests
function AllTests()
{
$this->GroupTest('All tests for SimpleTest ' . SimpleTest::getVersion());
$this->addTestCase(new UnitTests());
$this->addTestFile(dirname(__FILE__) . '/shell_test.php');
$this->addTestFile(dirname(__FILE__) . '/live_test.php');
$this->addTestFile(dirname(__FILE__) . '/acceptance_test.php');
}
示例8:
/**
* Wires up the error queue for a single test.
*
* @return SimpleErrorQueue Queue connected to the test.
*/
public function &_createErrorQueue()
{
$context =& SimpleTest::getContext();
$test =& $this->getTestCase();
$queue =& $context->get('SimpleErrorQueue');
$queue->setTestCase($test);
return $queue;
}
示例9: createErrorQueue
/**
* Wires up the error queue for a single test.
* @return SimpleErrorQueue Queue connected to the test.
* @access private
*/
protected function createErrorQueue()
{
$context = SimpleTest::getContext();
$test = $this->getTestCase();
$queue = $context->get('SimpleErrorQueue');
$queue->setTestCase($test);
return $queue;
}
示例10: __construct
function __construct()
{
parent::__construct('All tests for SimpleTest ' . SimpleTest::getVersion());
$this->addFile(dirname(__FILE__) . '/unit_tests.php');
$this->addFile(dirname(__FILE__) . '/shell_test.php');
$this->addFile(dirname(__FILE__) . '/live_test.php');
$this->addFile(dirname(__FILE__) . '/acceptance_test.php');
}
示例11:
function &_getRegistry()
{
static $registry = false;
if (!$registry) {
$registry = SimpleTest::_getDefaults();
}
return $registry;
}
示例12: shouldPaintMethod
/**
* @param string $testName
*/
protected function shouldPaintMethod($testName)
{
$testCase = SimpleTest::getContext()->getTest();
if (!$testCase instanceof CakeTestCase) {
return true;
}
return !in_array(strtolower($testName), $testCase->methods);
}
示例13: AllTests
public function AllTests()
{
$this->TestSuite('All tests for SimpleTest ' . SimpleTest::getVersion());
$this->addFile(dirname(__FILE__) . '/unit_tests.php');
$this->addFile(dirname(__FILE__) . '/shell_test.php');
$this->addFile(dirname(__FILE__) . '/live_test.php');
$this->addFile(dirname(__FILE__) . '/acceptance_test.php');
}
示例14: __construct
/**
* Starts with a fresh browser with no
* cookie or any other state information. The
* exception is that a default proxy will be
* set up if specified in the options.
* @access public
*/
function __construct()
{
$this->user_agent = $this->createUserAgent();
$this->user_agent->useProxy(SimpleTest::getDefaultProxy(), SimpleTest::getDefaultProxyUsername(), SimpleTest::getDefaultProxyPassword());
$this->page = new SimplePage();
$this->history = $this->createHistory();
$this->ignore_frames = false;
$this->maximum_nested_frames = DEFAULT_MAX_NESTED_FRAMES;
}
示例15: ExtensionsTests
public function ExtensionsTests()
{
$this->TestSuite('Extension tests for SimpleTest ' . SimpleTest::getVersion());
$nodes = new RecursiveDirectoryIterator(dirname(__FILE__) . '/../extensions/');
foreach (new RecursiveIteratorIterator($nodes) as $node) {
if (preg_match('/test\\.php$/', $node->getFilename())) {
$this->addFile($node->getPathname());
}
}
}