当前位置: 首页>>代码示例>>PHP>>正文


PHP PHPUnit_Framework_Test::toString方法代码示例

本文整理汇总了PHP中PHPUnit_Framework_Test::toString方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Framework_Test::toString方法的具体用法?PHP PHPUnit_Framework_Test::toString怎么用?PHP PHPUnit_Framework_Test::toString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PHPUnit_Framework_Test的用法示例。


在下文中一共展示了PHPUnit_Framework_Test::toString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: endTest

 public function endTest(\PHPUnit_Framework_Test $test, $time)
 {
     if ($test instanceof \Codeception\TestCase\Cept) {
         $this->currentTestCase->setAttribute('name', $test->toString());
     }
     return parent::endTest($test, $time);
 }
开发者ID:lenninsanchez,项目名称:donadores,代码行数:7,代码来源:JUnit.php

示例2: startTest

 public function startTest(PHPUnit_Framework_Test $test)
 {
     if ($this->_verbose) {
         echo date('Y-m-d H:i:s') . ': starting ' . $test->toString() . "\n\n";
     }
     if ($this->_getProgressBar()) {
         //erstellt sie beim ersten aufruf, nicht im kostruktor machen da sonst zu früh was rausgeschrieben wird
         $this->writeProgress('.');
     }
     return parent::startTest($test);
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:11,代码来源:ProgressResultPrinter.php

示例3: __construct

 /**
  * Constructs a TestFailure with the given test and exception.
  *
  * @param PHPUnit_Framework_Test $failedTest
  * @param Exception $thrownException
  */
 public function __construct(PHPUnit_Framework_Test $failedTest, Exception $thrownException)
 {
     if ($failedTest instanceof PHPUnit_Framework_SelfDescribing) {
         $this->testName = $failedTest->toString();
     } else {
         $this->testName = get_class($failedTest);
     }
     if (!$failedTest instanceof PHPUnit_Framework_TestCase || !$failedTest->isInIsolation()) {
         $this->failedTest = $failedTest;
     }
     $this->thrownException = $thrownException;
 }
开发者ID:scrobot,项目名称:Lumen,代码行数:18,代码来源:TestFailure.php

示例4: endTest

 /**
  * A test ended.
  *
  * @param  \PHPUnit_Framework_Test $test
  * @param  float $time
  */
 public function endTest(\PHPUnit_Framework_Test $test, $time)
 {
     $steps = [];
     $success = $this->testStatus == \PHPUnit_Runner_BaseTestRunner::STATUS_PASSED;
     if ($success) {
         $this->successful++;
     }
     if ($test instanceof ScenarioDriven) {
         $steps = $test->getScenario()->getSteps();
     }
     $this->onTest($test->toString(), $success, $steps, $time);
 }
开发者ID:foxman209,项目名称:Codeception,代码行数:18,代码来源:ResultPrinter.php

示例5: getTestName

 /**
  * @param \PHPUnit_Framework_Test $test
  * @return string
  */
 protected function getTestName(\PHPUnit_Framework_Test $test)
 {
     if ($test instanceof \PHPUnit_Framework_TestCase) {
         $name = $test->getName();
     } elseif ($test instanceof \PHPUnit_Framework_TestSuite) {
         $name = $test->getName();
     } elseif ($test instanceof \PHPUnit_Framework_SelfDescribing) {
         $name = $test->toString();
     } else {
         $name = get_class($test);
     }
     return $name;
 }
开发者ID:munkie,项目名称:phpunit-teamcity-testlistener,代码行数:17,代码来源:TestListener.php

示例6: endTest

 /**
  * A test ended.
  *
  * @param  \PHPUnit_Framework_Test $test
  * @param  float                  $time
  */
 public function endTest(\PHPUnit_Framework_Test $test, $time)
 {
     $steps = array();
     if ($this->testStatus == \PHPUnit_Runner_BaseTestRunner::STATUS_PASSED) {
         $this->successful++;
         $success = TRUE;
         if ($test instanceof \Codeception\TestCase) {
             $steps = $test->getScenario()->getSteps();
         }
     } else {
         $success = FALSE;
         if ($test instanceof \Codeception\TestCase) {
             $steps = $test->getTrace();
         }
     }
     $this->onTest($test->toString(), $success, $steps, $time);
 }
开发者ID:lenninsanchez,项目名称:donadores,代码行数:23,代码来源:ResultPrinter.php

示例7: describe

 /**
  * @param  PHPUnit_Framework_Test $test
  * @param  bool                   $asString
  * @return mixed
  */
 public static function describe(PHPUnit_Framework_Test $test, $asString = true)
 {
     if ($asString) {
         if ($test instanceof PHPUnit_Framework_SelfDescribing) {
             return $test->toString();
         } else {
             return get_class($test);
         }
     } else {
         if ($test instanceof PHPUnit_Framework_TestCase) {
             return array(get_class($test), $test->getName());
         } elseif ($test instanceof PHPUnit_Framework_SelfDescribing) {
             return array('', $test->toString());
         } else {
             return array('', get_class($test));
         }
     }
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:23,代码来源:Test.php

示例8: startTest

 public function startTest(PHPUnit_Framework_Test $test)
 {
     $this->current['name'] = $test->getName(FALSE);
     $this->current['description'] = $test->toString();
     $this->current['result'] = 'passed';
 }
开发者ID:laiello,项目名称:ko3,代码行数:6,代码来源:runner.php

示例9: doAddFault

 /**
  * Method which generalizes addError() and addFailure()
  *
  * @param PHPUnit_Framework_Test $test
  * @param Exception              $e
  * @param float                  $time
  * @param string                 $type
  */
 private function doAddFault(PHPUnit_Framework_Test $test, Exception $e, $time, $type)
 {
     if ($this->currentTestCase === null) {
         return;
     }
     if ($test instanceof PHPUnit_Framework_SelfDescribing) {
         $buffer = $test->toString() . "\n";
     } else {
         $buffer = '';
     }
     $buffer .= PHPUnit_Framework_TestFailure::exceptionToString($e) . "\n" . PHPUnit_Util_Filter::getFilteredStacktrace($e);
     $fault = $this->document->createElement($type, PHPUnit_Util_XML::prepareString($buffer));
     $fault->setAttribute('type', get_class($e));
     $this->currentTestCase->appendChild($fault);
 }
开发者ID:ronaldbao,项目名称:phpunit,代码行数:23,代码来源:JUnit.php

示例10: addFailure

 /**
  * A failure occurred.
  *
  * @param PHPUnit_Framework_Test                 $test
  * @param PHPUnit_Framework_AssertionFailedError $e
  * @param float                                  $time
  */
 public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time)
 {
     if ($this->currentTestCase !== null) {
         if (!$test instanceof PHPUnit_Framework_Warning) {
             if ($test instanceof PHPUnit_Framework_SelfDescribing) {
                 $buffer = $test->toString() . "\n";
             } else {
                 $buffer = '';
             }
             $buffer .= PHPUnit_Framework_TestFailure::exceptionToString($e) . "\n" . PHPUnit_Util_Filter::getFilteredStacktrace($e);
             $failure = $this->document->createElement('failure', PHPUnit_Util_XML::prepareString($buffer));
             $failure->setAttribute('type', get_class($e));
             $this->currentTestCase->appendChild($failure);
             $this->testSuiteFailures[$this->testSuiteLevel]++;
         }
     }
 }
开发者ID:ppwalks33,项目名称:cleansure,代码行数:24,代码来源:JUnit.php

示例11: addFailure

 /**
  * A failure occurred.
  *
  * @param PHPUnit_Framework_Test                 $test
  * @param PHPUnit_Framework_AssertionFailedError $e
  * @param float                                  $time
  */
 public function addFailure(\PHPUnit_Framework_Test $test, \PHPUnit_Framework_AssertionFailedError $e, $time)
 {
     $this->failures[$test->toString()] = $e->getMessage();
     parent::addFailure($test, $e, $time);
 }
开发者ID:hitechdk,项目名称:Codeception,代码行数:12,代码来源:HTML.php

示例12: startTest

 public function startTest(PHPUnit_Framework_Test $test)
 {
     $this->currentTest = $test;
     if (YTestOptions::$progress) {
         YTestLogger::say("Test '" . $test->toString() . "' started.\n");
     }
 }
开发者ID:rsaugier,项目名称:ytest,代码行数:7,代码来源:y_test_runner.php

示例13: addFailureOrError

 /**
  * @param PHPUnit_Framework_Test $test
  * @param Exception              $e
  * @param float                  $time
  * @param string                 $failureOrError
  */
 protected function addFailureOrError(PHPUnit_Framework_Test $test, Exception $e, $time, $failureOrError)
 {
     if ($test instanceof PHPUnit_Framework_SelfDescribing) {
         $message = $test->toString() . "\n\n";
     } else {
         $message = '';
     }
     $message .= PHPUnit_Framework_TestFailure::exceptionToString($e) . "\n";
     $this->writeFailureOrError($message, $e, $failureOrError);
 }
开发者ID:kumatch,项目名称:stagehand-testrunner,代码行数:16,代码来源:JUnitXMLPrinter.php

示例14: getTestException

 /**
  * Trys to get the original exception thrown by the test on failure/error 
  * to enable us to give a bit more detail about the failure/error
  * 
  * @access private
  * @param obj PHPUnit_Framework_Test, current test that is being run
  * @param obj PHPUnit_Framework_AssertationFailedError, PHPUnit error
  * @return array
  */
 private function getTestException(PHPUnit_Framework_Test $test, Exception $e)
 {
     // get the name of the testFile from the test
     $testName = preg_replace('/(.*)\\((.*[^)])\\)/', '\\2', $test->toString());
     $trace = $e->getTrace();
     // loop through the exception trace to find the original exception
     for ($i = 0; $i < count($trace); $i++) {
         if (array_key_exists('file', $trace[$i])) {
             if (stristr($trace[$i]['file'], $testName . '.php') != false) {
                 return $trace[$i];
             }
         }
         if (array_key_exists('file:protected', $trace[$i])) {
             if (stristr($trace[$i]['file:protected'], $testName . '.php') != false) {
                 return $trace[$i];
             }
         }
     }
 }
开发者ID:prostart,项目名称:cobblestonepath,代码行数:28,代码来源:SapphireTestReporter.php

示例15: toString

 /**
  * Returns a short description of the failure.
  *
  * @return string
  */
 public function toString()
 {
     return sprintf('%s: %s', $this->failedTest->toString(), $this->thrownException->getMessage());
 }
开发者ID:jeanCarloMachado,项目名称:challenges,代码行数:9,代码来源:TestFailure.php


注:本文中的PHPUnit_Framework_Test::toString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。