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


PHP PHPUnit_Util_GlobalState::getIniSettingsAsString方法代码示例

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


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

示例1: 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
  * @return PHPUnit_Framework_TestResult
  * @throws PHPUnit_Framework_Exception
  */
 public function run(PHPUnit_Framework_TestResult $result = null)
 {
     if ($result === null) {
         $result = $this->createResult();
     }
     if (!$this instanceof PHPUnit_Framework_Warning) {
         $this->setTestResultObject($result);
         $this->setUseErrorHandlerFromAnnotation();
     }
     if ($this->useErrorHandler !== null) {
         $oldErrorHandlerSetting = $result->getConvertErrorsToExceptions();
         $result->convertErrorsToExceptions($this->useErrorHandler);
     }
     if (!$this instanceof PHPUnit_Framework_Warning && !$this->handleDependencies()) {
         return;
     }
     if ($this->runTestInSeparateProcess === true && $this->inIsolation !== true && !$this instanceof PHPUnit_Extensions_SeleniumTestCase && !$this instanceof PHPUnit_Extensions_PhptTestCase) {
         $class = new ReflectionClass($this);
         $template = new Text_Template(__DIR__ . '/../Util/PHP/Template/TestCaseMethod.tpl');
         if ($this->preserveGlobalState) {
             $constants = PHPUnit_Util_GlobalState::getConstantsAsString();
             $globals = PHPUnit_Util_GlobalState::getGlobalsAsString();
             $includedFiles = PHPUnit_Util_GlobalState::getIncludedFilesAsString();
             $iniSettings = PHPUnit_Util_GlobalState::getIniSettingsAsString();
         } else {
             $constants = '';
             if (!empty($GLOBALS['__PHPUNIT_BOOTSTRAP'])) {
                 $globals = '$GLOBALS[\'__PHPUNIT_BOOTSTRAP\'] = ' . var_export($GLOBALS['__PHPUNIT_BOOTSTRAP'], true) . ";\n";
             } else {
                 $globals = '';
             }
             $includedFiles = '';
             $iniSettings = '';
         }
         $coverage = $result->getCollectCodeCoverageInformation() ? 'true' : 'false';
         $isStrictAboutTestsThatDoNotTestAnything = $result->isStrictAboutTestsThatDoNotTestAnything() ? 'true' : 'false';
         $isStrictAboutOutputDuringTests = $result->isStrictAboutOutputDuringTests() ? 'true' : 'false';
         $isStrictAboutTestSize = $result->isStrictAboutTestSize() ? 'true' : 'false';
         $isStrictAboutTodoAnnotatedTests = $result->isStrictAboutTodoAnnotatedTests() ? 'true' : 'false';
         if (defined('PHPUNIT_COMPOSER_INSTALL')) {
             $composerAutoload = var_export(PHPUNIT_COMPOSER_INSTALL, true);
         } else {
             $composerAutoload = '\'\'';
         }
         if (defined('__PHPUNIT_PHAR__')) {
             $phar = var_export(__PHPUNIT_PHAR__, true);
         } else {
             $phar = '\'\'';
         }
         $data = var_export(serialize($this->data), true);
         $dataName = var_export($this->dataName, true);
         $dependencyInput = var_export(serialize($this->dependencyInput), true);
         $includePath = var_export(get_include_path(), true);
         // must do these fixes because TestCaseMethod.tpl has unserialize('{data}') in it, and we can't break BC
         // the lines above used to use addcslashes() rather than var_export(), which breaks null byte escape sequences
         $data = "'." . $data . ".'";
         $dataName = "'.(" . $dataName . ").'";
         $dependencyInput = "'." . $dependencyInput . ".'";
         $includePath = "'." . $includePath . ".'";
         $template->setVar(array('composerAutoload' => $composerAutoload, 'phar' => $phar, 'filename' => $class->getFileName(), 'className' => $class->getName(), 'methodName' => $this->name, 'collectCodeCoverageInformation' => $coverage, 'data' => $data, 'dataName' => $dataName, 'dependencyInput' => $dependencyInput, 'constants' => $constants, 'globals' => $globals, 'include_path' => $includePath, 'included_files' => $includedFiles, 'iniSettings' => $iniSettings, 'isStrictAboutTestsThatDoNotTestAnything' => $isStrictAboutTestsThatDoNotTestAnything, 'isStrictAboutOutputDuringTests' => $isStrictAboutOutputDuringTests, 'isStrictAboutTestSize' => $isStrictAboutTestSize, 'isStrictAboutTodoAnnotatedTests' => $isStrictAboutTodoAnnotatedTests));
         $this->prepareTemplate($template);
         $php = PHPUnit_Util_PHP::factory();
         $php->runTestJob($template->render(), $this, $result);
     } else {
         $result->run($this);
     }
     if ($this->useErrorHandler !== null) {
         $result->convertErrorsToExceptions($oldErrorHandlerSetting);
     }
     $this->result = null;
     return $result;
 }
开发者ID:emsdog,项目名称:lumen-todo,代码行数:80,代码来源:TestCase.php

示例2: 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
  * @return PHPUnit_Framework_TestResult
  * @throws PHPUnit_Framework_Exception
  */
 public function run(PHPUnit_Framework_TestResult $result = NULL)
 {
     if ($result === NULL) {
         $result = $this->createResult();
     }
     if (!$this instanceof PHPUnit_Framework_Warning) {
         $this->setTestResultObject($result);
         $this->setUseErrorHandlerFromAnnotation();
         $this->setUseOutputBufferingFromAnnotation();
     }
     if ($this->useErrorHandler !== NULL) {
         $oldErrorHandlerSetting = $result->getConvertErrorsToExceptions();
         $result->convertErrorsToExceptions($this->useErrorHandler);
     }
     if (!$this instanceof PHPUnit_Framework_Warning && !$this->handleDependencies()) {
         return;
     }
     if ($this->runTestInSeparateProcess === TRUE && $this->inIsolation !== TRUE && !$this instanceof PHPUnit_Extensions_SeleniumTestCase && !$this instanceof PHPUnit_Extensions_PhptTestCase) {
         $class = new ReflectionClass($this);
         $template = new Text_Template(sprintf('%s%sProcess%sTestCaseMethod.tpl', __DIR__, DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR));
         if ($this->preserveGlobalState) {
             $constants = PHPUnit_Util_GlobalState::getConstantsAsString();
             $globals = PHPUnit_Util_GlobalState::getGlobalsAsString();
             $includedFiles = PHPUnit_Util_GlobalState::getIncludedFilesAsString();
             $iniSettings = PHPUnit_Util_GlobalState::getIniSettingsAsString();
         } else {
             $constants = '';
             $globals = '';
             $includedFiles = '';
             $iniSettings = '';
         }
         if ($result->getCollectCodeCoverageInformation()) {
             $coverage = 'TRUE';
         } else {
             $coverage = 'FALSE';
         }
         if ($result->isStrict()) {
             $strict = 'TRUE';
         } else {
             $strict = 'FALSE';
         }
         if (defined('PHPUNIT_COMPOSER_INSTALL')) {
             $composerAutoload = var_export(PHPUNIT_COMPOSER_INSTALL, TRUE);
         } else {
             $composerAutoload = '\'\'';
         }
         $data = var_export(serialize($this->data), TRUE);
         $dependencyInput = var_export(serialize($this->dependencyInput), TRUE);
         $includePath = var_export(get_include_path(), TRUE);
         // must do these fixes because TestCaseMethod.tpl has unserialize('{data}') in it, and we can't break BC
         // the lines above used to use addcslashes() rather than var_export(), which breaks null byte escape sequences
         $data = "'." . $data . ".'";
         $dependencyInput = "'." . $dependencyInput . ".'";
         $includePath = "'." . $includePath . ".'";
         $template->setVar(array('composerAutoload' => $composerAutoload, 'filename' => $class->getFileName(), 'className' => $class->getName(), 'methodName' => $this->name, 'collectCodeCoverageInformation' => $coverage, 'data' => $data, 'dataName' => $this->dataName, 'dependencyInput' => $dependencyInput, 'constants' => $constants, 'globals' => $globals, 'include_path' => $includePath, 'included_files' => $includedFiles, 'iniSettings' => $iniSettings, 'strict' => $strict));
         $this->prepareTemplate($template);
         $php = PHPUnit_Util_PHP::factory();
         $php->runJob($template->render(), $this, $result);
     } else {
         $result->run($this);
     }
     if ($this->useErrorHandler !== NULL) {
         $result->convertErrorsToExceptions($oldErrorHandlerSetting);
     }
     $this->result = NULL;
     return $result;
 }
开发者ID:ramonornela,项目名称:phpunit,代码行数:75,代码来源:TestCase.php


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