本文整理汇总了PHP中PHPUnit_Framework_Test::getStatus方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Framework_Test::getStatus方法的具体用法?PHP PHPUnit_Framework_Test::getStatus怎么用?PHP PHPUnit_Framework_Test::getStatus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPUnit_Framework_Test
的用法示例。
在下文中一共展示了PHPUnit_Framework_Test::getStatus方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: endTest
/**
* endTest is called after each test and checks if \Mockery::close() has
* been called, and will let the test fail if it hasn't.
*
* @param PHPUnit_Framework_Test $test
* @param float $time
*/
public function endTest(\PHPUnit_Framework_Test $test, $time)
{
if (!$test instanceof \PHPUnit_Framework_TestCase) {
// We need the getTestResultObject and getStatus methods which are
// not part of the interface.
return;
}
if ($test->getStatus() !== \PHPUnit_Runner_BaseTestRunner::STATUS_PASSED) {
// If the test didn't pass there is no guarantee that
// verifyMockObjects and assertPostConditions have been called.
// And even if it did, the point here is to prevent false
// negatives, not to make failing tests fail for more reasons.
return;
}
try {
// The self() call is used as a sentinel. Anything that throws if
// the container is closed already will do.
\Mockery::self();
} catch (\LogicException $_) {
return;
}
$e = new \PHPUnit_Framework_ExpectationFailedException(sprintf("Mockery's expectations have not been verified. Make sure that \\Mockery::close() is called at the end of the test. Consider using %s\\MockeryPHPUnitIntegration or extending %s\\MockeryTestCase.", __NAMESPACE__, __NAMESPACE__));
$result = $test->getTestResultObject();
$result->addFailure($test, $e, $time);
}
示例2: endTest
public function endTest(Test $test, $time)
{
$this->currentTest = null;
if ($test instanceof TestCase && $test->getStatus() === TestRunner::STATUS_PASSED) {
$this->storage->record($this->run, $test, $time, StorageInterface::STATUS_PASSED);
}
}
示例3: endTest
public function endTest(PHPUnit_Framework_Test $test, $time)
{
$this->tests++;
switch ($test->getStatus()) {
case PHPUnit_Runner_BaseTestRunner::STATUS_PASSED:
echo '.';
break;
case PHPUnit_Runner_BaseTestRunner::STATUS_FAILURE:
echo 'F';
break;
case PHPUnit_Runner_BaseTestRunner::STATUS_ERROR:
echo 'E';
break;
case PHPUnit_Runner_BaseTestRunner::STATUS_INCOMPLETE:
echo 'I';
break;
case PHPUnit_Runner_BaseTestRunner::STATUS_SKIPPED:
echo 'S';
break;
}
if ($this->tests % 60 == 0) {
echo "\n";
}
$this->totalTime += $time;
}
示例4: endTest
/**
* A test ended.
*
* @param PHPUnit_Framework_Test $test
* @param float $time
*/
public function endTest(PHPUnit_Framework_Test $test, $time)
{
if (!$test instanceof PHPUnit_Framework_Warning) {
if ($test->getStatus() == PHPUnit_Runner_BaseTestRunner::STATUS_PASSED) {
$ifStatus = array('assigned', 'new', 'reopened');
$newStatus = 'closed';
$message = 'Automatically closed by PHPUnit (test passed).';
$resolution = 'fixed';
$cumulative = TRUE;
} else {
if ($test->getStatus() == PHPUnit_Runner_BaseTestRunner::STATUS_FAILURE) {
$ifStatus = array('closed');
$newStatus = 'reopened';
$message = 'Automatically reopened by PHPUnit (test failed).';
$resolution = '';
$cumulative = FALSE;
} else {
return;
}
}
$name = $test->getName();
$tickets = PHPUnit_Util_Test::getTickets(get_class($test), $name);
foreach ($tickets as $ticket) {
// Remove this test from the totals (if it passed).
if ($test->getStatus() == PHPUnit_Runner_BaseTestRunner::STATUS_PASSED) {
unset($this->ticketCounts[$ticket][$name]);
}
// Only close tickets if ALL referenced cases pass
// but reopen tickets if a single test fails.
if ($cumulative) {
// Determine number of to-pass tests:
if (count($this->ticketCounts[$ticket]) > 0) {
// There exist remaining test cases with this reference.
$adjustTicket = FALSE;
} else {
// No remaining tickets, go ahead and adjust.
$adjustTicket = TRUE;
}
} else {
$adjustTicket = TRUE;
}
if ($adjustTicket && in_array($ticketInfo[3]['status'], $ifStatus)) {
$this->updateTicket($ticket, $newStatus, $message, $resolution);
}
}
}
}
示例5: endTest
/**
* A test ended.
*
* @param \PHPUnit_Framework_Test $test
* @param float $time
*
* @return void
*/
public function endTest(\PHPUnit_Framework_Test $test, $time)
{
if ($test instanceof \PHPUnit_Framework_TestCase) {
$assertionCount = $test->getNumAssertions();
$this->numAssertions += $assertionCount;
if ($test->getStatus() == \PHPUnit_Runner_BaseTestRunner::STATUS_FAILURE) {
$status = 'failures';
} elseif ($test->getStatus() == \PHPUnit_Runner_BaseTestRunner::STATUS_ERROR) {
$status = 'errors';
} elseif ($test->getStatus() == \PHPUnit_Runner_BaseTestRunner::STATUS_INCOMPLETE) {
$status = 'incompletes';
} elseif ($test->getStatus() == \PHPUnit_Runner_BaseTestRunner::STATUS_SKIPPED) {
$status = 'skips';
} elseif ($test->getStatus() == \PHPUnit_Runner_BaseTestRunner::STATUS_RISKY) {
$status = 'risky';
} else {
$status = 'tests';
}
if (count($this->suites) - $this->endedSuites > 1) {
$suiteName = end($this->suites);
$this->stats[$suiteName][$status]++;
$this->stats[$suiteName]['assertions'] += $assertionCount;
}
// updates also top test suite
$suiteName = reset($this->suites);
$this->stats[$suiteName][$status]++;
$this->stats[$suiteName]['assertions'] += $assertionCount;
}
if (method_exists($test, 'hasOutput') && $test->hasOutput()) {
$output = $test->getActualOutput();
} else {
$output = '';
}
$testName = $test->getName();
$context = array('testName' => $testName, 'testDescriptionArr' => \PHPUnit_Util_Test::describe($test, false), 'testDescriptionStr' => $test->toString(), 'operation' => __FUNCTION__, 'output' => $output);
if (isset($assertionCount)) {
$context['assertionCount'] = $assertionCount;
}
$this->logger->info(sprintf("Test '%s' ended.", $testName), $context);
}
示例6: endTest
/**
* A test ended.
*
* @param PHPUnit_Framework_Test $test
* @param float $time
*/
public function endTest(\PHPUnit_Framework_Test $test, $time)
{
if (false === $test instanceof $this->testTypeOfInterest) {
return;
}
$assertion = array('@type' => 'earl:Assertion', 'earl:assertedBy' => $this->options['developer-url'], 'earl:mode' => 'earl:automatic', 'earl:test' => $test->getTestId(), 'earl:result' => array('@type' => 'earl:TestResult', 'earl:outcome' => $this->earlStatuses[$test->getStatus()], 'dc:date' => date('c')));
$this->assertions[] = $assertion;
}
示例7: endTest
/**
* A test ended.
*
* @param PHPUnit_Framework_Test $test Test case
* @param float $time Time taken
*
* @return void
*/
public function endTest(PHPUnit_Framework_Test $test, $time)
{
$this->runs[] = array('name' => $test->getName(), 'size' => $test->getSize(), 'status' => $test->getStatus(), 'statusMessage' => $test->getStatusMessage(), 'assertions' => $test->getNumAssertions(), 'result' => $test->getResult(), 'annotations' => $test->getAnnotations(), 'timeTaken' => $time, 'output' => $test->getActualOutput());
}