Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Zhang <peter@innocraft.com>2021-12-08 02:28:29 +0300
committerGitHub <noreply@github.com>2021-12-08 02:28:29 +0300
commit2da215c65d77fb273c7899fd23e65c67bc50c4f8 (patch)
treebea956ea33765459a7a610744953879a5c5a784e /tests/PHPUnit/Integration
parent4f5cda954a6b64677f9b48223a91e0ec8785e055 (diff)
add disable archiving segment for plugins (#18279)
* add disable archiving segment for plugins add disable archiving segment for plugins * Update Rules.php add isset check * Update global.ini.php update disable_archiving_segment_for_plugins to right place * update tests update tests * Update global.ini.php update wording * update wording and test update wording and test * update tests update tests * Update UIIntegrationTest_admin_diagnostics_configfile.png update config * Update global.ini.php update wording * Update UIIntegrationTest_admin_diagnostics_configfile.png update screen shot * move general config to a file move general config to a file * update screenshot update screenshot * Update Rules.php update rule * Update global.ini.php update global * Update config/global.ini.php Co-authored-by: Stefan Giehl <stefan@matomo.org> * Update core/ArchiveProcessor/Rules.php Co-authored-by: Stefan Giehl <stefan@matomo.org> * update tests and case and special-characters update tests and case and special-characters * update tests update tests * Update UIIntegrationTest_admin_diagnostics_configfile.png update config screenshot * Update core/ArchiveProcessor/Rules.php Co-authored-by: Stefan Giehl <stefan@matomo.org> * Update tests/PHPUnit/System/ArchiveInvalidationTest.php Co-authored-by: Stefan Giehl <stefan@matomo.org> * add footer message for disable plugin add footer message for disable plugin * Update core/Plugin/Visualization.php Co-authored-by: Stefan Giehl <stefan@matomo.org> * core/Plugin/Visualization.php update en and check unsegmented reports * Update en.json update lang * Update core/Config/GeneralConfig.php Co-authored-by: Stefan Giehl <stefan@matomo.org> * Update plugins/CoreHome/lang/en.json Co-authored-by: Stefan Giehl <stefan@matomo.org> * add screenshot tests add screenshot tests * Update DisablePluginArchive.php set up site * Update DisablePluginArchive.php update config * Update DisablePluginArchive.php update to overwrite * Create DisablePluginArchive_DisablePluginArchive.png update screen shot * update config update config * update screen update screen * update screenshots update screenshots * update unrelated screenshots and update tests update unrelated screenshots and update tests Co-authored-by: Stefan Giehl <stefan@matomo.org>
Diffstat (limited to 'tests/PHPUnit/Integration')
-rw-r--r--tests/PHPUnit/Integration/ArchiveProcessor/LoaderTest.php50
1 files changed, 50 insertions, 0 deletions
diff --git a/tests/PHPUnit/Integration/ArchiveProcessor/LoaderTest.php b/tests/PHPUnit/Integration/ArchiveProcessor/LoaderTest.php
index 7465261d28..95ea94833e 100644
--- a/tests/PHPUnit/Integration/ArchiveProcessor/LoaderTest.php
+++ b/tests/PHPUnit/Integration/ArchiveProcessor/LoaderTest.php
@@ -1463,6 +1463,56 @@ class LoaderTest extends IntegrationTestCase
$this->assertTrue($loader->canSkipArchiveForSegment());
}
+ public function test_canSkipArchiveForSegment_returnTrueIfPluginIsDisabled()
+ {
+ Rules::setBrowserTriggerArchiving(false);
+ $config = Config::getInstance();
+ $config->General['disable_archiving_segment_for_plugins'] = 'testPlugin';
+ $date = '2010-04-23';
+ $definition = 'browserCode==ch';
+ $segment = new Segment($definition, [1]);
+ $doneFlag = Rules::getDoneStringFlagFor([1], $segment, 'day', null);
+
+ $this->insertInvalidations([
+ ['date1' => $date, 'date2' => $date, 'period' => 1, 'name' => $doneFlag, 'report' => 'myReport'],
+ ]);
+
+ SegmentApi::getInstance()->add('segment', $definition, 1, true, true);
+ $params = new Parameters(new Site(1), Factory::build('day', $date), $segment);
+ $params->setRequestedPlugin('testPlugin');
+ $params->setArchiveOnlyReport('myReport');
+ $loader = new Loader($params);
+ $this->assertTrue($loader->canSkipArchiveForSegment());
+ }
+
+ public function test_canSkipArchiveForSegment_returnTrueIfPluginIsDisabledBySiteId()
+ {
+ Rules::setBrowserTriggerArchiving(false);
+ Config::setSetting('General_1','disable_archiving_segment_for_plugins','testPlugin');
+ $date = '2010-04-23';
+ $definition = 'browserCode==ch';
+ $segment = new Segment($definition, [1]);
+ $doneFlag = Rules::getDoneStringFlagFor([1], $segment, 'day', null);
+
+ $this->insertInvalidations([
+ ['date1' => $date, 'date2' => $date, 'period' => 1, 'name' => $doneFlag, 'report' => 'myReport'],
+ ]);
+
+ SegmentApi::getInstance()->add('segment', $definition, 1, true, true);
+ $params = new Parameters(new Site(1), Factory::build('day', $date), $segment);
+ $params->setRequestedPlugin('testPlugin');
+ $params->setArchiveOnlyReport('myReport');
+ $loader = new Loader($params);
+ $this->assertTrue($loader->canSkipArchiveForSegment());
+
+ $params = new Parameters(new Site(2), Factory::build('day', $date), $segment);
+ $params->setRequestedPlugin('testPlugin');
+ $params->setArchiveOnlyReport('myReport');
+ $loader = new Loader($params);
+ $this->assertFalse($loader->canSkipArchiveForSegment());
+ }
+
+
public function test_forcePluginArchiving_createsPluginSpecificArchive()
{
$_GET['trigger'] = 'archivephp';