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


PHP PHPUnit_Framework_TestCase::run方法代码示例

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


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

示例1: run

 function run(PHPUnit_Framework_TestResult $result = NULL)
 {
     /* Some functions require some kind of caching, and will end up using the db,
      * which we can't allow, as that would open a new connection for mysql.
      * Replace with a HashBag. They would not be going to persist anyway.
      */
     ObjectCache::$instances[CACHE_DB] = new HashBagOStuff();
     if ($this->needsDB()) {
         global $wgDBprefix;
         $this->useTemporaryTables = !$this->getCliArg('use-normal-tables');
         $this->reuseDB = $this->getCliArg('reuse-db');
         $this->db = wfGetDB(DB_MASTER);
         $this->checkDbIsSupported();
         $this->oldTablePrefix = $wgDBprefix;
         if (!self::$dbSetup) {
             $this->initDB();
             self::$dbSetup = true;
         }
         $this->addCoreDBData();
         $this->addDBData();
         parent::run($result);
         $this->resetDB();
     } else {
         parent::run($result);
     }
 }
开发者ID:nischayn22,项目名称:mediawiki-core,代码行数:26,代码来源:MediaWikiTestCase.php

示例2: run

 /**
  * Runs this test case. Overridden to attach to EARL report w/o need for
  * an external XML configuration file.
  *
  * @param PHPUnit_Framework_TestResult $result the test result.
  */
 public function run(PHPUnit_Framework_TestResult $result = NULL)
 {
     global $EARL;
     $EARL->attach($result);
     $this->result = $result;
     parent::run($result);
 }
开发者ID:pulpopaul,项目名称:php-json-ld,代码行数:13,代码来源:test.php

示例3: run

 /**
  * This overide of the run method is required to run the test in isolation.
  * I have no idea why, and whilst the test runs absolutely fine when run
  * on local vm, by itself, when run as part of suite it borks
  * if not in isolation!
  */
 public function run(\PHPUnit_Framework_TestResult $result = NULL)
 {
     //mock the current incoming ip address
     $_SERVER['REMOTE_ADDR'] = '192.168.10.167';
     $this->setPreserveGlobalState(false);
     return parent::run($result);
 }
开发者ID:chippyash,项目名称:validation,代码行数:13,代码来源:NetmaskTest.php

示例4: run

/**
* Runs the test case and collects the results in a TestResult object.
* If no TestResult object is passed a new one will be created.
* This method is run for each test method in this class
*
* @param  PHPUnit_Framework_TestResult $result
* @return PHPUnit_Framework_TestResult
* @throws InvalidArgumentException
*/
	public function run(PHPUnit_Framework_TestResult $result = NULL) {
		if (!empty($this->fixtureManager)) {
			$this->fixtureManager->load($this);
		}
		$result = parent::run($result);
		if (!empty($this->fixtureManager)) {
			$this->fixtureManager->unload($this);
		}
		return $result;
	}
开发者ID:sherix88,项目名称:sigedu,代码行数:19,代码来源:CakeTestCase.php

示例5: run

 public function run(PHPUnit_Framework_TestResult $result = NULL)
 {
     if ($result === NULL) {
         $result = $this->createResult();
     }
     $this->collectCodeCoverageInformation = $result->getCollectCodeCoverageInformation();
     parent::run($result);
     if ($this->collectCodeCoverageInformation) {
         $result->getCodeCoverage()->append($this->getCodeCoverage(), $this);
     }
     return $result;
 }
开发者ID:islandmyth,项目名称:websocket-php,代码行数:12,代码来源:ClientTest.php

示例6: run

 /**
  * Reimplemented to allow us to collect code coverage info from the target server.
  * Code taken from PHPUnit_Extensions_Selenium2TestCase
  *
  * @param PHPUnit_Framework_TestResult $result
  * @return PHPUnit_Framework_TestResult
  * @throws Exception
  */
 public function run(PHPUnit_Framework_TestResult $result = NULL)
 {
     $this->testId = get_class($this) . '__' . $this->getName();
     if ($result === NULL) {
         $result = $this->createResult();
     }
     $this->collectCodeCoverageInformation = $result->getCollectCodeCoverageInformation();
     parent::run($result);
     if ($this->collectCodeCoverageInformation) {
         $coverage = new PHPUnit_Extensions_SeleniumCommon_RemoteCoverage($this->coverageScriptUrl, $this->testId);
         $result->getCodeCoverage()->append($coverage->get(), $this);
     }
     // do not call this before to give the time to the Listeners to run
     //$this->getStrategy()->endOfTest($this->session);
     return $result;
 }
开发者ID:TsobuEnterprise,项目名称:phpxmlrpc,代码行数:24,代码来源:3LocalhostTest.php

示例7: run

 public function run(PHPUnit_Framework_TestResult $result = null)
 {
     /* Some functions require some kind of caching, and will end up using the db,
      * which we can't allow, as that would open a new connection for mysql.
      * Replace with a HashBag. They would not be going to persist anyway.
      */
     ObjectCache::$instances[CACHE_DB] = new HashBagOStuff();
     // Sandbox APC by replacing with in-process hash instead.
     // Ensures values are removed between tests.
     ObjectCache::$instances['apc'] = ObjectCache::$instances['xcache'] = ObjectCache::$instances['wincache'] = new HashBagOStuff();
     $needsResetDB = false;
     if ($this->needsDB()) {
         // set up a DB connection for this test to use
         self::$useTemporaryTables = !$this->getCliArg('use-normal-tables');
         self::$reuseDB = $this->getCliArg('reuse-db');
         $this->db = wfGetDB(DB_MASTER);
         $this->checkDbIsSupported();
         if (!self::$dbSetup) {
             // switch to a temporary clone of the database
             self::setupTestDB($this->db, $this->dbPrefix());
             if (($this->db->getType() == 'oracle' || !self::$useTemporaryTables) && self::$reuseDB) {
                 $this->resetDB();
             }
         }
         $this->addCoreDBData();
         $this->addDBData();
         $needsResetDB = true;
     }
     parent::run($result);
     if ($needsResetDB) {
         $this->resetDB();
     }
 }
开发者ID:admonkey,项目名称:mediawiki,代码行数:33,代码来源:MediaWikiTestCase.php

示例8: run

 /**
  * Runs the test case and collects the results in a TestResult object.
  *
  * If no TestResult object is passed a new one will be created.
  *
  * @param \PHPUnit_Framework_TestResult $result Test result.
  *
  * @return \PHPUnit_Framework_TestResult
  * @throws \PHPUnit_Framework_Exception When exception was thrown during a test.
  */
 public function run(\PHPUnit_Framework_TestResult $result = null)
 {
     if ($result === null) {
         $result = $this->createResult();
     }
     parent::run($result);
     if ($result->getCollectCodeCoverageInformation()) {
         $result->getCodeCoverage()->append($this->getRemoteCodeCoverageInformation(), $this);
     }
     /*$this->setTestResultObject($result);*/
     // Do not call this before to give the time to the Listeners to run.
     $this->_eventDispatcher->dispatch(self::TEST_ENDED_EVENT, new TestEndedEvent($this, $result, $this->_session));
     /*$this->setTestResultObject(null);*/
     return $result;
 }
开发者ID:mablae,项目名称:phpunit-mink,代码行数:25,代码来源:BrowserTestCase.php

示例9: run

 /**
  * It is assumed that each test that makes use of the TestCase is requesting
  * a "real" DB connection
  *
  * By default, the database tables are being re-used but it is possible to
  * request a trear down so that the next test can rebuild the tables from
  * scratch
  */
 public function run(\PHPUnit_Framework_TestResult $result = null)
 {
     $this->getStore()->clear();
     $this->mwDatabaseTableBuilder = MwDatabaseTableBuilder::getInstance($this->getStore());
     $this->mwDatabaseTableBuilder->removeAvailableDatabaseType($this->databaseToBeExcluded);
     $this->destroyDatabaseTables($this->destroyDatabaseTablesBeforeRun);
     try {
         $this->mwDatabaseTableBuilder->doBuild();
     } catch (RuntimeException $e) {
         $this->isUsableUnitTestDatabase = false;
     }
     parent::run($result);
     $this->destroyDatabaseTables($this->destroyDatabaseTablesAfterRun);
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:22,代码来源:MwDBaseUnitTestCase.php

示例10: run

 /**
  * (non-PHPdoc)
  * @see PHPUnit_Framework_TestCase::run()
  */
 public function run(PHPUnit_Framework_TestResult $result = null)
 {
     $name = $this->getName(true);
     KalturaLog::debug("In KalturaTestCaseBase::run for test [{$name}]\n");
     //print("In KalturaTestCaseBase::run for test [$name]\n");
     if ($name != KalturaTestCaseBase::TEST_NOTHING_TEST_NAME) {
         //we init the framework for all tests but hte test nothing test
         $this->initFramework($result);
     }
     $result = parent::run($result);
     return $result;
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:16,代码来源:KalturaTestCaseBase.php

示例11: run

 public function run(PHPUnit_Framework_TestResult $result = null)
 {
     /* Some functions require some kind of caching, and will end up using the db,
      * which we can't allow, as that would open a new connection for mysql.
      * Replace with a HashBag. They would not be going to persist anyway.
      */
     ObjectCache::$instances[CACHE_DB] = new HashBagOStuff();
     $needsResetDB = false;
     $logName = get_class($this) . '::' . $this->getName(false);
     if ($this->needsDB()) {
         // set up a DB connection for this test to use
         self::$useTemporaryTables = !$this->getCliArg('use-normal-tables');
         self::$reuseDB = $this->getCliArg('reuse-db');
         $this->db = wfGetDB(DB_MASTER);
         $this->checkDbIsSupported();
         if (!self::$dbSetup) {
             wfProfileIn($logName . ' (clone-db)');
             // switch to a temporary clone of the database
             self::setupTestDB($this->db, $this->dbPrefix());
             if (($this->db->getType() == 'oracle' || !self::$useTemporaryTables) && self::$reuseDB) {
                 $this->resetDB();
             }
             wfProfileOut($logName . ' (clone-db)');
         }
         wfProfileIn($logName . ' (prepare-db)');
         $this->addCoreDBData();
         $this->addDBData();
         wfProfileOut($logName . ' (prepare-db)');
         $needsResetDB = true;
     }
     wfProfileIn($logName);
     parent::run($result);
     wfProfileOut($logName);
     if ($needsResetDB) {
         wfProfileIn($logName . ' (reset-db)');
         $this->resetDB();
         wfProfileOut($logName . ' (reset-db)');
     }
 }
开发者ID:Habatchii,项目名称:wikibase-for-mediawiki,代码行数:39,代码来源:MediaWikiTestCase.php

示例12: run

 public function run(PHPUnit_Framework_TestResult $result = null)
 {
     if (!self::$_aInitialDbChecksum) {
         self::initializeDbChecksum();
     }
     $result = parent::run($result);
     oxTestModules::cleanUp();
     return $result;
 }
开发者ID:alexschwarz89,项目名称:Barzahlen-OXID-4.7,代码行数:9,代码来源:OxidTestCase.php

示例13: run

 /**
  * @param PHPUnit_Framework_TestResult $result
  *
  * @return PHPUnit_Framework_TestResult
  */
 public function run(PHPUnit_Framework_TestResult $result = null)
 {
     $result = parent::run($result);
     oxTestModules::cleanUp();
     return $result;
 }
开发者ID:suabo,项目名称:oxid_modules_config,代码行数:11,代码来源:OxidTestCase.php

示例14: run

 public function run(PHPUnit_Framework_TestResult $result = null)
 {
     // Reset all caches between tests.
     $this->doLightweightServiceReset();
     $needsResetDB = false;
     if (!self::$dbSetup || $this->needsDB()) {
         // set up a DB connection for this test to use
         self::$useTemporaryTables = !$this->getCliArg('use-normal-tables');
         self::$reuseDB = $this->getCliArg('reuse-db');
         $this->db = wfGetDB(DB_MASTER);
         $this->checkDbIsSupported();
         if (!self::$dbSetup) {
             $this->setupAllTestDBs();
             $this->addCoreDBData();
             if (($this->db->getType() == 'oracle' || !self::$useTemporaryTables) && self::$reuseDB) {
                 $this->resetDB($this->db, $this->tablesUsed);
             }
         }
         // TODO: the DB setup should be done in setUpBeforeClass(), so the test DB
         // is available in subclass's setUpBeforeClass() and setUp() methods.
         // This would also remove the need for the HACK that is oncePerClass().
         if ($this->oncePerClass()) {
             $this->addDBDataOnce();
         }
         $this->addDBData();
         $needsResetDB = true;
     }
     parent::run($result);
     if ($needsResetDB) {
         $this->resetDB($this->db, $this->tablesUsed);
     }
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:32,代码来源:MediaWikiTestCase.php

示例15: run

 /**
  * Overload the running of this test in case we only want to run
  * specific data sets
  *
  * Usage from command-line:
  *
  *    TEST="someTest" phpunit suiteTest.php
  *
  *    TEST="1|2|3" phpunit threeDataProviderTest.php
  * 
  * @param PHPUnit_Framework_TestResult $result
  * @throws InvalidArgumentException
  */
 public function run(PHPUnit_Framework_TestResult $result = null)
 {
     set_time_limit(0);
     // Limit our data sets
     $env = getenv('TEST');
     if (is_string($env) && strlen($env) > 0) {
         $env = explode('|', $env);
         $dataProviderElement = $this->getDataTestCasePrivate('dataName');
         if (empty($dataProviderElement)) {
             $dataProviderElement = 0;
         }
         if (!in_array($dataProviderElement, $env)) {
             return $result;
         }
     }
     return parent::run($result);
 }
开发者ID:chrismcmacken,项目名称:phptools,代码行数:30,代码来源:PHPUnitTestBase.php


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