本文整理汇总了PHP中PHPUnit_Framework_TestCase::runTest方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Framework_TestCase::runTest方法的具体用法?PHP PHPUnit_Framework_TestCase::runTest怎么用?PHP PHPUnit_Framework_TestCase::runTest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPUnit_Framework_TestCase
的用法示例。
在下文中一共展示了PHPUnit_Framework_TestCase::runTest方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: runTest
/**
* {@inheritdoc}
* @see PHPUnit_Framework_TestCase::runTest()
*/
protected function runTest()
{
if (isset($this->getAnnotations()['method']['functional']) && $this->isSkipFunctionalTests()) {
$this->markTestSkipped();
}
return parent::runTest();
}
示例2: runTest
/**
* Vynucuje existenci @covers anotace při generování code coverage.
*
* @author Jan Tvrdík
* @return mixed
*/
protected function runTest()
{
$annotations = $this->getAnnotations();
if (!isset($annotations['class']['covers']) && !isset($annotations['method']['covers']) && !isset($annotations['class']['coversNothing']) && !isset($annotations['method']['coversNothing'])) {
$this->markTestIncomplete('Missing mandatory @covers or @coversNothing annotation');
}
return parent::runTest();
}
示例3: runTest
protected function runTest()
{
if (\PhpSpock\Adapter\PhpUnitAdapter::isSpecification($this)) {
return \PhpSpock\Adapter\PhpUnitAdapter::runTest($this);
} else {
return parent::runTest();
}
}
示例4: runTest
protected function runTest()
{
if ($this->isExternal() && !$this->allowExternal()) {
$this->markTestSkipped('Test requires external reference');
return false;
}
return parent::runTest();
}
示例5: runTest
function runTest()
{
$startTime = microtime(true);
parent::runTest();
$endTime = microtime(true);
if (0 != $this->maxRunningTime && $endTime - $startTime > $this->maxRunningTime) {
$this->fail('expected running time: <= ' . $this->maxRunningTime . ' but was ' . ($endTime - $startTime));
}
}
示例6: runTest
/**
* @access protected
*/
protected function runTest()
{
PHPUnit_Util_Timer::start();
parent::runTest();
$time = PHPUnit_Util_Timer::stop();
if ($this->maxRunningTime != 0 && $time > $this->maxRunningTime) {
$this->fail(sprintf('expected running time: <= %s but was: %s', $this->maxRunningTime, $time));
}
}
示例7: runTest
/**
* @access public
*/
protected function runTest()
{
$timer = new Benchmark_Timer();
$timer->start();
parent::runTest();
$timer->stop();
if ($this->fMaxRunningTime != 0 && $timer->timeElapsed() > $this->fMaxRunningTime) {
PHPUnit_Framework_Assert::fail(sprintf('expected running time: <= %s but was: %s', $this->fMaxRunningTime, $timer->timeElapsed()));
}
}
示例8: runTest
/**
* @access public
*/
protected function runTest()
{
try {
parent::runTest();
} catch (Exception $e) {
if (is_a($e, $this->fExpected)) {
return;
} else {
throw $e;
}
}
$this->fail('Expected exception ' . $this->fExpected);
}
示例9: runTest
/**
* Wraps the default #runTest() method to provide an exception hook.
*
* @return mixed|null
*
* @throws \Exception
*/
protected function runTest()
{
try {
$result = parent::runTest();
} catch (\Exception $ex) {
$this->exceptionHook($ex);
return;
}
// @codeCoverageIgnoreStart
if ($this->expectException) {
$this->fail('An exception was expected but none has been thrown.');
}
// @codeCoverageIgnoreEnd
return $result;
}
示例10: runTest
protected function runTest()
{
$result = parent::runTest();
if ($this->logStream !== NULL) {
$this->addToAssertionCount(1);
fseek($this->logStream, 0);
$actualLogs = stream_get_contents($this->logStream);
fclose($this->logStream);
$actualLogs = array_map('rtrim', explode("\n", $actualLogs));
$actualLogs = array_values(array_filter($actualLogs, 'strlen'));
if ($this->expectedLogs !== NULL) {
if (count($this->expectedLogs)) {
$this->assertEquals($this->expectedLogs, $actualLogs);
} else {
if (count($actualLogs)) {
$this->fail("No logs expected, but we received:\n" . var_export($actualLogs, TRUE));
}
}
}
}
return $result;
}
示例11: runTest
/**
* @access protected
*/
protected function runTest()
{
$this->start();
parent::runTest();
try {
$this->stop();
} catch (RuntimeException $e) {
}
}
示例12: runTest
/**
* @throws RuntimeException
*/
protected function runTest()
{
$this->prepareSession();
$thrownException = NULL;
if ($this->collectCodeCoverageInformation) {
$this->url($this->coverageScriptUrl);
// phpunit_coverage.php won't do anything if the cookie isn't set, which is exactly what we want
$this->session->cookie()->add('PHPUNIT_SELENIUM_TEST_ID', $this->testId)->set();
}
try {
$this->setUpPage();
$result = parent::runTest();
if (!empty($this->verificationErrors)) {
$this->fail(implode("\n", $this->verificationErrors));
}
} catch (Exception $e) {
$thrownException = $e;
}
if ($this->collectCodeCoverageInformation) {
$this->session->cookie()->remove('PHPUNIT_SELENIUM_TEST_ID');
}
if (NULL !== $thrownException) {
throw $thrownException;
}
return $result;
}
示例13: runTest
/**
* @throws RuntimeException
*/
protected function runTest()
{
if (!$this->serverRunning) {
$this->markTestSkipped(
sprintf(
'Could not connect to Selenium RC on %s:%d.',
$this->drivers[0]->getHost(),
$this->drivers[0]->getPort()
)
);
}
$this->start();
if (!is_file($this->getName(FALSE))) {
parent::runTest();
} else {
$this->runSelenese($this->getName(FALSE));
}
if (!empty($this->verificationErrors)) {
$this->fail(implode("\n", $this->verificationErrors));
}
try {
$this->stop();
}
catch (RuntimeException $e) {
}
}
示例14: runTest
/**
* @return mixed
* @throws RuntimeException
*/
protected function runTest()
{
ob_start();
$this->obActive = TRUE;
try {
$testResult = parent::runTest();
} catch (Exception $e) {
ob_end_clean();
$this->obActive = FALSE;
throw $e;
}
if ($this->outputCallback === FALSE) {
$this->output = ob_get_contents();
} else {
$this->output = call_user_func_array($this->outputCallback, array(ob_get_contents()));
}
ob_end_clean();
$this->obActive = FALSE;
if ($this->expectedRegex !== NULL) {
$this->assertRegExp($this->expectedRegex, $this->output);
$this->expectedRegex = NULL;
} else {
if ($this->expectedString !== NULL) {
$this->assertEquals($this->expectedString, $this->output);
$this->expectedString = NULL;
}
}
return $testResult;
}
示例15: runTest
/**
* @throws RuntimeException
*/
protected function runTest()
{
$this->start();
if (!is_file($this->getName(FALSE))) {
parent::runTest();
} else {
$this->runSelenese($this->getName(FALSE));
}
if (!empty($this->verificationErrors)) {
$this->fail(implode("\n", $this->verificationErrors));
}
try {
$this->stop();
} catch (RuntimeException $e) {
}
}