本文整理汇总了PHP中PHPUnit_Framework_Error_Warning类的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Framework_Error_Warning类的具体用法?PHP PHPUnit_Framework_Error_Warning怎么用?PHP PHPUnit_Framework_Error_Warning使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PHPUnit_Framework_Error_Warning类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tearDown
public function tearDown()
{
unset($this->app);
PHPUnit_Framework_Error_Warning::$enabled = $this->warning_enabled;
PHPUnit_Framework_Error_Notice::$enabled = $this->notice_enabled;
PHPUnit_Framework_Error_Deprecated::$enabled = $this->deprecated_enabled;
}
示例2: testProcessOrderLedgerPayments
public function testProcessOrderLedgerPayments()
{
PHPUnit_Framework_Error_Warning::$enabled = FALSE;
$result = $this->Payment->processOrderPayments("Test Order #13123", array(array("type" => "ledger", "presenter_id" => 1, "user_id" => 1, "amount" => Money::fromFloat(60)), array("type" => "creditcard", "amount" => Money::fromFloat(30), "cardholder" => "Test wohoo", "billingzip" => "84003", "cardnum" => "4068758923310472", "carexp" => "12/2015", "cardcode" => "962")));
$this->assertTrue($result['success']);
$this->assertTrue(!empty($result['payments'][0]['transaction_id']) && strlen($result['payments'][0]['transaction_id']) == 17);
}
示例3: doEnhancedRun
public function doEnhancedRun(\PHPUnit_Framework_Test $suite, \PHPUnit_Framework_TestResult $result, array $arguments = array())
{
$this->handleConfiguration($arguments);
if (is_integer($arguments['repeat'])) {
$suite = new \PHPUnit_Extensions_RepeatedTest($suite, $arguments['repeat'], $arguments['filter'], $arguments['groups'], $arguments['excludeGroups'], $arguments['processIsolation']);
}
if (!$arguments['convertErrorsToExceptions']) {
$result->convertErrorsToExceptions(FALSE);
}
if (!$arguments['convertNoticesToExceptions']) {
\PHPUnit_Framework_Error_Notice::$enabled = FALSE;
}
if (!$arguments['convertWarningsToExceptions']) {
\PHPUnit_Framework_Error_Warning::$enabled = FALSE;
}
if ($arguments['stopOnError']) {
$result->stopOnError(TRUE);
}
if ($arguments['stopOnFailure']) {
$result->stopOnFailure(TRUE);
}
if ($arguments['stopOnIncomplete']) {
$result->stopOnIncomplete(TRUE);
}
if ($arguments['stopOnSkipped']) {
$result->stopOnSkipped(TRUE);
}
if ($this->printer === NULL) {
if (isset($arguments['printer']) && $arguments['printer'] instanceof \PHPUnit_Util_Printer) {
$this->printer = $arguments['printer'];
} else {
$this->printer = new \Codeception\PHPUnit\ResultPrinter\UI(NULL, $arguments['verbose'], $arguments['colors'], $arguments['debug']);
}
}
if (isset($arguments['report'])) {
if ($arguments['report']) {
$this->printer = new \Codeception\PHPUnit\ResultPrinter\Report();
}
}
if (isset($arguments['html'])) {
if ($arguments['html']) {
$arguments['listeners'][] = new \Codeception\PHPUnit\ResultPrinter\HTML($arguments['html']);
}
}
$arguments['listeners'][] = $this->printer;
// clean up listeners between suites
foreach ($arguments['listeners'] as $listener) {
$result->removeListener($listener);
$result->addListener($listener);
}
if ($arguments['strict']) {
$result->strictMode(TRUE);
}
$suite->run($result, $arguments['filter'], $arguments['groups'], $arguments['excludeGroups'], $arguments['processIsolation']);
unset($suite);
$result->flushListeners();
return $result;
}
示例4: setUp
/**
* Set up method
*/
protected function setUp()
{
$this->corporateDirectoryWebServiceWrapper = new CorporateDirectoryWebServiceWrapper();
$this->fixture = sfConfig::get('sf_plugins_dir') . '/orangehrmCorporateDirectoryPlugin/test/fixtures/EmployeeDirectoryWrapperData.yml';
$this->manager = new WSManager();
$this->helper = new WSHelper();
PHPUnit_Framework_Error_Warning::$enabled = FALSE;
PHPUnit_Framework_Error_Notice::$enabled = FALSE;
}
示例5: go_forth
private function go_forth()
{
if (defined('HHVM_VERSION')) {
return;
}
PHPUnit_Framework_Error_Warning::$enabled = $this->silence_warning;
ini_set('display_errors', $this->silence_display);
ini_set('error_log', $this->silence_log);
}
示例6: 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();
}
示例7: testBadCall
public function testBadCall()
{
PHPUnit_Framework_Error_Warning::$enabled = FALSE;
$url =& $this->obj;
$meth_name = md5(time());
$this->setExpectedException('PHPUnit_Framework_Error');
$url->{$meth_name}('test');
PHPUnit_Framework_Error_Warning::$enabled = TRUE;
}
示例8: tearDown
public function tearDown()
{
// If file has been renamed, restore it at original place
if ( file_exists( $this->destFile ) )
rename( $this->destFile, $this->file );
// If file has been removed, restore it as well
if ( !file_exists( $this->file ) )
file_put_contents ( $this->file, $this->content );
PHPUnit_Framework_Error_Warning::$enabled = $this->warningEnabledOrig;
parent::tearDown();
}
示例9: setUp
/**
* Set up method
*/
protected function setUp()
{
$this->adminWebServiceWrapper = new AdminWebServiceWrapper();
$this->jobTitlefixture = sfConfig::get('sf_plugins_dir') . '/orangehrmAdminPlugin/test/fixtures/JobTitleDao.yml';
$this->locationFixture = sfConfig::get('sf_plugins_dir') . '/orangehrmAdminPlugin/test/fixtures/LocationDao.yml';
$this->locationTestCases = sfYaml::load(sfConfig::get('sf_plugins_dir') . '/orangehrmAdminPlugin/test/fixtures/LocationDao.yml');
$this->manager = new WSManager();
$this->helper = new WSHelper();
PHPUnit_Framework_Error_Warning::$enabled = FALSE;
PHPUnit_Framework_Error_Notice::$enabled = FALSE;
}
示例10: testCleanFailure
/**
* @expectedException \Exception
* @expectedExceptionMessageRegexp /Unable to load the file contents of/
*/
public function testCleanFailure()
{
\PHPUnit_Framework_Error_Warning::$enabled = false;
$err_level = error_reporting();
error_reporting($err_level & ~E_WARNING);
$fake_sugar = __DIR__ . '/fake_sugar';
touch(self::$invalid_file);
chmod(self::$invalid_file, 00);
$logger = new TestLogger();
$cleaner = new LangFileCleaner(new Application($logger, $fake_sugar));
$this->assertTrue($cleaner->clean());
error_reporting($err_level);
}
示例11: testOnAfterBuildQuery
/**
* @group Behaviour
* @group RelationFiltersOnAfterBuildQuery
* @covers FOF30\Model\DataModel\Behaviour\RelationFilters::onAfterBuildQuery
* @dataProvider RelationFiltersDataprovider::getTestOnAfterBuildQuery
*/
public function testOnAfterBuildQuery($test, $check)
{
\PHPUnit_Framework_Error_Warning::$enabled = false;
$msg = 'RelationFilters::onAfterBuildQuery %s - Case: ' . $check['case'];
$config = array('relations' => array(array('itemName' => 'children', 'type' => 'hasMany', 'foreignModelClass' => 'Children', 'localKey' => 'fakeapp_parent_id', 'foreignKey' => 'fakeapp_parent_id')));
/** @var \FOF30\Model\DataModel $model */
$model = new Parents(static::$container, $config);
$query = \JFactory::getDbo()->getQuery(true)->select('*')->from('test');
$dispatcher = $model->getBehavioursDispatcher();
$filter = new RelationFilters($dispatcher);
// I have to setup a filter
$model->has('children', $test['operator'], $test['value']);
$filter->onAfterBuildQuery($model, $query);
$this->assertEquals($check['query'], trim((string) $query), sprintf($msg, 'Failed to build the search query'));
}
示例12: setExpectedTriggerError
public function setExpectedTriggerError($errno, $message = '')
{
$exceptionName = '';
switch ($errno) {
case E_NOTICE:
case E_STRICT:
PHPUnit_Framework_Error_Notice::$enabled = true;
$exceptionName = 'PHPUnit_Framework_Error_Notice';
break;
case E_WARNING:
PHPUnit_Framework_Error_Warning::$enabled = true;
$exceptionName = 'PHPUnit_Framework_Error_Warning';
break;
default:
$exceptionName = 'PHPUnit_Framework_Error';
break;
}
$this->expectedTriggerError = true;
$this->test_case->setExpectedException($exceptionName, (string) $message, $errno);
}
示例13: runBare
/**
* @return void
*/
public function runBare()
{
\PHPUnit_Framework_Error_Warning::$enabled = FALSE;
parent::runBare();
}
示例14: doEnhancedRun
public function doEnhancedRun(\PHPUnit_Framework_Test $suite, \PHPUnit_Framework_TestResult $result, array $arguments = array())
{
$this->handleConfiguration($arguments);
if (is_integer($arguments['repeat'])) {
$suite = new \PHPUnit_Extensions_RepeatedTest($suite, $arguments['repeat'], $arguments['filter'], $arguments['groups'], $arguments['excludeGroups'], $arguments['processIsolation']);
}
$result->convertErrorsToExceptions(FALSE);
if (!$arguments['convertNoticesToExceptions']) {
\PHPUnit_Framework_Error_Notice::$enabled = FALSE;
}
if (!$arguments['convertWarningsToExceptions']) {
\PHPUnit_Framework_Error_Warning::$enabled = FALSE;
}
if ($arguments['stopOnError']) {
$result->stopOnError(TRUE);
}
if ($arguments['stopOnFailure']) {
$result->stopOnFailure(TRUE);
}
if ($arguments['stopOnIncomplete']) {
$result->stopOnIncomplete(TRUE);
}
if ($arguments['stopOnSkipped']) {
$result->stopOnSkipped(TRUE);
}
if ($this->printer === NULL) {
if (isset($arguments['printer']) && $arguments['printer'] instanceof \PHPUnit_Util_Printer) {
$this->printer = $arguments['printer'];
} else {
$this->printer = new \Codeception\PHPUnit\ResultPrinter\UI(NULL, $arguments['verbose'], $arguments['colors'], $arguments['debug']);
}
}
if (isset($arguments['report'])) {
if ($arguments['report']) {
$this->printer = new \Codeception\PHPUnit\ResultPrinter\Report();
}
}
if (empty(self::$persistentListeners)) {
foreach ($this->defaultListeners as $listener => $value) {
if (!isset($arguments[$listener])) {
$arguments[$listener] = $value;
}
}
if ($arguments['html']) {
self::$persistentListeners[] = new \Codeception\PHPUnit\ResultPrinter\HTML(\Codeception\Configuration::logDir() . 'report.html');
}
if ($arguments['xml']) {
self::$persistentListeners[] = new \Codeception\PHPUnit\Log\JUnit(\Codeception\Configuration::logDir() . 'report.xml', false);
}
if ($arguments['tap']) {
self::$persistentListeners[] = new \PHPUnit_Util_Log_TAP(\Codeception\Configuration::logDir() . 'report.tap.log');
}
if ($arguments['json']) {
self::$persistentListeners[] = new \PHPUnit_Util_Log_JSON(\Codeception\Configuration::logDir() . 'report.json');
}
foreach (self::$persistentListeners as $listener) {
$result->addListener($listener);
}
}
$arguments['listeners'][] = $this->printer;
// clean up listeners between suites
foreach ($arguments['listeners'] as $listener) {
$result->addListener($listener);
}
if ($arguments['strict']) {
$result->strictMode(TRUE);
}
$suite->run($result, $arguments['filter'], $arguments['groups'], $arguments['excludeGroups'], $arguments['processIsolation']);
unset($suite);
foreach ($arguments['listeners'] as $listener) {
$result->removeListener($listener);
}
return $result;
}
示例15: doRun
/**
* @param PHPUnit_Framework_Test $suite
* @param array $arguments
* @param bool $exit
*
* @return PHPUnit_Framework_TestResult
*/
public function doRun(PHPUnit_Framework_Test $suite, array $arguments = [], $exit)
{
if (isset($arguments['configuration'])) {
$GLOBALS['__PHPUNIT_CONFIGURATION_FILE'] = $arguments['configuration'];
}
$this->handleConfiguration($arguments);
$this->processSuiteFilters($suite, $arguments);
if (isset($arguments['bootstrap'])) {
$GLOBALS['__PHPUNIT_BOOTSTRAP'] = $arguments['bootstrap'];
}
if ($arguments['backupGlobals'] === false) {
$suite->setBackupGlobals(false);
}
if ($arguments['backupStaticAttributes'] === true) {
$suite->setBackupStaticAttributes(true);
}
if ($arguments['beStrictAboutChangesToGlobalState'] === true) {
$suite->setbeStrictAboutChangesToGlobalState(true);
}
if (is_integer($arguments['repeat'])) {
$test = new PHPUnit_Extensions_RepeatedTest($suite, $arguments['repeat'], $arguments['processIsolation']);
$suite = new PHPUnit_Framework_TestSuite();
$suite->addTest($test);
}
$result = $this->createTestResult();
if (!$arguments['convertErrorsToExceptions']) {
$result->convertErrorsToExceptions(false);
}
if (!$arguments['convertNoticesToExceptions']) {
PHPUnit_Framework_Error_Notice::$enabled = false;
}
if (!$arguments['convertWarningsToExceptions']) {
PHPUnit_Framework_Error_Warning::$enabled = false;
}
if ($arguments['stopOnError']) {
$result->stopOnError(true);
}
if ($arguments['stopOnFailure']) {
$result->stopOnFailure(true);
}
if ($arguments['stopOnWarning']) {
$result->stopOnWarning(true);
}
if ($arguments['stopOnIncomplete']) {
$result->stopOnIncomplete(true);
}
if ($arguments['stopOnRisky']) {
$result->stopOnRisky(true);
}
if ($arguments['stopOnSkipped']) {
$result->stopOnSkipped(true);
}
if ($this->printer === null) {
if (isset($arguments['printer']) && $arguments['printer'] instanceof PHPUnit_Util_Printer) {
$this->printer = $arguments['printer'];
} else {
$printerClass = 'PHPUnit_TextUI_ResultPrinter';
if (isset($arguments['printer']) && is_string($arguments['printer']) && class_exists($arguments['printer'], false)) {
$class = new ReflectionClass($arguments['printer']);
if ($class->isSubclassOf('PHPUnit_TextUI_ResultPrinter')) {
$printerClass = $arguments['printer'];
}
}
$this->printer = new $printerClass(isset($arguments['stderr']) ? 'php://stderr' : null, $arguments['verbose'], $arguments['colors'], $arguments['debug'], $arguments['columns'], $arguments['reverseList']);
}
}
if (!$this->printer instanceof PHPUnit_Util_Log_TAP) {
$this->printer->write(PHPUnit_Runner_Version::getVersionString() . "\n");
self::$versionStringPrinted = true;
if ($arguments['verbose']) {
$runtime = $this->runtime->getNameWithVersion();
if ($this->runtime->hasXdebug()) {
$runtime .= sprintf(' with Xdebug %s', phpversion('xdebug'));
}
$this->writeMessage('Runtime', $runtime);
if (isset($arguments['configuration'])) {
$this->writeMessage('Configuration', $arguments['configuration']->getFilename());
}
}
if (isset($arguments['deprecatedCheckForUnintentionallyCoveredCodeSettingUsed'])) {
print "Warning: Deprecated configuration setting \"checkForUnintentionallyCoveredCode\" used\n";
}
}
foreach ($arguments['listeners'] as $listener) {
$result->addListener($listener);
}
$result->addListener($this->printer);
if (isset($arguments['testdoxHTMLFile'])) {
$result->addListener(new PHPUnit_Util_TestDox_ResultPrinter_HTML($arguments['testdoxHTMLFile']));
}
if (isset($arguments['testdoxTextFile'])) {
$result->addListener(new PHPUnit_Util_TestDox_ResultPrinter_Text($arguments['testdoxTextFile']));
}
//.........这里部分代码省略.........