Skip to content
Extraits de code Groupes Projets
Valider 29692df1 rédigé par diosmosis's avatar diosmosis
Parcourir les fichiers

Fixing two more system test failures, including one caused by the static cache...

Fixing two more system test failures, including one caused by the static cache in Archive.php never being cleared, and the environment not existing in web archiving.
parent edc4a1b6
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -933,4 +933,12 @@ class Archive
return $idArchivesByMonth;
}
/**
* @internal
*/
public static function clearStaticCache()
{
self::$cache = null;
}
}
......@@ -64,14 +64,17 @@ if (isset($_SERVER['argv']) && Piwik\Console::isSupported()) {
if (Piwik\Common::isPhpCliMode()) {
// We can run the archive in CLI with `php-cgi` so we have to configure the container/logger
// just like for CLI
$container = new \Piwik\Application\Environment('cli');
$container->init();
$environment = new \Piwik\Application\Environment('cli');
$environment->init();
/** @var ConsoleHandler $consoleLogHandler */
$consoleLogHandler = StaticContainer::get('Symfony\Bridge\Monolog\Handler\ConsoleHandler');
$consoleLogHandler->setOutput(new ConsoleOutput(OutputInterface::VERBOSITY_VERBOSE));
} else {
// HTTP request: logs needs to be dumped in the HTTP response (on top of existing log destinations)
$environment = new \Piwik\Application\Environment(null);
$environment->init();
/** @var \Monolog\Logger $logger */
$logger = StaticContainer::get('Psr\Log\LoggerInterface');
$handler = new StreamHandler('php://output', Logger::INFO);
......
......@@ -10,6 +10,7 @@ namespace Piwik\Tests\Framework;
use Piwik\Access;
use Piwik\Application\Environment;
use Piwik\Application\Kernel\GlobalSettingsProvider\IniSettingsProvider;
use Piwik\Archive;
use Piwik\Cache\Backend\File;
use Piwik\Cache as PiwikCache;
use Piwik\Common;
......@@ -311,6 +312,7 @@ class Fixture extends \PHPUnit_Framework_Assert
public function clearInMemoryCaches()
{
Archive::clearStaticCache();
DataTableManager::getInstance()->deleteAll();
Option::clearCache();
Site::clearCache();
......
......@@ -26,22 +26,23 @@ class TwoVisitsWithCustomVariablesSegmentMatchNONETest extends SystemTestCase
*/
public function testApi($api, $params)
{
if (!array_key_exists('segment', $params)) {
$params['segment'] = $this->getSegmentToTest(); // this method can access the DB, so we get it here instead of the data provider
}
$this->runApiTests($api, $params);
}
public function getApiForTesting()
{
// we will test all segments from all plugins
Fixture::loadAllPlugins();
$apiToCall = array('VisitsSummary.get', 'CustomVariables.getCustomVariables');
return array(
array($apiToCall, array('idSite' => 'all',
'date' => self::$fixture->dateTime,
'periods' => array('day', 'week'),
'setDateLastN' => true,
'segment' => $this->getSegmentToTest()))
'setDateLastN' => true))
);
}
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter