本文整理汇总了PHP中SimpleTestCase类的典型用法代码示例。如果您正苦于以下问题:PHP SimpleTestCase类的具体用法?PHP SimpleTestCase怎么用?PHP SimpleTestCase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SimpleTestCase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: countTestsInTestCase
/**
* @param SimpleTestCase $testCase
* @return integer
* @since Method available since Release 2.11.1
*/
public function countTestsInTestCase(SimpleTestCase $testCase)
{
$tests = $testCase->getTests();
$testCount = 0;
if ($this->config->testsOnlySpecified()) {
if ($this->config->testsOnlySpecifiedMethods) {
foreach ($tests as $method) {
if ($this->config->inMethodsToBeTested(get_class($testCase), $method)) {
++$testCount;
}
}
} elseif ($this->config->testsOnlySpecifiedClasses) {
if ($this->config->inClassesToBeTested(get_class($testCase))) {
$testCount = count($tests);
}
}
} else {
$testCount = count($tests);
}
return $testCount;
}
示例2: atTestEnd
/**
* Receives event from unit test that the current
* test method has finished. Totals up the call
* counts and triggers a test assertion if a test
* is present for expected call counts.
* @param string $test_method Current method name.
* @param SimpleTestCase $test Test to send message to.
* @access public
*/
function atTestEnd($test_method, &$test)
{
foreach ($this->_expected_counts as $method => $expectation) {
$test->assert($expectation, $this->getCallCount($method));
}
foreach ($this->_max_counts as $method => $expectation) {
if ($expectation->test($this->getCallCount($method))) {
$test->assert($expectation, $this->getCallCount($method));
}
}
}
示例3: isExpected
/**
* Compares the expected exception with any
* in the queue. Issues a pass or fail and
* returns the state of the test.
* @param SimpleTestCase $test Test case to send messages to.
* @param Exception $exception Exception to compare.
* @return boolean False on no match.
*/
function isExpected($test, $exception)
{
if ($this->expected) {
return $test->assert($this->expected, $exception, $this->message);
}
return false;
}
示例4: runTestInvokesAfterClass
public function runTestInvokesAfterClass()
{
SimpleTestCase::$dispose = 0;
$this->suite->runTest(new SimpleTestCase('succeeds'));
$this->assertEquals(1, SimpleTestCase::$dispose);
}
示例5: invoke
/**
* Invokes a single test method on the test case.
* This call back allows the reporter to decide if
* it actually wants to run the test.
* @param SimpleTestCase $test_case Test case to run test on.
* @param string $method Name of test method.
* @access public
*/
function invoke(&$test_case, $method)
{
if (!$this->_is_dry_run) {
$test_case->invoke($method);
}
}
示例6: runCase
/**
* Run a test case (usually a group/suite) with the inferred reporter.
*
* @param SimpleTestCase $test_case
* @return void This method does not return a value.
* Use hasFailures() to query status after running this.
* @todo Stop creating an individual reporter for each run, in case a client
* calls this method multiple times.
*/
function runCase($test_case)
{
$reporter = $this->createReporter();
$test_case->run($reporter);
$all_tests_passed = $reporter->getStatus();
if (!$all_tests_passed) {
$this->_failed_runs++;
}
}
示例7: isExpected
/**
* Compares the expected exception with any
* in the queue. Issues a pass or fail and
* returns the state of the test.
* @param SimpleTestCase $test Test case to send messages to.
* @param Exception $exception Exception to compare.
* @return boolean False on no match.
*/
function isExpected($test, $exception)
{
if ($this->expected) {
return $test->assert($this->expected, $exception, $this->message);
}
foreach ($this->ignored as $ignored) {
if ($ignored->test($exception)) {
return true;
}
}
return false;
}
示例8: getTestsInTestCase
/**
* @param SimpleTestCase $testCase
* @return integer
* @since Method available since Release 2.14.0
*/
protected function getTestsInTestCase(SimpleTestCase $testCase)
{
return $testCase->getTests();
}
示例9:
/**
* Creates an empty test case. Should be subclassed
* with test methods for a functional test case.
* @param string $label Name of test case. Will use
* the class name if none specified.
* @access public
*/
function __construct($label = false)
{
parent::__construct($label);
$this->current_shell = $this->createShell();
$this->last_status = false;
$this->last_command = '';
}
示例10:
/**
* Creates an empty test case. Should be subclassed
* with test methods for a functional test case.
* @param string $label Name of test case. Will use
* the class name if none specified.
* @access public
*/
function __construct($label = false)
{
if (!$label) {
$label = get_class($this);
}
parent::__construct($label);
}
示例11: error
/**
* Sends an error which we interpret as a fail
* with a different message for compatibility.
* @param $message Message to display.
* @public
*/
function error($message)
{
parent::fail("Error triggered [{$message}]");
}
示例12: doLog
public function doLog($message, $severity)
{
$this->test->dump(NULL, $message);
}
示例13: assertType
/**
* Tests the type of a value.
* @param $value Value to take type of.
* @param $type Hoped for type.
* @param $message Message to display.
* @public
*/
function assertType($value, $type, $message = "%s")
{
parent::assertTrue(gettype($value) == strtolower($type), $message);
}
示例14: tearDown
protected function tearDown()
{
parent::tearDown();
}
示例15: WebTestCaseInvoker
/**
* Sets the invoker to one that restarts the browser on
* each request.
* @return SimpleInvoker Invoker for each method.
* @access public
*/
function &createInvoker()
{
return new WebTestCaseInvoker(parent::createInvoker());
}