本文整理汇总了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);
}
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}
}
示例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;
}
示例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);
}
示例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;
}
示例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)');
}
}
示例12: run
public function run(PHPUnit_Framework_TestResult $result = null)
{
if (!self::$_aInitialDbChecksum) {
self::initializeDbChecksum();
}
$result = parent::run($result);
oxTestModules::cleanUp();
return $result;
}
示例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;
}
示例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);
}
}
示例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);
}