update Piwik to version 2.16 (fixes #91)
This commit is contained in:
parent
296343bf3b
commit
d885a4baa9
5833 changed files with 418860 additions and 226988 deletions
12
www/analytics/config/environment/dev.php
Normal file
12
www/analytics/config/environment/dev.php
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
|
||||
return array(
|
||||
|
||||
'Piwik\Cache\Backend' => DI\object('Piwik\Cache\Backend\ArrayCache'),
|
||||
|
||||
'Piwik\Translation\Loader\LoaderInterface' => DI\object('Piwik\Translation\Loader\LoaderCache')
|
||||
->constructor(DI\get('Piwik\Translation\Loader\DevelopmentLoader')),
|
||||
'Piwik\Translation\Loader\DevelopmentLoader' => DI\object()
|
||||
->constructor(DI\get('Piwik\Translation\Loader\JsonFileLoader')),
|
||||
|
||||
);
|
||||
97
www/analytics/config/environment/test.php
Normal file
97
www/analytics/config/environment/test.php
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
<?php
|
||||
|
||||
use Interop\Container\ContainerInterface;
|
||||
use Piwik\Common;
|
||||
use Piwik\Tests\Framework\Mock\FakeAccess;
|
||||
use Piwik\Tests\Framework\Mock\TestConfig;
|
||||
|
||||
return array(
|
||||
|
||||
// Disable logging
|
||||
'Psr\Log\LoggerInterface' => DI\object('Psr\Log\NullLogger'),
|
||||
|
||||
'Piwik\Cache\Backend' => function () {
|
||||
return \Piwik\Cache::buildBackend('file');
|
||||
},
|
||||
'cache.eager.cache_id' => 'eagercache-test-',
|
||||
|
||||
// Disable loading core translations
|
||||
'Piwik\Translation\Translator' => DI\decorate(function ($previous, ContainerInterface $c) {
|
||||
$loadRealTranslations = $c->get('test.vars.loadRealTranslations');
|
||||
if (!$loadRealTranslations) {
|
||||
return new \Piwik\Translation\Translator($c->get('Piwik\Translation\Loader\LoaderInterface'), $directories = array());
|
||||
} else {
|
||||
return $previous;
|
||||
}
|
||||
}),
|
||||
|
||||
'Piwik\Config' => DI\decorate(function ($previous, ContainerInterface $c) {
|
||||
$testingEnvironment = $c->get('Piwik\Tests\Framework\TestingEnvironmentVariables');
|
||||
|
||||
$dontUseTestConfig = $c->get('test.vars.dontUseTestConfig');
|
||||
if (!$dontUseTestConfig) {
|
||||
$settingsProvider = $c->get('Piwik\Application\Kernel\GlobalSettingsProvider');
|
||||
return new TestConfig($settingsProvider, $testingEnvironment, $allowSave = false, $doSetTestEnvironment = true);
|
||||
} else {
|
||||
return $previous;
|
||||
}
|
||||
}),
|
||||
|
||||
'Piwik\Access' => DI\decorate(function ($previous, ContainerInterface $c) {
|
||||
$testUseMockAuth = $c->get('test.vars.testUseMockAuth');
|
||||
if ($testUseMockAuth) {
|
||||
$idSitesAdmin = $c->get('test.vars.idSitesAdminAccess');
|
||||
$access = new FakeAccess();
|
||||
if (!empty($idSitesAdmin)) {
|
||||
FakeAccess::$superUser = false;
|
||||
FakeAccess::$idSitesAdmin = $idSitesAdmin;
|
||||
FakeAccess::$identity = 'adminUserLogin';
|
||||
} else {
|
||||
FakeAccess::$superUser = true;
|
||||
FakeAccess::$superUserLogin = 'superUserLogin';
|
||||
}
|
||||
return $access;
|
||||
} else {
|
||||
return $previous;
|
||||
}
|
||||
}),
|
||||
|
||||
'observers.global' => DI\add(array(
|
||||
|
||||
array('AssetManager.getStylesheetFiles', function (&$stylesheets) {
|
||||
$useOverrideCss = \Piwik\Container\StaticContainer::get('test.vars.useOverrideCss');
|
||||
if ($useOverrideCss) {
|
||||
$stylesheets[] = 'tests/resources/screenshot-override/override.css';
|
||||
}
|
||||
}),
|
||||
|
||||
array('AssetManager.getJavaScriptFiles', function (&$jsFiles) {
|
||||
$useOverrideJs = \Piwik\Container\StaticContainer::get('test.vars.useOverrideJs');
|
||||
if ($useOverrideJs) {
|
||||
$jsFiles[] = 'tests/resources/screenshot-override/override.js';
|
||||
}
|
||||
}),
|
||||
|
||||
array('Updater.checkForUpdates', function () {
|
||||
try {
|
||||
@\Piwik\Filesystem::deleteAllCacheOnUpdate();
|
||||
} catch (Exception $ex) {
|
||||
// pass
|
||||
}
|
||||
}),
|
||||
|
||||
array('Test.Mail.send', function (\Zend_Mail $mail) {
|
||||
$outputFile = PIWIK_INCLUDE_PATH . '/tmp/' . Common::getRequestVar('module', '') . '.' . Common::getRequestVar('action', '') . '.mail.json';
|
||||
$outputContent = str_replace("=\n", "", $mail->getBodyText($textOnly = true));
|
||||
$outputContent = str_replace("=0A", "\n", $outputContent);
|
||||
$outputContent = str_replace("=3D", "=", $outputContent);
|
||||
$outputContents = array(
|
||||
'from' => $mail->getFrom(),
|
||||
'to' => $mail->getRecipients(),
|
||||
'subject' => $mail->getSubject(),
|
||||
'contents' => $outputContent
|
||||
);
|
||||
file_put_contents($outputFile, json_encode($outputContents));
|
||||
}),
|
||||
)),
|
||||
);
|
||||
62
www/analytics/config/environment/ui-test.php
Normal file
62
www/analytics/config/environment/ui-test.php
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
<?php
|
||||
|
||||
use Piwik\Container\StaticContainer;
|
||||
|
||||
return array(
|
||||
|
||||
// UI tests will remove the port from all URLs to the test server. if a test
|
||||
// requires the ports in UI tests (eg, Overlay), add the api/controller methods
|
||||
// to one of these blacklists
|
||||
'tests.ui.url_normalizer_blacklist.api' => array(),
|
||||
'tests.ui.url_normalizer_blacklist.controller' => array(),
|
||||
|
||||
'Piwik\Config' => \DI\decorate(function (\Piwik\Config $config) {
|
||||
$config->General['cors_domains'][] = '*';
|
||||
$config->General['trusted_hosts'][] = $config->tests['http_host'];
|
||||
$config->General['trusted_hosts'][] = $config->tests['http_host'] . ':' . $config->tests['port'];
|
||||
return $config;
|
||||
}),
|
||||
|
||||
'observers.global' => \DI\add(array(
|
||||
|
||||
// removes port from all URLs to the test Piwik server so UI tests will pass no matter
|
||||
// what port is used
|
||||
array('Request.dispatch.end', function (&$result) {
|
||||
$request = $_GET + $_POST;
|
||||
|
||||
$apiblacklist = StaticContainer::get('tests.ui.url_normalizer_blacklist.api');
|
||||
if (!empty($request['method'])
|
||||
&& in_array($request['method'], $apiblacklist)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
$controllerActionblacklist = StaticContainer::get('tests.ui.url_normalizer_blacklist.controller');
|
||||
if (!empty($request['module'])
|
||||
&& !empty($request['action'])
|
||||
) {
|
||||
$controllerAction = $request['module'] . '.' . $request['action'];
|
||||
if (in_array($controllerAction, $controllerActionblacklist)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$config = \Piwik\Config::getInstance();
|
||||
$host = $config->tests['http_host'];
|
||||
$port = $config->tests['port'];
|
||||
|
||||
if (!empty($port)) {
|
||||
// remove the port from URLs if any so UI tests won't fail if the port isn't 80
|
||||
$result = str_replace($host . ':' . $port, $host, $result);
|
||||
}
|
||||
|
||||
// remove PIWIK_INCLUDE_PATH from result so tests don't change based on the machine used
|
||||
$result = str_replace(realpath(PIWIK_INCLUDE_PATH), '', $result);
|
||||
}),
|
||||
|
||||
array('Controller.ExampleRssWidget.rssPiwik.end', function (&$result, $parameters) {
|
||||
$result = "";
|
||||
}),
|
||||
)),
|
||||
|
||||
);
|
||||
Loading…
Add table
Add a link
Reference in a new issue