本文整理汇总了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;
}
}
示例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');
}
}
}
示例3: runBare
public function runBare()
{
try {
return parent::runBare();
} catch (\atk4\core\Exception $e) {
throw new \atk4\data\tests\AgileExceptionWrapper($e->getMessage(), 0, $e);
}
}
示例4: runBare
public function runBare()
{
try {
return parent::runBare();
} catch (Exception $e) {
throw new PHPUnit_AgileExceptionWrapper($e->getMessage(), 0, $e);
}
}
示例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();
}
示例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();
}
示例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;
}
}
示例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;
}
}
示例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);
}
示例10: runBare
/**
* @return void
*/
public function runBare()
{
\PHPUnit_Framework_Error_Warning::$enabled = FALSE;
parent::runBare();
}
示例11: runBare
/**
* {@inheritdoc}
*/
public function runBare()
{
parent::runBare();
$this->prophet = null;
}
示例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();
}
示例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;
}
}
示例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);
}
示例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();
}
}