本文整理汇总了PHP中PHPUnit_Framework_Test::getNumAssertions方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Framework_Test::getNumAssertions方法的具体用法?PHP PHPUnit_Framework_Test::getNumAssertions怎么用?PHP PHPUnit_Framework_Test::getNumAssertions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPUnit_Framework_Test
的用法示例。
在下文中一共展示了PHPUnit_Framework_Test::getNumAssertions方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: endTest
public function endTest(PHPUnit_Framework_Test $test, $time)
{
// copied from parent:endTest()
if ($test instanceof PHPUnit_Framework_TestCase) {
$this->numAssertions += $test->getNumAssertions();
} else {
if ($test instanceof PHPUnit_Extensions_PhptTestCase) {
$this->numAssertions++;
}
}
$this->lastTestFailed = false;
// custom printing code
if (get_class($test) == 'PHPUnit_Framework_TestSuite') {
// this occurs when the test suite setup has thrown an error
$this->out(" SETUP FAIL", 'fg-red', true);
} elseif ($test->hasFailed()) {
$this->out(" FAIL", 'fg-red', true);
} else {
$numAssertions = $test instanceof PHPUnit_Framework_TestCase ? $test->getNumAssertions() : 1;
if ($numAssertions > 0) {
$this->out(' OK (' . $numAssertions . ' assertions)', 'fg-green', true);
} else {
$this->out(' SKIPPED (0 assertions)', 'fg-yellow', true);
}
}
}
示例2: endTest
public function endTest(\PHPUnit_Framework_Test $test, $time)
{
if ($test instanceof \PHPUnit_Framework_TestCase) {
$this->numAssertions += $test->getNumAssertions();
}
$this->lastTestFailed = false;
}
示例3: endTest
public function endTest(\PHPUnit_Framework_Test $test, $time)
{
if ($this->attachCurrentTestCase and $test instanceof Test) {
$numAssertions = $test->getNumAssertions();
$this->testSuiteAssertions[$this->testSuiteLevel] += $numAssertions;
$this->currentTestCase->setAttribute('assertions', $numAssertions);
}
parent::endTest($test, $time);
}
示例4: endTest
public function endTest(PHPUnit_Framework_Test $test, $time)
{
if ($test->hasFailed()) {
printf(" FAIL\n");
} else {
printf(" OK\n");
}
if ($test instanceof PHPUnit_Framework_TestCase) {
$this->numAssertions += $test->getNumAssertions();
} else {
if ($test instanceof PHPUnit_Extensions_PhptTestCase) {
$this->numAssertions++;
}
}
}
示例5: endTest
public function endTest(\PHPUnit_Framework_Test $test, $time)
{
// if ($test instanceof \PHPUnit_Framework_TestCase) {
$this->numAssertions += $test->getNumAssertions();
// }
}
示例6: 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 ($this->attachCurrentTestCase) {
if ($test instanceof PHPUnit_Framework_TestCase) {
$numAssertions = $test->getNumAssertions();
$this->testSuiteAssertions[$this->testSuiteLevel] += $numAssertions;
$this->currentTestCase->setAttribute('assertions', $numAssertions);
}
$this->currentTestCase->setAttribute('time', sprintf('%F', $time));
$this->testSuites[$this->testSuiteLevel]->appendChild($this->currentTestCase);
$this->testSuiteTests[$this->testSuiteLevel]++;
$this->testSuiteTimes[$this->testSuiteLevel] += $time;
}
}
$this->attachCurrentTestCase = TRUE;
$this->currentTestCase = NULL;
}
示例7: endTest
/**
* A test ended.
*
* @param PHPUnit_Framework_Test $test
* @param float $time
*/
public function endTest(PHPUnit_Framework_Test $test, $time)
{
if (!$this->lastTestFailed) {
$this->writeProgress($this->green('.'));
}
if ($test instanceof PHPUnit_Framework_TestCase) {
$this->numAssertions += $test->getNumAssertions();
} else {
if ($test instanceof PHPUnit_Extensions_PhptTestCase) {
$this->numAssertions++;
}
}
$this->lastTestFailed = FALSE;
if ($this->verbose && $test instanceof PHPUnit_Framework_TestCase) {
$this->write($test->getActualOutput());
}
}
示例8: endTest
/**
* A test ended.
*
* @param PHPUnit_Framework_Test $test
* @param float $time
*
* @return void
*/
public function endTest(PHPUnit_Framework_Test $test, $time)
{
$this->assertionCount += $test->getNumAssertions();
}
示例9: endTest
/**
* A test ended.
*
* @param PHPUnit_Framework_Test $test
* @param float $time
*/
public function endTest(PHPUnit_Framework_Test $test, $time)
{
$this->numAssertions += $test->getNumAssertions();
$this->paintPass($test, $time);
}
示例10: endTest
/**
* A test ended.
*
* @param \PHPUnit_Framework_Test $test
* @param float $time
*/
public function endTest(\PHPUnit_Framework_Test $test, $time)
{
if (!$this->lastTestFailed) {
$this->writeTestStatus(self::STATUS_OK);
}
if ($test instanceof \PHPUnit_Framework_TestCase) {
/** @var \PHPUnit_Framework_TestCase $test */
$this->numAssertions += $test->getNumAssertions();
}
$this->lastEvent = self::EVENT_TEST_END;
$this->lastTestFailed = false;
}
示例11: endTest
/**
* @param \PHPUnit_Framework_Test $test
* @param float $time
*/
public function endTest(\PHPUnit_Framework_Test $test, $time)
{
if ($test instanceof \PHPUnit_Framework_TestCase) {
$this->junitXMLWriter->endTestCase($time, $test->getNumAssertions());
} else {
$this->junitXMLWriter->endTestCase($time);
}
$this->testStarted = false;
}
示例12: endTest
/**
* @param PHPUnit_Framework_Test $test
* @param float $time
*/
public function endTest(PHPUnit_Framework_Test $test, $time)
{
if (!$test instanceof PHPUnit_Framework_TestCase) {
$this->xmlWriter->endTestCase($time);
return;
}
$this->xmlWriter->endTestCase($time, $test->getNumAssertions());
}
示例13: endTest
/**
* A test ended.
*
* @param PHPUnit_Framework_Test $test
* @param float $time
*/
public function endTest(PHPUnit_Framework_Test $test, $time)
{
if ($this->attachCurrentTestCase) {
if ($test instanceof PHPUnit_Framework_TestCase) {
$numAssertions = $test->getNumAssertions();
$this->testSuiteAssertions[$this->testSuiteLevel] += $numAssertions;
$this->currentTestCase->setAttribute('assertions', $numAssertions);
}
$this->currentTestCase->setAttribute('time', sprintf('%F', $time));
$this->testSuites[$this->testSuiteLevel]->appendChild($this->currentTestCase);
$this->testSuiteTests[$this->testSuiteLevel]++;
$this->testSuiteTimes[$this->testSuiteLevel] += $time;
if (method_exists($test, 'hasOutput') && $test->hasOutput()) {
$systemOut = $this->document->createElement('system-out');
$systemOut->appendChild($this->document->createTextNode($test->getActualOutput()));
$this->currentTestCase->appendChild($systemOut);
}
}
$this->attachCurrentTestCase = true;
$this->currentTestCase = null;
}
示例14: endTest
/**
* A test ended.
*
* @param PHPUnit_Framework_Test $test
* @param float $time
*/
public function endTest(PHPUnit_Framework_Test $test, $time)
{
if (!$this->lastTestFailed) {
$this->writeProgress('.');
}
if ($test instanceof PHPUnit_Framework_TestCase) {
$this->numAssertions += $test->getNumAssertions();
} elseif ($test instanceof PHPUnit_Extensions_PhptTestCase) {
$this->numAssertions++;
}
$this->lastTestFailed = false;
if ($test instanceof PHPUnit_Framework_TestCase) {
if (!$test->hasExpectationOnOutput()) {
$this->write($test->getActualOutput());
}
}
}
示例15: endTest
/**
* A test ended.
*
* @param PHPUnit_Framework_Test $test
* @param float $time
* @access public
*/
public function endTest(PHPUnit_Framework_Test $test, $time)
{
if (!$this->lastTestFailed) {
$this->writeProgress("[1;32m✓[0m");
}
if ($test instanceof PHPUnit_Framework_TestCase) {
$this->numAssertions += $test->getNumAssertions();
}
$this->lastEvent = self::EVENT_TEST_END;
$this->lastTestFailed = false;
$this->column++;
$this->testsRun++;
$this->suiteTestsRun[count($this->suiteTestsRun) - 1]++;
// Wrap tests, if they exceed the column width
if ($this->column >= 72) {
echo " ↩\n", str_repeat(' ', ($this->column = end($this->indentation)) - 2), '↳ ';
}
}