本文整理汇总了PHP中PHPUnit_Framework_Test::setBackupGlobals方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Framework_Test::setBackupGlobals方法的具体用法?PHP PHPUnit_Framework_Test::setBackupGlobals怎么用?PHP PHPUnit_Framework_Test::setBackupGlobals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPUnit_Framework_Test
的用法示例。
在下文中一共展示了PHPUnit_Framework_Test::setBackupGlobals方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doRun
/**
* @param PHPUnit_Framework_Test $suite
* @param array $arguments
* @return PHPUnit_Framework_TestResult
*/
public function doRun(PHPUnit_Framework_Test $suite, array $arguments = array())
{
$this->handleConfiguration($arguments);
if (isset($arguments['bootstrap'])) {
$bootstrap = PHPUnit_Util_Fileloader::load($arguments['bootstrap']);
if ($bootstrap) {
$GLOBALS['__PHPUNIT_BOOTSTRAP'] = $bootstrap;
}
}
if ($arguments['backupGlobals'] === FALSE) {
$suite->setBackupGlobals(FALSE);
}
if ($arguments['backupStaticAttributes'] === FALSE) {
$suite->setBackupStaticAttributes(FALSE);
}
$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['stopOnFailure']) {
$result->stopOnFailure(TRUE);
}
if ($this->printer === NULL) {
if (isset($arguments['printer']) && $arguments['printer'] instanceof PHPUnit_Util_Printer) {
$this->printer = $arguments['printer'];
} else {
$this->printer = new PHPUnit_TextUI_ResultPrinter(NULL, $arguments['verbose'], $arguments['colors'], $arguments['debug']);
}
}
if (!$this->printer instanceof PHPUnit_Util_Log_TAP && !self::$versionStringPrinted) {
$this->printer->write(PHPUnit_Runner_Version::getVersionString() . "\n\n");
}
foreach ($arguments['listeners'] as $listener) {
$result->addListener($listener);
}
$result->addListener($this->printer);
if (isset($arguments['storyHTMLFile'])) {
require_once 'PHPUnit/Extensions/Story/ResultPrinter/HTML.php';
$result->addListener(new PHPUnit_Extensions_Story_ResultPrinter_HTML($arguments['storyHTMLFile']));
}
if (isset($arguments['storyTextFile'])) {
require_once 'PHPUnit/Extensions/Story/ResultPrinter/Text.php';
$result->addListener(new PHPUnit_Extensions_Story_ResultPrinter_Text($arguments['storyTextFile']));
}
if (isset($arguments['testdoxHTMLFile'])) {
require_once 'PHPUnit/Util/TestDox/ResultPrinter/HTML.php';
$result->addListener(new PHPUnit_Util_TestDox_ResultPrinter_HTML($arguments['testdoxHTMLFile']));
}
if (isset($arguments['testdoxTextFile'])) {
require_once 'PHPUnit/Util/TestDox/ResultPrinter/Text.php';
$result->addListener(new PHPUnit_Util_TestDox_ResultPrinter_Text($arguments['testdoxTextFile']));
}
if ((isset($arguments['coverageClover']) || isset($arguments['reportDirectory'])) && extension_loaded('xdebug')) {
$result->collectCodeCoverageInformation(TRUE);
}
if (isset($arguments['logDbus'])) {
require_once 'PHPUnit/Util/Log/DBUS.php';
$result->addListener(new PHPUnit_Util_Log_DBUS());
}
if (isset($arguments['jsonLogfile'])) {
require_once 'PHPUnit/Util/Log/JSON.php';
$result->addListener(new PHPUnit_Util_Log_JSON($arguments['jsonLogfile']));
}
if (isset($arguments['tapLogfile'])) {
require_once 'PHPUnit/Util/Log/TAP.php';
$result->addListener(new PHPUnit_Util_Log_TAP($arguments['tapLogfile']));
}
if (isset($arguments['junitLogfile'])) {
require_once 'PHPUnit/Util/Log/JUnit.php';
$result->addListener(new PHPUnit_Util_Log_JUnit($arguments['junitLogfile'], $arguments['logIncompleteSkipped']));
}
$suite->run($result, $arguments['filter'], $arguments['groups'], $arguments['excludeGroups'], $arguments['processIsolation']);
unset($suite);
$result->flushListeners();
if ($this->printer instanceof PHPUnit_TextUI_ResultPrinter) {
$this->printer->printResult($result);
}
if (extension_loaded('tokenizer') && extension_loaded('xdebug')) {
if (isset($arguments['coverageClover'])) {
$this->printer->write("\nWriting code coverage data to XML file, this may take " . 'a moment.');
require_once 'PHP/CodeCoverage/Report/Clover.php';
$writer = new PHP_CodeCoverage_Report_Clover();
$writer->process($result->getCodeCoverage(), $arguments['coverageClover']);
$this->printer->write("\n");
unset($writer);
}
if (isset($arguments['reportDirectory'])) {
$this->printer->write("\nGenerating code coverage report, this may take a moment.");
$title = '';
//.........这里部分代码省略.........
示例2: doRun
/**
* @param PHPUnit_Framework_Test $suite
* @param array $arguments
* @return PHPUnit_Framework_TestResult
*/
public function doRun(PHPUnit_Framework_Test $suite, array $arguments = array())
{
$this->handleConfiguration($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 (is_integer($arguments['repeat'])) {
$suite = new PHPUnit_Extensions_RepeatedTest($suite, $arguments['repeat'], $arguments['filter'], $arguments['groups'], $arguments['excludeGroups'], $arguments['processIsolation']);
}
$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['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 PHPUnit_TextUI_ResultPrinter(NULL, $arguments['verbose'], $arguments['colors'], $arguments['debug']);
}
}
if (!$this->printer instanceof PHPUnit_Util_Log_TAP && !self::$versionStringPrinted) {
$this->printer->write(PHPUnit_Runner_Version::getVersionString() . "\n\n");
if (isset($arguments['configuration'])) {
$this->printer->write(sprintf("Configuration read from %s\n\n", $arguments['configuration']->getFilename()));
}
}
foreach ($arguments['listeners'] as $listener) {
$result->addListener($listener);
}
$result->addListener($this->printer);
if ($this->printer instanceof PHPUnit_TextUI_ResultPrinter) {
$result->addListener(new PHPUnit_Util_DeprecatedFeature_Logger());
}
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']));
}
if ((isset($arguments['coverageClover']) || isset($arguments['reportDirectory']) || isset($arguments['coveragePHP']) || isset($arguments['coverageText'])) && extension_loaded('xdebug')) {
$codeCoverage = new PHP_CodeCoverage(NULL, $this->codeCoverageFilter);
$codeCoverage->setProcessUncoveredFilesFromWhitelist($arguments['addUncoveredFilesFromWhitelist']);
if (isset($arguments['cacheTokens'])) {
$codeCoverage->setCacheTokens($arguments['cacheTokens']);
}
if (isset($arguments['forceCoversAnnotation'])) {
$codeCoverage->setForceCoversAnnotation($arguments['forceCoversAnnotation']);
}
if (isset($arguments['mapTestClassNameToCoveredClassName'])) {
$codeCoverage->setMapTestClassNameToCoveredClassName($arguments['mapTestClassNameToCoveredClassName']);
}
$result->setCodeCoverage($codeCoverage);
}
if (isset($arguments['jsonLogfile'])) {
$result->addListener(new PHPUnit_Util_Log_JSON($arguments['jsonLogfile']));
}
if (isset($arguments['tapLogfile'])) {
$result->addListener(new PHPUnit_Util_Log_TAP($arguments['tapLogfile']));
}
if (isset($arguments['junitLogfile'])) {
$result->addListener(new PHPUnit_Util_Log_JUnit($arguments['junitLogfile'], $arguments['logIncompleteSkipped']));
}
if ($arguments['strict']) {
$result->strictMode(TRUE);
$result->setTimeoutForSmallTests($arguments['timeoutForSmallTests']);
$result->setTimeoutForMediumTests($arguments['timeoutForMediumTests']);
$result->setTimeoutForLargeTests($arguments['timeoutForLargeTests']);
}
$suite->run($result, $arguments['filter'], $arguments['groups'], $arguments['excludeGroups'], $arguments['processIsolation']);
unset($suite);
$result->flushListeners();
//.........这里部分代码省略.........
示例3: doRun
/**
* @param PHPUnit_Framework_Test $suite
* @param array $arguments
* @return PHPUnit_Framework_TestResult
*/
public function doRun(PHPUnit_Framework_Test $suite, array $arguments = array())
{
$this->handleConfiguration($arguments);
if (isset($arguments['bootstrap'])) {
$bootstrap = PHPUnit_Util_Fileloader::load($arguments['bootstrap']);
if ($bootstrap) {
$GLOBALS['__PHPUNIT_BOOTSTRAP'] = $bootstrap;
}
}
if ($arguments['backupGlobals'] === FALSE) {
$suite->setBackupGlobals(FALSE);
}
if ($arguments['backupStaticAttributes'] === TRUE) {
$suite->setBackupStaticAttributes(TRUE);
}
if (is_integer($arguments['repeat'])) {
$suite = new PHPUnit_Extensions_RepeatedTest($suite, $arguments['repeat'], $arguments['filter'], $arguments['groups'], $arguments['excludeGroups'], $arguments['processIsolation']);
}
$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['stopOnFailure']) {
$result->stopOnFailure(TRUE);
}
if ($this->printer === NULL) {
if (isset($arguments['printer']) && $arguments['printer'] instanceof PHPUnit_Util_Printer) {
$this->printer = $arguments['printer'];
} else {
$this->printer = new PHPUnit_TextUI_ResultPrinter(NULL, $arguments['verbose'], $arguments['colors'], $arguments['debug']);
}
}
if (!$this->printer instanceof PHPUnit_Util_Log_TAP && !self::$versionStringPrinted) {
$this->printer->write(PHPUnit_Runner_Version::getVersionString() . "\n\n");
}
foreach ($arguments['listeners'] as $listener) {
$result->addListener($listener);
}
$result->addListener($this->printer);
if (isset($arguments['storyHTMLFile'])) {
require_once 'PHPUnit/Extensions/Story/ResultPrinter/HTML.php';
$result->addListener(new PHPUnit_Extensions_Story_ResultPrinter_HTML($arguments['storyHTMLFile']));
}
if (isset($arguments['storyTextFile'])) {
require_once 'PHPUnit/Extensions/Story/ResultPrinter/Text.php';
$result->addListener(new PHPUnit_Extensions_Story_ResultPrinter_Text($arguments['storyTextFile']));
}
if (isset($arguments['testdoxHTMLFile'])) {
require_once 'PHPUnit/Util/TestDox/ResultPrinter/HTML.php';
$result->addListener(new PHPUnit_Util_TestDox_ResultPrinter_HTML($arguments['testdoxHTMLFile']));
}
if (isset($arguments['testdoxTextFile'])) {
require_once 'PHPUnit/Util/TestDox/ResultPrinter/Text.php';
$result->addListener(new PHPUnit_Util_TestDox_ResultPrinter_Text($arguments['testdoxTextFile']));
}
if (isset($arguments['graphvizLogfile'])) {
if (PHPUnit_Util_Filesystem::fileExistsInIncludePath('Image/GraphViz.php')) {
require_once 'PHPUnit/Util/Log/GraphViz.php';
$result->addListener(new PHPUnit_Util_Log_GraphViz($arguments['graphvizLogfile']));
}
}
if ((isset($arguments['coverageClover']) || isset($arguments['coverageSource']) || isset($arguments['metricsXML']) || isset($arguments['pmdXML']) || isset($arguments['reportDirectory'])) && extension_loaded('xdebug')) {
$result->collectCodeCoverageInformation(TRUE);
}
if (isset($arguments['jsonLogfile'])) {
require_once 'PHPUnit/Util/Log/JSON.php';
$result->addListener(new PHPUnit_Util_Log_JSON($arguments['jsonLogfile']));
}
if (isset($arguments['tapLogfile'])) {
require_once 'PHPUnit/Util/Log/TAP.php';
$result->addListener(new PHPUnit_Util_Log_TAP($arguments['tapLogfile']));
}
if (isset($arguments['junitLogfile'])) {
require_once 'PHPUnit/Util/Log/JUnit.php';
$result->addListener(new PHPUnit_Util_Log_JUnit($arguments['junitLogfile'], $arguments['logIncompleteSkipped']));
}
if (isset($arguments['testDatabaseDSN']) && isset($arguments['testDatabaseLogRevision']) && extension_loaded('pdo')) {
$writeToTestDatabase = TRUE;
} else {
$writeToTestDatabase = FALSE;
}
if ($writeToTestDatabase) {
$dbh = PHPUnit_Util_PDO::factory($arguments['testDatabaseDSN']);
require_once 'PHPUnit/Util/Log/Database.php';
$dbListener = PHPUnit_Util_Log_Database::getInstance($dbh, $arguments['testDatabaseLogRevision'], isset($arguments['testDatabaseLogInfo']) ? $arguments['testDatabaseLogInfo'] : '');
$result->addListener($dbListener);
$result->collectCodeCoverageInformation(TRUE);
}
$suite->run($result, $arguments['filter'], $arguments['groups'], $arguments['excludeGroups'], $arguments['processIsolation']);
//.........这里部分代码省略.........
示例4: doRun
/**
* @param PHPUnit_Framework_Test $suite
* @param array $arguments
*
* @return PHPUnit_Framework_TestResult
*/
public function doRun(PHPUnit_Framework_Test $suite, array $arguments = array())
{
$this->handleConfiguration($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 (is_integer($arguments['repeat'])) {
$test = new PHPUnit_Extensions_RepeatedTest($suite, $arguments['repeat'], $arguments['filter'], $arguments['groups'], $arguments['excludeGroups'], $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['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 PHPUnit_TextUI_ResultPrinter(null, $arguments['verbose'], $arguments['colors'], $arguments['debug']);
}
}
if (!$this->printer instanceof PHPUnit_Util_Log_TAP) {
$this->printer->write(PHPUnit_Runner_Version::getVersionString() . "\n\n");
self::$versionStringPrinted = true;
if (isset($arguments['configuration'])) {
$this->printer->write(sprintf("Configuration read from %s\n\n", $arguments['configuration']->getFilename()));
}
}
foreach ($arguments['listeners'] as $listener) {
$result->addListener($listener);
}
$result->addListener($this->printer);
if ($this->printer instanceof PHPUnit_TextUI_ResultPrinter) {
$result->addListener(new PHPUnit_Util_DeprecatedFeature_Logger());
}
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']));
}
$codeCoverageReports = 0;
if (extension_loaded('xdebug')) {
if (isset($arguments['coverageClover'])) {
$codeCoverageReports++;
}
if (isset($arguments['reportDirectory'])) {
$codeCoverageReports++;
}
if (isset($arguments['coveragePHP'])) {
$codeCoverageReports++;
}
if (isset($arguments['coverageText'])) {
$codeCoverageReports++;
}
}
if ($codeCoverageReports > 0) {
$codeCoverage = new PHP_CodeCoverage(null, $this->codeCoverageFilter);
$codeCoverage->setAddUncoveredFilesFromWhitelist($arguments['addUncoveredFilesFromWhitelist']);
$codeCoverage->setProcessUncoveredFilesFromWhitelist($arguments['processUncoveredFilesFromWhitelist']);
if (isset($arguments['forceCoversAnnotation'])) {
$codeCoverage->setForceCoversAnnotation($arguments['forceCoversAnnotation']);
}
if (isset($arguments['mapTestClassNameToCoveredClassName'])) {
$codeCoverage->setMapTestClassNameToCoveredClassName($arguments['mapTestClassNameToCoveredClassName']);
}
$result->setCodeCoverage($codeCoverage);
}
if ($codeCoverageReports > 1) {
//.........这里部分代码省略.........
示例5: doRun
/**
* @param PHPUnit_Framework_Test $suite
* @param array $arguments
* @return PHPUnit_Framework_TestResult
*/
public function doRun(PHPUnit_Framework_Test $suite, array $arguments = array())
{
$this->handleConfiguration($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 (is_integer($arguments['repeat'])) {
$suite = new PHPUnit_Extensions_RepeatedTest($suite, $arguments['repeat'], $arguments['filter'], $arguments['groups'], $arguments['excludeGroups'], $arguments['processIsolation']);
}
$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['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 PHPUnit_TextUI_ResultPrinter(NULL, $arguments['verbose'], $arguments['colors'], $arguments['debug']);
}
}
if (!$this->printer instanceof PHPUnit_Util_Log_TAP && !self::$versionStringPrinted) {
$this->printer->write(PHPUnit_Runner_Version::getVersionString() . "\n\n");
if (isset($arguments['configuration'])) {
$this->printer->write(sprintf("Configuration read from %s\n\n", $arguments['configuration']->getFilename()));
}
}
foreach ($arguments['listeners'] as $listener) {
$result->addListener($listener);
}
$result->addListener($this->printer);
if ($this->printer instanceof PHPUnit_TextUI_ResultPrinter) {
$result->addListener(new PHPUnit_Util_DeprecatedFeature_Logger());
}
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']));
}
if ((isset($arguments['coverageClover']) || isset($arguments['reportDirectory'])) && extension_loaded('xdebug')) {
$result->setCodeCoverage($this->codeCoverage);
}
if (isset($arguments['logDbus'])) {
$result->addListener(new PHPUnit_Util_Log_DBUS());
}
if (isset($arguments['jsonLogfile'])) {
$result->addListener(new PHPUnit_Util_Log_JSON($arguments['jsonLogfile']));
}
if (isset($arguments['tapLogfile'])) {
$result->addListener(new PHPUnit_Util_Log_TAP($arguments['tapLogfile']));
}
if (isset($arguments['junitLogfile'])) {
$result->addListener(new PHPUnit_Util_Log_JUnit($arguments['junitLogfile'], $arguments['logIncompleteSkipped']));
}
if ($arguments['strict']) {
$result->strictMode(TRUE);
}
$suite->run($result, $arguments['filter'], $arguments['groups'], $arguments['excludeGroups'], $arguments['processIsolation']);
unset($suite);
$result->flushListeners();
if ($this->printer instanceof PHPUnit_TextUI_ResultPrinter) {
$this->printer->printResult($result);
}
if (extension_loaded('tokenizer') && extension_loaded('xdebug')) {
if (isset($arguments['coverageClover'])) {
$this->printer->write("\nWriting code coverage data to XML file, this may take " . 'a moment.');
$writer = new PHP_CodeCoverage_Report_Clover($arguments['cacheTokens']);
$writer->process($this->codeCoverage, $arguments['coverageClover']);
$this->printer->write("\n");
unset($writer);
}
//.........这里部分代码省略.........