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


PHP PHPUnit_Framework_TestCase::runBare方法代码示例

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


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

示例1: runBare

 /**
  * Run the test (wrapper around phpunit function)
  */
 public function runBare()
 {
     if (file_exists(__DIR__ . '/../../phpunit_config.php')) {
         require_once __DIR__ . '/../../phpunit_config.php';
     }
     if (!empty($DB)) {
         $DB2 = clone $DB;
     }
     $DB = $this->construct_driver();
     $this->DB = $DB;
     $this->initialize_database();
     try {
         parent::runBare();
     } catch (\Exception $e) {
         $this->clean_database();
         if (!empty($DB2)) {
             $DB = clone $DB2;
         }
         throw $e;
     }
     $this->clean_database();
     if (!empty($DB2)) {
         $DB = clone $DB2;
     }
 }
开发者ID:pdyn,项目名称:database,代码行数:28,代码来源:DbDriverTestAbstract.php

示例2: runBare

 /**
  * Runs the bare test sequence.
  * @return void
  */
 public final function runBare()
 {
     global $DB;
     if (phpunit_util::$lastdbwrites != $DB->perf_get_writes()) {
         // this happens when previous test does not reset, we can not use transactions
         $this->testdbtransaction = null;
     } else {
         if ($DB->get_dbfamily() === 'postgres' or $DB->get_dbfamily() === 'mssql') {
             // database must allow rollback of DDL, so no mysql here
             $this->testdbtransaction = $DB->start_delegated_transaction();
         }
     }
     try {
         parent::runBare();
         // set DB reference in case somebody mocked it in test
         $DB = phpunit_util::get_global_backup('DB');
     } catch (Exception $e) {
         // cleanup after failed expectation
         phpunit_util::reset_all_data();
         throw $e;
     }
     if (!$this->testdbtransaction or $this->testdbtransaction->is_disposed()) {
         $this->testdbtransaction = null;
     }
     if ($this->resetAfterTest === true) {
         if ($this->testdbtransaction) {
             $DB->force_transaction_rollback();
             phpunit_util::reset_all_database_sequences();
             phpunit_util::$lastdbwrites = $DB->perf_get_writes();
             // no db reset necessary
         }
         phpunit_util::reset_all_data();
     } else {
         if ($this->resetAfterTest === false) {
             if ($this->testdbtransaction) {
                 $this->testdbtransaction->allow_commit();
             }
             // keep all data untouched for other tests
         } else {
             // reset but log what changed
             if ($this->testdbtransaction) {
                 try {
                     $this->testdbtransaction->allow_commit();
                 } catch (dml_transaction_exception $e) {
                     phpunit_util::reset_all_data();
                     throw new coding_exception('Invalid transaction state detected in test ' . $this->getName());
                 }
             }
             phpunit_util::reset_all_data(true);
         }
     }
     // make sure test did not forget to close transaction
     if ($DB->is_transaction_started()) {
         phpunit_util::reset_all_data();
         if ($this->getStatus() == PHPUnit_Runner_BaseTestRunner::STATUS_PASSED or $this->getStatus() == PHPUnit_Runner_BaseTestRunner::STATUS_SKIPPED or $this->getStatus() == PHPUnit_Runner_BaseTestRunner::STATUS_INCOMPLETE) {
             throw new coding_exception('Test ' . $this->getName() . ' did not close database transaction');
         }
     }
 }
开发者ID:saurabh947,项目名称:MoodleLearning,代码行数:63,代码来源:advanced_testcase.php

示例3: runBare

 public function runBare()
 {
     try {
         return parent::runBare();
     } catch (\atk4\core\Exception $e) {
         throw new \atk4\data\tests\AgileExceptionWrapper($e->getMessage(), 0, $e);
     }
 }
开发者ID:atk4,项目名称:data,代码行数:8,代码来源:TestCase.php

示例4: runBare

 public function runBare()
 {
     try {
         return parent::runBare();
     } catch (Exception $e) {
         throw new PHPUnit_AgileExceptionWrapper($e->getMessage(), 0, $e);
     }
 }
开发者ID:atk4,项目名称:core,代码行数:8,代码来源:PHPUnit_AgileTestCase.php

示例5: runBare

 /**
  * Injects an untainted clone of the object manager and all its referencing
  * objects for every test.
  *
  * @return void
  * @author Robert Lemke <robert@typo3.org>
  */
 public function runBare()
 {
     \PHPUnit_Framework_Error_Warning::$enabled = FALSE;
     if (class_exists('F3\\Testing\\AbstractTestRunner', FALSE)) {
         $this->objectManager = clone \F3\Testing\AbstractTestRunner::$objectManagerForTesting;
         $this->objectFactory = $this->objectManager->getObjectFactory();
     }
     parent::runBare();
 }
开发者ID:kdambekalns,项目名称:framework-benchs,代码行数:16,代码来源:BaseTestCase.php

示例6: runBare

 public function runBare()
 {
     if (!isset(CM_Config::get()->CM_Site_Abstract->class)) {
         $siteDefault = $this->getMockSite(null, null, array('url' => 'http://www.default.dev', 'urlCdn' => 'http://cdn.default.dev', 'name' => 'Default', 'emailAddress' => 'default@default.dev'));
         CM_Config::get()->CM_Site_Abstract->class = get_class($siteDefault);
     }
     $this->setServiceManager(CMTest_TH::getServiceManager());
     parent::runBare();
 }
开发者ID:NicolasSchmutz,项目名称:cm,代码行数:9,代码来源:TestCase.php

示例7: runBare

	public function runBare()
	{
		try {
			return parent::runBare();
		} catch (\Exception $e) {
			if (!$e instanceof \PHPUnit_Framework_AssertionFailedError) {
				\Nella\Diagnostics\ConsoleDebug::_exceptionHandler($e);
			}
			throw $e;
		}
	}
开发者ID:norbe,项目名称:framework,代码行数:11,代码来源:TestCase.php

示例8: runBare

 /**
  * Adds Hamcrest assertion counts to PHPUnit
  */
 public function runBare()
 {
     $e = null;
     ha::resetCount();
     try {
         parent::runBare();
     } catch (\Exception $e) {
     }
     $this->addToAssertionCount(ha::getCount());
     if ($e !== null) {
         throw $e;
     }
 }
开发者ID:nick-jones,项目名称:php-ucd,代码行数:16,代码来源:TestCase.php

示例9: runBare

 /**
  * Runs the bare test sequence and log any changes in global state or database.
  * @return void
  */
 public final function runBare()
 {
     global $DB;
     try {
         parent::runBare();
     } catch (Exception $e) {
         // cleanup after failed expectation
         phpunit_util::reset_all_data();
         throw $e;
     }
     if ($DB->is_transaction_started()) {
         phpunit_util::reset_all_data();
         throw new coding_exception('basic_testcase ' . $this->getName() . ' is not supposed to use database transactions!');
     }
     phpunit_util::reset_all_data(true);
 }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:20,代码来源:basic_testcase.php

示例10: runBare

 /**
  * @return void
  */
 public function runBare()
 {
     \PHPUnit_Framework_Error_Warning::$enabled = FALSE;
     parent::runBare();
 }
开发者ID:animaltool,项目名称:webinterface,代码行数:8,代码来源:BaseTestCase.php

示例11: runBare

 /**
  * {@inheritdoc}
  */
 public function runBare()
 {
     parent::runBare();
     $this->prophet = null;
 }
开发者ID:Arachnias,项目名称:FlobFoundationBundle,代码行数:8,代码来源:BaseTestCase.php

示例12: runBare

 /**
  * Overwrite runBare
  *
  * PHPUnit instantiates the test classes before
  * running them individually. So right before a test
  * runs we set our instance. Normally this step would
  * happen in setUp, but someone is bound to forget to
  * call the parent method and debugging this is no fun.
  */
 public function runBare()
 {
     self::$ci_test_instance = $this;
     parent::runBare();
 }
开发者ID:madwings,项目名称:insanedb,代码行数:14,代码来源:ci_testcase.php

示例13: runBare

 /**
  * Runs the bare test sequence.
  * @return void
  */
 public function runBare()
 {
     try {
         parent::runBare();
     } catch (Exception $e) {
         if ($this->tdb->is_transaction_started()) {
             $this->tdb->force_transaction_rollback();
         }
         $this->tearDown();
         throw $e;
     }
 }
开发者ID:educakanchay,项目名称:campus,代码行数:16,代码来源:database_driver_testcase.php

示例14: runBare

 /**
  * Make sure we always disconnect after tests
  */
 public function runBare()
 {
     // log test timing
     $test = get_class($this) . '::' . $this->getName();
     $t = new Horde_Support_Timer();
     $t->push();
     $this->_logInfo($test, 'START ');
     $this->_connect();
     parent::runBare();
     $this->_disconnect();
     // log test timing
     $elapsed = $t->pop();
     $this->_logInfo($test, 'FINISH', $elapsed);
 }
开发者ID:lerre,项目名称:framework,代码行数:17,代码来源:Unit.php

示例15: runBare

 /**
  * Runs the bare test sequence.
  *
  * @author             Art <a.molcanovas@gmail.com>
  * @throws Exception
  * @codeCoverageIgnore Won't be picked up as these are tested in separate processes
  * @uses               PHPUnit_Framework_TestCase::runBare()
  */
 public function runBare()
 {
     $this->parseMethodAnnotations($sleepTime, $retryCount);
     if ($retryCount > 0) {
         $numRuns = 0;
         while ($numRuns < $retryCount) {
             $numRuns++;
             try {
                 parent::runBare();
                 return;
             } catch (Exception $e) {
                 if ($numRuns == $retryCount) {
                     throw $e;
                 } else {
                     PHPUnitReflection::getMessage()->setValue($this, '');
                     PHPUnitReflection::getStatus()->setValue($this, null);
                     fwrite(STDERR, sprintf(self::$retryMsg, $this->getName(false), $sleepTime, $numRuns, $retryCount));
                     sleep($sleepTime);
                 }
             }
         }
     } else {
         parent::runBare();
     }
 }
开发者ID:alorel,项目名称:phpunit-auto-rerun,代码行数:33,代码来源:PHPUnit_Retriable_TestCase.php


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