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


PHP Rules::purgeDisabledByTests方法代码示例

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


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

示例1: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     // Temporarily disable the purge of old archives so that getNumeric('nb_visits')
     // in _addReportData does not trigger the data purge of data we've just imported
     Rules::$purgeDisabledByTests = true;
     self::_addLogData();
     self::_addReportData();
     Rules::$purgeDisabledByTests = false;
     self::$dbData = self::getDbTablesWithData();
 }
开发者ID:carriercomm,项目名称:piwik,代码行数:11,代码来源:PrivacyManagerTest.php

示例2: runApiTests

 /**
  * Runs API tests.
  */
 protected function runApiTests($api, $params)
 {
     // make sure that the reports we process here are not directly deleted in ArchiveProcessor/PluginsArchiver
     // (because we process reports in the past, they would sometimes be invalid, and would have been deleted)
     Rules::$purgeDisabledByTests = true;
     $testName = 'test_' . static::getOutputPrefix();
     $this->missingExpectedFiles = array();
     $this->comparisonFailures = array();
     $this->_setCallableApi($api);
     if (isset($params['disableArchiving']) && $params['disableArchiving'] === true) {
         Rules::$archivingDisabledByTests = true;
         Config::getInstance()->General['browser_archiving_disabled_enforce'] = 1;
     } else {
         Rules::$archivingDisabledByTests = false;
         Config::getInstance()->General['browser_archiving_disabled_enforce'] = 0;
     }
     if (!empty($params['hackDeleteRangeArchivesBefore'])) {
         Db::query('delete from ' . Common::prefixTable('archive_numeric_2009_12') . ' where period = 5');
         Db::query('delete from ' . Common::prefixTable('archive_blob_2009_12') . ' where period = 5');
     }
     if (isset($params['language'])) {
         $this->changeLanguage($params['language']);
     }
     $testSuffix = isset($params['testSuffix']) ? $params['testSuffix'] : '';
     $requestUrls = $this->_generateApiUrls(isset($params['format']) ? $params['format'] : 'xml', isset($params['idSite']) ? $params['idSite'] : false, isset($params['date']) ? $params['date'] : false, isset($params['periods']) ? $params['periods'] : (isset($params['period']) ? $params['period'] : false), isset($params['setDateLastN']) ? $params['setDateLastN'] : false, isset($params['language']) ? $params['language'] : false, isset($params['segment']) ? $params['segment'] : false, isset($params['visitorId']) ? $params['visitorId'] : false, isset($params['abandonedCarts']) ? $params['abandonedCarts'] : false, isset($params['idGoal']) ? $params['idGoal'] : false, isset($params['apiModule']) ? $params['apiModule'] : false, isset($params['apiAction']) ? $params['apiAction'] : false, isset($params['otherRequestParameters']) ? $params['otherRequestParameters'] : array(), isset($params['supertableApi']) ? $params['supertableApi'] : false, isset($params['fileExtension']) ? $params['fileExtension'] : false);
     $compareAgainst = isset($params['compareAgainst']) ? 'test_' . $params['compareAgainst'] : false;
     foreach ($requestUrls as $apiId => $requestUrl) {
         // this is a hack
         if (isset($params['skipGetPageTitles'])) {
             if ($apiId == 'Actions.getPageTitles_day.xml') {
                 continue;
             }
         }
         $this->_testApiUrl($testName . $testSuffix, $apiId, $requestUrl, $compareAgainst);
     }
     // Restore normal purge behavior
     Rules::$purgeDisabledByTests = false;
     // change the language back to en
     if ($this->lastLanguage != 'en') {
         $this->changeLanguage('en');
     }
     if (!empty($this->missingExpectedFiles)) {
         $expectedDir = dirname(reset($this->missingExpectedFiles));
         $this->fail(" ERROR: Could not find expected API output '" . implode("', '", $this->missingExpectedFiles) . "'. For new tests, to pass the test, you can copy files from the processed/ directory into" . " {$expectedDir}  after checking that the output is valid. %s ");
     }
     // Display as one error all sub-failures
     if (!empty($this->comparisonFailures)) {
         $messages = '';
         $i = 1;
         foreach ($this->comparisonFailures as $failure) {
             $msg = $failure->getMessage();
             $msg = strtok($msg, "\n");
             $messages .= "\n#" . $i++ . ": " . $msg;
         }
         $messages .= " \n ";
         print $messages;
         $first = reset($this->comparisonFailures);
         throw $first;
     }
     return count($this->comparisonFailures) == 0;
 }
开发者ID:carriercomm,项目名称:piwik,代码行数:64,代码来源:IntegrationTestCase.php


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